chaospy.hessian¶
- chaospy.hessian(poly: Union[numpy._typing._array_like._SupportsArray[numpy.dtype], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]], numpoly.baseclass.ndpoly]) 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 inpoly.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]]])