Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pylab as plt
  3.  
  4. def wartosc(f,x=0):
  5. return eval(f,{'x':x})
  6.  
  7. wielomian = 'x**2+x'
  8. x=np.array([1,2,3])
  9. y=np.array([1,3,8])
  10. z=y+0
  11. for i in range(0,len(x)):
  12. z[i]=wartosc(wielomian,x[i])
  13.  
  14. plt.plot(x,y, "ro", ms=10)
  15. plt.plot(x,z,lw=2)
  16. plt.xlim(0,4)
  17. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement