Advertisement
makispaiktis

Functions and Reverse Functions

Oct 1st, 2020 (edited)
875
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. from math import exp, log
  2. from matplotlib import pyplot as plt
  3.  
  4. x = list()
  5. LIMIT = 2
  6. counter = LIMIT / 100
  7. while counter <= LIMIT:
  8.     x.append(counter)
  9.     counter += LIMIT / 100
  10.  
  11. # Building the functions
  12. y1 = list()
  13. y2 = list()
  14. y = list()
  15. for element in x:
  16.     y1.append(exp(element))
  17.     y2.append(log(element))
  18.     y.append(element)
  19. print(y1)
  20. print(y)
  21. print(y2)
  22. # Building the diagram
  23. plt.plot(x, y1, label="y1 = e^x")
  24. plt.plot(x, y, label="y = x")
  25. plt.plot(x, y2, label="y2 = lnx")
  26. plt.legend()
  27. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement