# Computational Physics (Making programs for interpolation and differentiation)

1. Oct 29, 2012

### jhosamelly

1. The problem statement, all variables and given/known data

Chapter 4
1. Write a program that implements the first order (linear) interpolation
2. Write a program that implemets n-point Lagrange interpolation. Trean n as an imput parameter.
3. Apply the program to study the quality of the Lagrange interpolation to functions
f(x)=sin(x2), f(x)=esin(x), and f(x)=0.2/[(x-3.2)2+0.04]
initially calculated in 10 unifirm points in the interval [0.0, 5.0]. Compare the results with the cubic spline interpolation.
4. Use third and seventh order polynomial interpolation to interpolate Runge's function:

at the n=11 points xi=-1.0, -0.8, ..., 0.8, 1.0. Compare the results with the cubic spline interpolation
Study how the number of data points for interpolation affects the quality of interpolation of 5. Runge's function in the example above.

Chapter 5

1. Write a program to calculate sin(x) and cos(x) and determine the forward differentiation.
2. Do the same but use central difference.
3. Plot all derivatives, and compare with the analytical derivative.
4. The half-life t1/2 of 60Co is 5.271 years. Write a program which calculates the activity as a function of time and amount of material. Design your program in such a way, that you could also input different radioactive materials.
5. Write a program which will calculate the first and secon derivative for any function you give.

2. Relevant equations

Here is the link for the problem.
its chapter 4 and 5.
http://ww2.odu.edu/~agodunov/book/solutions.html

3. The attempt at a solution

well, This has not been discussed to us yet. but our professor is out of the country so he asked us to do these programs which I have no idea how to do. Can someone please help me? We're using fortran.

Last edited: Oct 29, 2012