Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- x = np.linspace(1,1.50,10)
- print(x.round(2))
- y= np.arange(-10,10,1)
- print(y)
- a= 3
- c=1
- lin = 2*x
- quad=3*x**2 +1*x
- deriv = 2*x-5
- l = '2x'
- q= ' x**2'
- d= ' 2x-5 '
- #leg = [l,q,d]
- #plt.plot(lin)
- #plt.plot(quad)
- #plt.plot(deriv)
- #plt.legend(leg, loc='upper left')
- #plt.show()
- x=np.arange(-10,10,1)
- a=3
- c=1
- eq = a*x**2 +c*x
- deriv = 2*a*x+c
- plt.plot(eq)
- plt.plot(deriv)
- plt.show()
- fig = plt.gcf()
- fig.show()
- fig.canvas.draw()
- i=1
- x=np.arange(-1,0.5,0.2)
- a=0.5
- c=0.1
- for i in range(10):
- plt.cla()
- plt.clf()
- plt.plot(eq) # plot equation
- plt.plot(deriv)
- # update canvas immediately
- plt.xlim([-20, 40])
- plt.ylim([-20, 100])
- fig.canvas.draw()
- plt.pause(0.5)
- x=np.arange(-10+i,10+i,1)
- eq = a*x**2 +c*x
- deriv = 2*a*x+c
- i+=1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement