daily pastebin goal
26%
SHARE
TWEET

Untitled

a guest Jan 12th, 2018 42 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import numpy as np
  2. import math
  3. from scipy.interpolate import lagrange
  4. f = []
  5. for j in range(5):
  6.     x = -1 + j/2
  7.     f = 1/np.cosh(math.pi*x)
  8.     print("{",x,",",f,
  9. ########################################
  10. a = np.array([-1.0 ,
  11.               -0.5 ,
  12.               0.0 ,
  13.               0.5 ,
  14.               1.0 ,])
  15. b = np.array([0.08626673833405443 ,
  16.               0.3985368153383867 ,
  17.               1.0 ,
  18.               0.3985368153383867 ,
  19.               0.08626673833405443 ,
  20. ])
  21. def my_range(start, end, step):
  22.     while start <= end:
  23.         yield start
  24.         start += step
  25.        
  26. ok = lagrange(a,b)
  27. print(ok,",")
  28. #########################################
  29. 1.989 x^4 - 1.249e-16 x^3 - 2.903 x^2 - 2.255e-17 x^1 + 1 ,
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top