dualr-class: Dual Number Class for Automatic Differentiation

dualr-classR Documentation

Dual Number Class for Automatic Differentiation

Description

S4 class representing a dual number a + b\varepsilon where \varepsilon^2 = 0. The value slot holds the primal value and the deriv slot holds the tangent (derivative) component. Both slots accept ANY type to support nested duals for higher-order derivatives.

Slots

value

The primal (function) value. Numeric for first-order duals, or another dual for higher-order.

deriv

The tangent (derivative) component. Numeric for first-order duals, or another dual for higher-order.


nabla documentation built on Feb. 11, 2026, 1:06 a.m.