Maintainer: Luca Sartore
Dual numbers are mainly used to implement automatic differentiation. The dual package provides mathematical functions that are able to handle computations with dual numbers. The package is useful to calculate exact derivatives in R without providing self-coded functions.
For a complete list of exported functions, use
library(help = "dual")
once the dual
package is installed (see the inst/INSTALL.md
file for a
detailed description of the setup process).
library(dual)
<- dual(f = 1.5, grad = c(1:0, 0))
x <- dual(f = 0.5, grad = c(0:1, 0))
y <- dual(f = 1.0, grad = c(0, 0:1))
z exp(z - x) * sin(x)^y / x
<- dual(f = 1.1, grad = c(1.2, 2.3, 3.4, 4.5, 5.6))
a 0.5 * a^2 - 0.1
Baydin, A. G., Pearlmutter, B. A., Radul, A. A., & Siskind, J. M. (2018). Automatic differentiation in machine learning: a survey. Journal of Machine Learning Research, 18, 1-43.
Cheng, H. H. (1994). Programming with dual numbers and its applications in mechanisms design. Engineering with Computers, 10(4), 212-229.
Kisil, V. V. (2007). Erlangen program at large-2: inventing a wheel. The parabolic one. arXiv: 0707.4020.