Advertisement
mfgnik

Untitled

Mar 28th, 2020
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. from matplotlib import pyplot as plt
  2. import numpy as np
  3.  
  4.  
  5. def func2(n, func):
  6.     l = func(n)
  7.     print(l)
  8.     return (1 - 2 ** (-1 / l)) ** (1 / n)
  9.  
  10.  
  11. x = np.arange(1, 51)
  12. l = [lambda n : n ** 2, lambda n : n ** 5, lambda n : n ** 10, lambda n : 2 ** n]
  13. names = ["n ** 2", "n ** 5", "n ** 10", "2 ** n"]
  14. plt.figure(figsize=(18, 8))
  15. for i in range(len(l)):
  16.     plt.plot(x, func2(x, l[i]), label='{} points'.format(names[i]))
  17. plt.grid(True)
  18. plt.legend(prop={'size': 18})
  19. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement