autodiff.reverse.sqrt

autodiff.reverse.sqrt(x)

Return the square root of x.

Parameters
xint, float, Node
Returns
yfloat or Node

Notes

The square root of x is undefined when x is less than 0.

Examples

>>> ad.sqrt(4)
2.0
>>> x = ad.Node(4)
>>> ad.sqrt(x)
Node(2.0)

Derivative undefined:

>>> x = ad.Node(-1)
>>> ad.sqrt(x)
Traceback (most recent call last):
...
ValueError: Derivative of sqrt(x) is undefined for x < 0