Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ erfcx_derivative()

template<typename T >
T stan::math::internal::erfcx_derivative ( const T &  x,
const T &  value 
)
inline

Derivative of erfcx, 2 * x * erfcx(x) - 2 / sqrt(pi).

That difference cancels for large x: both terms approach 2 / sqrt(pi) while the result decays like 1 / (sqrt(pi) * x^2). For x >= 4 the tail rational gives the derivative with no subtraction, because the constant cancels analytically:

2 * x * (INV_SQRT_PI + u * C(u)) / x - 2 / sqrt(pi) = 2 * u * C(u)

since 2 * INV_SQRT_PI is 2 / sqrt(pi). The walk in x^2 is the one erfcx_cody_tail uses.

Above 30 the derivative is taken from the asymptotic expansion of ‘-sqrt(pi) * x^2 * erfcx’(x)inu = 1 / x^2, whose coefficients satisfyc_{n+1} = -(n + 3/2) * c_n`.

Template Parameters
Tscalar type
Parameters
xargument
valueerfcx(x)
Returns
derivative of erfcx at x

Definition at line 128 of file erfcx.hpp.