Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def newton_coef(list_x, list_y):
- n = len(list_x)
- for j in range(1,n):
- for i in range(n-1, j-1, -1 ):
- list_y[i]=(list_y[i]-list_y[i-1])/(list_x[i]-list_x[i-j])
- return list_y
- if __name__ == '__main__':
- x=[3,1,5,6]
- y=[1,-3,2,4]
- print(newton_coef(x,y))
Advertisement
Add Comment
Please, Sign In to add comment