numpoly.ndpoly.todict¶
- ndpoly.todict() → Dict[Tuple[int, ...], numpy.ndarray][source]¶
Cast to dict where keys are exponents and values are coefficients.
- Return:
Dictionary where keys are exponents and values are coefficients.
- Example:
>>> q0, q1 = numpoly.variable(2) >>> poly = 2*q0**4-3*q1**2+14 >>> poly polynomial(2*q0**4-3*q1**2+14) >>> poly.todict() == {(0, 0): 14, (4, 0): 2, (0, 2): -3} True