autodiff.Dual.__add__

Dual.__add__(other)

Return the sum of self and other.

Parameters
selfDual
otherint, float, Dual
Returns
outDual

Examples

Dual number and scalar:

>>> ad.Dual(42) + 5
Dual(47, array([1]))

Two dual numbers (univariate):

>>> ad.Dual(42) + ad.Dual(1)
Dual(43, array([2]))

Two dual numbers (multivariate):

>>> ad.Dual(42, [1, 2]) + ad.Dual(1, [3, 4])
Dual(43, array([4, 6]))