chaospy.decompose¶
- chaospy.decompose(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]¶
Decompose a polynomial to component form.
In array missing values are padded with 0 to make decomposition compatible with
chaospy.sum(output, 0)
.- Args:
- poly:
Polynomial to decompose.
- Return:
Decomposed polynomial with
poly.shape==(M,)+output.shape
, whereM
is the number of components in poly.- Example:
>>> q0 = numpoly.variable() >>> poly = numpoly.polynomial([q0**2-1, 2]) >>> poly polynomial([q0**2-1, 2]) >>> numpoly.decompose(poly) polynomial([[-1, 2], [q0**2, 0]]) >>> numpoly.sum(numpoly.decompose(poly), 0) polynomial([q0**2-1, 2])