Newton’s Forward Interpolation

Newton’s Forward Interpolation :

ALGORITHM :

  1. Start of the program
  2. Input number of terms n
  3. Input the array ax
  4. Input the array ay
  5. h=ax[1] – ax[0]
  6. for i=0; i<n-1; i++
  7. diff[i] [1]=ay[i + 1] – ay[i]
  8. End Loop i
  9. for j=2; j<=4; j++
  10. for i = 0; i <n – j; i++
  11. diff[i][j]=diff [i + 1] [j – 1]-diff [i][j – 1]
  12. End Loop i
  13. End Loop j
  14. i=0
  15. Repeat Step 16 until ax[i]<x
  16. i=i + 1
  17. i=i – 1;
  18. p=(x – ax [i])/h
  19. y1=p∗diff[i – 1][1]
  20. y2=p∗(p+1)∗diff [i – 1][2]/2
  21. y3=(p+1)∗p∗(p-1)∗diff[i –2 ][3]/6
  22. y4=(p+2)∗(p+1)∗p∗(p – 1)∗diff[i – 3][4]/24
  23. y=ay[i]+y1+y2+y3+y4
  24. Print output x, y
  25. End of program.

C SOURCE CODE :

OUTPUT :

Newton's Forward Interpolation

Leave a Reply

Your email address will not be published. Required fields are marked *