Algo and Math

Valuto il polinomio (x-1)^9

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

a = 2

val = poli(a)

import matplotlib.pyplot as plt
plt.plot(a, val, 'o')
plt.show()


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

def punti_equidistanti(a, b, n):
x = np.linspace(a, b, n+1)
return x

#intervallo a
a = 0
#intervallo b
b = 2
#n
n = 9

val = poli(a)

import matplotlib.pyplot as plt
plt.plot(a, val, 'o')
plt.show()

pti = punti_equidistanti(a, b, n)
#nel polinomio, gli sto passando 10 punti e non solo uno
plt.plot(pti, poli(pti), 'o')
plt.show()

Exit mobile version