dual-package: Automatic Differentiation with Dual Numbers

dual-packageR Documentation

Automatic Differentiation with Dual Numbers

Description

This package provides mathematical functions that are able to handle computations with dual numbers. Dual numbers are mainly used to implement automatic differentiation. The package is useful to calculate exact derivatives in R without providing hand-coded gradient functions. Kisil (2007) <arXiv:0707.4024>

Details

Package: dual
Type: Package
Version: 0.0.4
Date: 2022-08-31
License: GPL-3

For a complete list of exported functions, use library(help = "dual").

Author(s)

Luca Sartore drwolf85@gmail.com

Maintainer: Luca Sartore drwolf85@gmail.com

References

Baydin, A. G., Pearlmutter, B. A., Radul, A. A., & Siskind, J. M. (2018). Automatic differentiation in machine learning: a survey. Journal of Marchine 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.

Examples

library(dual)
x <- dual(f = 1.5, grad = c(1, 0, 0))
y <- dual(f = 0.5, grad = c(0, 1, 0))
z <- dual(f = 1.0, grad = c(0, 0, 1))
exp(z - x) * sin(x)^y / x

a <- dual(1.1, grad = c(1.2, 2.3, 3.4, 4.5, 5.6))
0.5 * a^2 - 0.1


dual documentation built on Sept. 1, 2022, 1:05 a.m.