Starting from:

$30

CS6210-Assignment 1 Solved

The specific aim of the assignment is to compute polynomial interpolants for the function exp(x) on

[0,2] using evenly spaced and Chebyshev points and with interpolants constructed using the Vandermonde equations, the polyinterp.m routine, the barycentric interpolation routine barylag.m and finally the matlab cubic spline routine pchip and the spline toolbox routines shown in the lectures. This process will enable you to understand which method is the  most robust and accurate and how this accuracy varies with the choice of points and also what the cost of the methods is. The Second part of the assignment applies the same methods to a data set taken from weather modeling.  

Instructions 

1.    Write  a simple programs to plot the exponential function on the interval [0,2] using 1001 evenly spaced points.  

 

2.    Modify your program to use the Vandermonde matrix to calculate an interpolating polynomial to exp(x) on [0,2] with 6,11,21,41,81,161,321 and 641 points and to evaluate the accuracy at 1001 sample points using the infinity and 2 norms.  Use both evenly spaced points and Chebyshev spaced points x(i) on [-1,1] mapped to [0,2] as given by x(i) = 1 –cos(π(i-1)/(n-1)) for i = 1,…,n. Comment on and describe how the accuracy changes with the choice and number of points.  


3.    Extend the program to use the  Matlab  routines  polyinterp  and barylag that use Lagrange  polynomial interpolation . Again comment on how the accuracy varies with the different choice of 6,11,21,41,81,161,321 and 641 points, both Chebyshev and evenly spaced. Note that not all the codes work well fro all choices of points  


4.    Further  extend your program to use the  Matlab cubic spline routine PCHIP with both even and Chebyshev points.  Again use both sets of points and comment on the outcome. Is the choice of points so critical for the spline routine as it was for the Lagrange polynomials?
 




5.    Using the matlab timing functions tic and toc,  time the 4 different methods with the required points and plot them. How do these timing results compare to each other? Did you see what you expected?  On a different graph plot the infinity error norms for the different point sets.  Note in order to show and explain your results you may have to exclude certain data points when one or more methods  blows up. This may happen with polynomials on a large evenly spaced mesh for reasons we have discussed in class.


6.    Extend your code to the weather model data sets supplied. In this case you have to read in the dynamics points and values from the data file   zd      and the associated values from the data file  ud    .  There is no known solution for this data set but one measure of accuracy is to evaluate the  interpolant at the physics points provided in the data set file  zp .  A new interpolant is then created at the physics data points using the same interpolation method. This new interpolant is then evaluated back at the original points and a measure of both interpolation errors is provided by the difference between these values and the original values. Also use plots to demonstrate whether of not there are overshoots or undershoots in the first interpolant.  

7.    Provide a summary that explains which method provides the fastest answer and is the most accurate and robust for both methods,

 

For these assignments, we expect both SOURCE CODE(s)  and a written REPORT be uploaded as a zip or tarball file to Canvas.

•       Source code for all programs that you write, thoroughly documented. o Include a README file describing how to compile and run your code.

•       Your report should be in PDF format and should stand on its own.

o       It should describe the methods used, explain your results and contain figures.

o       It should also answer any questions asked above. o It should cite any sources used for information, including source code and collaborators.

This homework is due on September 14th  11:59 pm. If you don't understand these directions, please send questions to me or ask in class  well in advance of the due date.

More products