Guest User

Untitled

a guest
Jul 5th, 2022
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. def newton_coef(list_x, list_y):
  2.     n = len(list_x)
  3.     for j in range(1,n):
  4.         for i in range(n-1, j-1, -1 ):
  5.             list_y[i]=(list_y[i]-list_y[i-1])/(list_x[i]-list_x[i-j])
  6.     return list_y
  7.  
  8. if __name__ == '__main__':
  9.     x=[3,1,5,6]
  10.     y=[1,-3,2,4]
  11.     print(newton_coef(x,y))
Advertisement
Add Comment
Please, Sign In to add comment