Advertisement
Guest User

exo 13 curves

a guest
Oct 18th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2. from fractions import Fraction
  3.  
  4. W = [Fraction(1)]
  5.  
  6. def tracer(f, pts): plt.plot(pts, [f(x) for x in pts])
  7.  
  8. def W2p1(n):
  9.     if n>=len(W):
  10.         W.append(Fraction(2*n, 2*n+1)*W2p1(n-1))
  11.     return W[n]
  12.  
  13. def phi(n): return lambda x: (1-x**2)**n/2/W2p1(n).real
  14.  
  15. def subdiv(n): return [-1+i*(2)/n for i in range(n)]
  16. ##
  17. pts = subdiv(1000)
  18. ##
  19. for n in range(500):
  20.     tracer(phi(n), pts)
  21. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement