Lagrange’s method for interpolation

Lagrange’s method for interpolation :

ALGORITHM :

  1. [start]
  2. Input number of terms n
  3. Input the array ax
  4. Input the array ay
  5. for i=0; i<n; i++
  6. nr=1
  7. dr=1
  8. for j=0; j<n; j++
  9. if j !=i
    nr=nr∗(x-ax[j])
    dr∗(ax[i]-ax[j])
  10. [end of loop j]
  11. y+=(nr/dr)∗ay[i]
  12. [end of loop i]
  13. Print Output x, y
  14. [end of program]

C SOURCE CODE :

OUTPUT:

Lagrange's method for interpolation


Leave a Reply

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