Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import scipy as sp
- import matplotlib.pyplot as plt
- def wartosc(f,x):
- return eval(f,{'x':x})
- print('funkcja y=a*x+b')
- a= input('Podaj a=')
- b= input('Podaj b=')
- funkcja=a+"*x+" +b
- xmin=-1
- xmax=1
- x=np.arange(xmin,xmax,0.1)
- y=x+0.0
- for i in range(0,len(x)):
- y[i]=wartosc(funkcja,x[i])+sp.rand()
- plt.plot(x,y,"ro", ms = 5)
- plt.title("y="+funkcja)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement