Gauss’s Forward interpolation method

Gauss’s Forward interpolation method :

ALGORITHMS :

  1. [START]
  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++
    diff[i][1]=ay[i+1]-ay[i]
    [end loop i]
  7. for j=2;j<=4;j++
  8. for i=0;i<n–j;i++
    diff[i][j]=diff[i+1][j–1]–diff[i][j–1]
  9. [end inner loop i]
  10. [end outer loop j]
  11. i=0
  12. Repeat Step 16 until ax[i]<x
  13. i=i+1
  14. i=i–1;
  15. p=(x–ax[i])/h
  16. y1=p*diff[i][1]
  17. y2=p*(p–1)*diff[i–1][2]/2
  18. y3=(p+1)*p*(p-1)*diff[i–2][3]/6
  19. y4=(p+1)*p*(p–1)*(p–2)*diff[i–3][4]/24
  20. y=ay[i]+y1+y2+y3+y4
  21. Print Output x,y
  22. [end of program]

C SOURCE CODE :

OUTPUT :

Gauss's Forward interpolation method


Leave a Reply

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