numpoly.hessian

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

Construct Hessian matrix of polynomials.

Make Hessian matrix out of a polynomial. Tensor is returned if polynomial is a vector.

Args:
poly:

Polynomial to differentiate.

Return:

Same as poly but with two extra dimensions, one for each variable in poly.indeterminants, filled with Hessian values.

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

            [[0, 0, 2*q1],
             [0, 0, 2*q0]]])