![]() |
Stan Math Library
5.4.0
Automatic Differentiation
|
|
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`.
| T | scalar type |
| x | argument |
| value | erfcx(x) |
erfcx at x