| dual-math | R Documentation |
Implements all standard mathematical functions for dual numbers via
the chain rule: f(dual(a, b)) = dual(f(a), df(a) * b).
Supported functions: abs, sign, sqrt, floor,
ceiling, trunc, round,
exp, expm1, log, log2, log10, log1p,
cos, sin, tan, cospi, sinpi, tanpi,
acos, asin, atan,
cosh, sinh, tanh, acosh, asinh, atanh,
gamma, lgamma, digamma, trigamma,
cumsum, factorial, lfactorial.
## S4 method for signature 'dualr'
exp(x)
## S4 method for signature 'dualr'
sqrt(x)
## S4 method for signature 'dualr'
Math(x)
x |
A |
A dual with the function applied to the value and the
derivative propagated via the chain rule.
x <- dual_variable(pi / 4)
value(sin(x))
deriv(sin(x))
y <- dual_variable(2)
value(exp(y))
deriv(exp(y))
deriv(log(y))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.