maths.dual_number_automatic_differentiation

Classes

Dual

Functions

differentiate(func, position, order)

f(y)

Module Contents

class maths.dual_number_automatic_differentiation.Dual(real, rank)
__add__(other)
__floordiv__(other)
__mul__(other)
__pow__(n)
__repr__()
__sub__(other)
__truediv__(other)
reduce()
__radd__
__rmul__
real
maths.dual_number_automatic_differentiation.differentiate(func, position, order)
>>> differentiate(lambda x: x**2, 2, 2)
2
>>> differentiate(lambda x: x**2 * x**4, 9, 2)
196830
>>> differentiate(lambda y: 0.5 * (y + 3) ** 6, 3.5, 4)
7605.0
>>> differentiate(lambda y: y ** 2, 4, 3)
0
>>> differentiate(8, 8, 8)
Traceback (most recent call last):
    ...
ValueError: differentiate() requires a function as input for func
>>> differentiate(lambda x: x **2, "", 1)
Traceback (most recent call last):
    ...
ValueError: differentiate() requires a float as input for position
>>> differentiate(lambda x: x**2, 3, "")
Traceback (most recent call last):
    ...
ValueError: differentiate() requires an int as input for order
maths.dual_number_automatic_differentiation.f(y)