numpoly.set_dimensions

numpoly.set_dimensions(poly: numpoly.typing.PolyLike, 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')