Python: chebyshev

Python: chebyshev

import numpy as np
def poli(x):
return (x-1)**9

#nodi di chebyshev
def chebichev(a, b, n):
x = (a+b)/2 + (b-a)/2 * np.cos(((2*np.arange(0, n+1)+1)* np.pi)/(2*(n+1)))
h = np.flipud(x)
return h

#intervallo
a = 0
b = 2
n = 9

import matplotlib.pyplot as plt
chebi = chebichev(a, b, n)
plt.plot(chebi, poli(chebi), 'o')
plt.show()

About Post Author

pasquale.clarizio

Leave Comments

error: Content is protected !!
Advertisment ad adsense adlogger