numpoly.gradient

numpoly.gradient(poly: numpoly.typing.PolyLike)numpoly.baseclass.ndpoly[source]

Polynomial gradient operator.

Args:
poly:

Polynomial to differentiate. If polynomial vector is provided, the Jacobi-matrix is returned instead.

Return:

Same as poly but with an extra first dimensions, one for each variable in poly.indeterminants, filled with gradient values.

Example:
>>> q0 = numpoly.variable()
>>> poly = 5*q0**5+4
>>> numpoly.gradient(poly)
polynomial([25*q0**4])
>>> q0, q1 = numpoly.variable(2)
>>> poly = 4*q0**3+2*q1**2+3
>>> numpoly.gradient(poly)
polynomial([12*q0**2, 4*q1])
>>> poly = numpoly.polynomial([1, q0**3, q0*q1**2+1])
>>> numpoly.gradient(poly)
polynomial([[0, 3*q0**2, q1**2],
            [0, 0, 2*q0*q1]])