numpoly.power

numpoly.power(x1: numpoly.typing.PolyLike, x2: numpoly.typing.PolyLike, **kwargs: Any)numpoly.baseclass.ndpoly[source]

First array elements raised to powers from second array, element-wise.

Raise each base in x1 to the positionally-corresponding power in x2. x1 and x2 must be broadcastable to the same shape. Note that an integer type raised to a negative integer power will raise a ValueError.

Args:
x1:

The bases.

x2:

The exponents. If x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).

out:

A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.

where:

This condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default out=None, locations within it where the condition is False will remain uninitialized.

kwargs:

Keyword args passed to numpy.ufunc.

Return:

The bases in x1 raised to the exponents in x2. This is a scalar if both x1 and x2 are scalars.

Example:
>>> q0 = numpoly.variable()
>>> (q0+1)**3
polynomial(q0**3+3*q0**2+3*q0+1)
>>> q0q1 = numpoly.variable(2)
>>> (q0q1+1)**[1, 2]
polynomial([q0+1, q1**2+2*q1+1])