Exercise "Interpolation"

  1. Implement a subroutine which makes a Lagrange polynomial interpolation of a table {x[i],y[i]} at a given point z.
  2. Implement a subroutine for the quadratic spline interpolation.
  3. Create some interesting interpolation examples -- a step function perhaps, a function with a pole, or what not.
  4. Hint: location of the index i: x[i]<z<x[i+1] must be done using the binary search.
  5. Implement a subroutine for cubic spline interpolation.
  6. Implement a subroutine which calculates the derivative of a tabulated function by building a spline and then differentiating (analytically) the spline.
  7. Implement a subroutine which calculates the antiderivative (the integral) of a tabulated function by building a spline and then integrating (analytically) the spline.