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.