autodiff.Dual.__sub__

Dual.__sub__(other)

Returns the difference between self and other.

Parameters
selfDual
otherint, float, Dual
Returns
outDual

Examples

Dual number and scalar:

>>> ad.Dual(42) - 5
Dual(37, array([1]))

Two dual numbers (univariate):

>>> ad.Dual(42) - ad.Dual(1)
Dual(41, array([0]))

Two dual numbers (multivariate):

>>> ad.Dual(42, [1, 2]) - ad.Dual(1, [3, 4])
Dual(41, array([-2, -2]))