numpoly.call¶
- numpoly.call(poly: numpoly.typing.PolyLike, args: Sequence[Optional[numpoly.typing.PolyLike]] = (), kwargs: Optional[Dict[str, numpoly.typing.PolyLike]] = None) → Union[numpy.ndarray, numpoly.baseclass.ndpoly][source]¶
Evaluate polynomial by inserting new values in to the indeterminants.
Equivalent to calling the polynomial or using the
__call__
method.- Args:
- poly:
Polynomial to evaluate.
- args:
Argument to evaluate indeterminants. Ordered positional by
poly.indeterminants
. None values indicate that a variable is not to be evaluated, creating a partial evaluation.- kwargs:
Same as
args
, but positioned by name.
- Return:
Evaluated polynomial. If the resulting array does not contain any indeterminants, an array is returned instead of a polynomial.
- Example:
>>> q0, q1 = numpoly.variable(2) >>> poly = numpoly.polynomial([[q0, q0-1], [q1, q1+q0]]) >>> numpoly.call(poly) polynomial([[q0, q0-1], [q1, q1+q0]]) >>> poly polynomial([[q0, q0-1], [q1, q1+q0]]) >>> numpoly.call(poly, (1, 0)) array([[1, 0], [0, 1]]) >>> numpoly.call(poly, (1,), {"q1": [0, 1, 2]}) array([[[1, 1, 1], [0, 0, 0]], [[0, 1, 2], [1, 2, 3]]]) >>> numpoly.call(poly, (q1,)) polynomial([[q1, q1-1], [q1, 2*q1]]) >>> numpoly.call(poly, kwargs={"q1": q0-1, "q0": 2*q1}) polynomial([[2*q1, 2*q1-1], [q0-1, 2*q1+q0-1]])