Advertisement
dracz3

Untitled

Sep 17th, 2023
902
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | Source Code | 0 0
  1. import math
  2.  
  3. y0 = math.sqrt(2) - 1
  4. a0 = 6 - (4 * math.sqrt(2))
  5.  
  6.  
  7. def f(y):
  8.     fy= (1 - (y**4)) ** (0.25)
  9.     return fy
  10.  
  11.  
  12. def calculate_y_kp1(k):
  13.     return (1 - f(y[k])) / (1 + f(y[k]))
  14.  
  15.  
  16. def calculate_a_kp1(k):
  17.     return (a[k] * (1 + y[k+1]) ** 4) - (2 ** (2*k+3) * y[k+1] * (1 + y[k+1] + (y[k+1] ** 2)))
  18.  
  19.  
  20.  
  21. y = [y0]
  22. a = [a0]
  23. est = []
  24. for k in range(15):
  25.     y.append(calculate_y_kp1(k))
  26.     a.append(calculate_a_kp1(k))
  27.     est.append(1/a[k+1])
  28.    
  29. print(est)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement