[SciPy-User] polynomials - just some pictures

josef.pktd@gmai... josef.pktd@gmai...
Sun Nov 21 14:41:12 CST 2010


another installment in looking at polynomials  - just some pictures this time

(filename is still a misnomer)

Josef
-------------- next part --------------


import numpy as np
import numpy.polynomial as npp
import matplotlib.pyplot as plt

nobs = 100
lb, ub = -1,1
x = np.linspace(lb,ub,nobs)

for Poly in [npp.Polynomial, npp.Chebyshev]:
    plt.figure()
    for deg in range(5):
        coeffs = np.zeros(5)
        coeffs[deg] = 1
        y = Poly(coeffs)(x)
        plt.plot(x, y)
        plt.title(Poly.__name__)

lb, ub = -2,2
x = np.linspace(lb,ub,nobs)
for Poly in [npp.Polynomial, npp.Chebyshev]:
    plt.figure()
    for deg in range(5):
        coeffs = np.zeros(5)
        coeffs[deg] = 1
        y = Poly(coeffs, domain=[-2,2])(x)
        plt.plot(x, y)
        plt.title(Poly.__name__)

from scipy import special

nobs = 100
lb, ub = -1,1
x = np.linspace(lb,ub,nobs)

for Poly in [special.hermitenorm, special.legendre]:
    plt.figure()
    for deg in range(5):
        y = Poly(deg)(x)
        plt.plot(x, y)
    plt.title(Poly.__name__)

plt.show()


More information about the SciPy-User mailing list