numpoly.decompose

numpoly.decompose(poly: numpoly.typing.PolyLike)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, where M 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])