autodiff.sqrt

autodiff.sqrt(x)

Return the square root of x.

Parameters
xint, float, Dual
Returns
yfloat or Dual

Notes

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

Examples

>>> ad.sqrt(4)
2.0
>>> x = ad.Dual(4, -1.5)
>>> ad.sqrt(x)
Dual(2.0, array([-0.375]))

Derivative undefined:

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