chaospy.set_dimensions

chaospy.set_dimensions(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], dimensions: Optional[int] = None) numpoly.baseclass.ndpoly[source]

Adjust the dimensions of a polynomial.

Args:
poly:

Input polynomial

dimensions:

The dimensions of the output polynomial. If omitted, increase polynomial with one dimension.

Return:

Polynomials with no internal dimensions. Unless the new dim is smaller then poly’s dimensions, the polynomial should have the same content.

Example:
>>> q0, q1 = numpoly.variable(2)
>>> poly = q0*q1-q0**2
>>> numpoly.set_dimensions(poly, 1)
polynomial(-q0**2)
>>> numpoly.set_dimensions(poly, 3)
polynomial(q0*q1-q0**2)
>>> numpoly.set_dimensions(poly).names
('q0', 'q1', 'q2')