Skip to main content

Module ad

Module ad 

Functions§

abs
Absolute value. f' = sign(x), f'' = 0 (away from 0). At x = 0 the derivative is not defined; every surface takes the sub-gradient f'(0) = +1 (the x >= 0 branch), matching the winning-branch convention max/min use for payoffs.
acos
Inverse cosine. f' = -1/√(1-x²), f'' = x·f'³.
acosh
Inverse hyperbolic cosine. f' = 1/√(x²-1), f'' = -x·f'³.
asin
Inverse sine. f' = 1/√(1-x²), f'' = x·f'³.
asinh
Inverse hyperbolic sine. f' = 1/√(x²+1), f'' = -x·f'³.
atan
Inverse tangent. f' = 1/(1+x²), f'' = -2x·f'².
atan2
atanh
Inverse hyperbolic tangent. f' = 1/(1-x²), f'' = 2x·f'².
cbrt
Cube root. f' = 1/(3·f²), f'' = -2/(9·x·f²).
cos
Cosine.
cosh
Hyperbolic cosine.
dot
erf
Gaussian error function. f' = (2/√π)·e^{-x²}, f'' = -2x·f'.
erfc
Complementary error function 1 - erf(x). f' = -(2/√π)·e^{-x²}.
exp
Exponential. f = f' = f''.
exp2
Base-2 exponential. f' = f·ln 2, f'' = f·(ln 2)².
exp_m1
exp(x) - 1. f' = f'' = exp(x) = f + 1.
hypot
inv_norm_cdf
Inverse standard normal CDF Φ⁻¹(p). f' = 1/φ(f), f'' = f·f'².
ln
Natural logarithm. f' = 1/x, f'' = -1/x².
ln_1p
ln(1 + x). f' = 1/(1+x), f'' = -f'².
log2
Base-2 logarithm. f' = 1/(x·ln 2), f'' = -f'/x.
log10
Base-10 logarithm. f' = 1/(x·ln 10), f'' = -f'/x.
max
min
norm_cdf
Standard normal CDF Φ(x). f' = φ(x), f'' = -x·φ(x).
norm_pdf
Standard normal density φ(x). f' = -x·φ(x), f'' = (x² − 1)·φ(x).
pow
powf
powi
sin
Sine.
sinh
Hyperbolic sine.
sqrt
Square root. f' = 1/(2√x), f'' = -1/(4·x·√x).
sum
tan
Tangent. f' = 1 + tan², f'' = 2·tan·f'.
tanh
Hyperbolic tangent. f' = 1 - tanh², f'' = -2·tanh·f'.
weighted_dot
weighted_sum