Advertisement
silver2row

Pro. for Comp. Book and issue number one...

Aug 8th, 2020
1,495
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3.  
  4. t = np.linspace(-2, 2, 100)   # choose 100 points in a time interval
  5.  
  6. f_values  = t**2
  7. g_values  = np.exp(t)
  8.  
  9. plt.plot(t, f_values, 'r', t, g_values, 'b--')
  10. plt.xlabel('t')
  11. plt.ylabel('f and g')
  12. plt.legend(['t**2', 'e**t'])
  13. plt.title('Plotting Two Functions (t**2 and e**t)')
  14. plt.grid('on')
  15. plt.axis([-3, 3, -1, 10])
  16. plt.show()
  17.  
  18. # page 24 and 25 of Programming for Computations
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement