Курсовая работа: Interpolation, approximation and differential equations solvers
Название: Interpolation, approximation and differential equations solvers Раздел: Топики по английскому языку Тип: курсовая работа | |||||||||||||||||||||||||||||||||||||||||||||||
catchwordProblem 1 1.1 Problem definition 1.2 Solution of the problem 1.2.1 Linear interpolation 1.2.2 Method of least squares interpolation 1.2.3 Lagrange interpolating polynomial 1.2.4 Cubic spline interpolation 1.3 Results and discussion 1.3.1 Lagrange polynomial Problem 2 2.1 Problem definition 2.2 Problem solution 2.2.1 Rectangular method 2.2.2 Trapezoidal rule 2.2.3 Simpson's rule 2.2.4 Gauss-Legendre method and Gauss-Chebyshev method Problem 3 3.1 Problem definition 3.2 Problem solution Problem 4 4.1 Problem definition 4.2 Problem solution References Problem 11.1 Problem definitionFor the following data set, please discuss the possibility of obtaining a reasonable interpolated value at 1.2 Solution of the problemInterpolation is a method of constructing new data points within the range of a discrete set of known data points. In engineering and science one often has a number of data points, as obtained by sampling or experimentation, and tries to construct a function which closely fits those data points. This is called curve fitting or regression analysis. Interpolation is a specific case of curve fitting, in which the function must go exactly through the data points. First we have to plot data points, such plot provides better picture for analysis than data arrays Following four interpolation methods will be discussed in order to solve the problem: · Linear interpolation · Method of least squares interpolation · Lagrange interpolating polynomial Fig 1. Initial data points · Cubic spline interpolation 1.2.1 Linear interpolationOne of the simplest methods is linear interpolation (sometimes known as lerp). Generally, linear interpolation tales two data points, say
Linear interpolation is quick and easy, but it is not very precise/ Another disadvantage is that the interpolant is not differentiable at the point 1.2.2 Method of least squares interpolationThe method of least squares is an alternative to interpolation for fitting a function to a set of points. Unlike interpolation, it does not require the fitted function to intersect each point. The method of least squares is probably best known for its use in statistical regression, but it is used in many contexts unrelated to statistics. Fig 2. Plot of the data with linear interpolation superimposed Generally, if we have However, polynomial interpolation also has some disadvantages. Calculating the interpolating polynomial is computationaly expensive compared to linear interpolation. Furthermore, polynomial interpolation may not be so exact after all, especially at the end points. These disadvantages can be avoided by using spline interpolation. Example of construction of polynomial by least square method Data is given by the table: Polynomial is given by the model: In order to find the optimal parameters
Then: The error function: It is necessary to find parameters It should be noted that the matrix For the given data points matrix Fig 3. Plot of the data with polynomial interpolation superimposed Because the polynomial is forced to intercept every point, it weaves up and down. 1.2.3 Lagrange interpolating polynomialThe Lagrange interpolating polynomial is the polynomial
Where Written explicitly When constructing interpolating polynomials, there is a tradeoff between having a better fit and having a smooth well-behaved fitting function. The more data points that are used in the interpolation, the higher the degree of the resulting polynomial, and therefore the greater oscillation it will exhibit between the data points. Therefore, a high-degree interpolation may be a poor predictor of the function between points, although the accuracy at the data points will be "perfect." Fig 4. Plot of the data with Lagrange interpolating polynomial interpolation superimposed One can see, that Lagrange polynomial has a lot of oscillations due to the high order if polynomial. 1.2.4 Cubic spline interpolation Remember that linear interpolation uses a linear function for each of intervals Like polynomial interpolation, spline interpolation incurs a smaller error than linear interpolation and the interpolant is smoother. However, the interpolant is easier to evaluate than the high-degree polynomials used in polynomial interpolation. It also does not suffer from Runge's phenomenon. Fig 5. Plot of the data with Lagrange interpolating polynomial interpolation superimposed It should be noted that cubic spline curve looks like metal ruler fixed in the nodal points, one can see that such interpolation method could not be used for modeling sudden data points jumps. 1.3 Results and discussionThe following results were obtained by employing described interpolation methods for the points
Table 1. Results of interpolation by different methods in the given points. In order to determine the best interpolation method for the current case should be constructed the table of deviation between interpolation results and root mean square, if number of interpolations methods increases then value of RMS become closer to the true value.
Table 2. Table of Average deviation between average deviation and interpolation results. One can see that cubic spline interpolation gives the best results among discussed methods, but it should be noted that sometimes cubic spline gives wrong interpolation, especially near the sudden function change. Also good interpolation results are provided by Linear interpolation method, but actually this method gives average values on each segment between values on it boundaries. Problem 22.1 Problem definitionFor the above mentioned data set, if you are asked to give the integration of 2.2 Problem solutionIn numerical analysis, numerical integration constitutes a broad family of algorithms for calculating the numerical value of a definite integral. There are several reasons for carrying out numerical integration. The integrand A formula for the integrand may be known, but it may be difficult or impossible to find an antiderivative which is an elementary function. An example of such an integrand is It may be possible to find an antiderivative symbolically, but it may be easier to compute a numerical approximation than to compute the antiderivative. That may be the case if the antiderivative is given as an infinite series or product, or if its evaluation requires a special function which is not available. The following methods were described in this semester: · Rectangular method · Trapezoidal rule · Simpson's rule · Gauss-Legendre method · Gauss-Chebyshev method 2.2.1 Rectangular methodThe most straightforward way to approximate the area under a curve is to divide up the interval along the x-axis between The approximate area under the curve is then simply the sum of the areas of all the rectangles formed by our subintervals: The summary approximation error for Thus it is impossible to calculate maximum of the derivative function, we can estimate integration error like value: 2.2.2 Trapezoidal ruleTrapezoidal rule is a way to approximately calculate the definite integral. The trapezium rule works by approximating the region under the graph of the function To calculate this integral more accurately, one first splits the interval of integration The summary approximation error for 2.2.3 Simpson's ruleSimpson's rule is a method for numerical integration, the numerical approximation of definite integrals. Specifically, it is the following approximation: If the interval of integration However, it is often the case that the function we are trying to integrate is not smooth over the interval. Typically, this means that either the function is highly oscillatory, or it lacks derivatives at certain points. In these cases, Simpson's rule may give very poor results. One common way of handling this problem is by breaking up the interval Suppose that the interval The error committed by the composite Simpson's rule is bounded (in absolute value) by 2.2.4 Gauss-Legendre method and Gauss-Chebyshev methodSince function values are given in fixed points then just two points Gauss-Legendre method can be applied. If The Gauss-Legendre rule
where It should be noted that even in case of two points method we have to calculate values of the function in related to Mechanism of Gauss-Chebyshev method is almost the same like described above, and integration error will be almost the same, so there is no reason to use such methods for the current problem. Problem 33.1 Problem definitionIt is well known that the third order Runge-Kutta method is of the following form
Suppose that you are asked to derived a new third order Runge-Kutta method in the following from
Find determine the unknowns 3.2 Problem solutionGenerally Runge-Kutta method looks like:
where coefficients The error function: Coefficients For
Thus we have system of equations: Some of coefficients are already predefined:
Obtained results show that Runge-Kutta scheme for every order is unique. Problem 44.1 Problem definitionDiscuss the stability problem of solving the ordinary equation 4.2 Problem solutionThe Euler method is 1st order accurate. Given scheme could be rewritten in form of: If For the case Last result shows that integration step mast be less or equal to For the case As step References1. J. C. Butcher, Numerical methods for ordinary differential equations, ISBN 0471967580 2. George E. Forsythe, Michael A. Malcolm, and Cleve B. Moler. Computer Methods for Mathematical Computations. Englewood Cliffs, NJ: Prentice-Hall, 1977. (See Chapter 6.) 3. Ernst Hairer, Syvert Paul Nørsett, and Gerhard Wanner. Solving ordinary differential equations I: Nonstiff problems, second edition. Berlin: Springer Verlag, 1993. ISBN 3-540-56670-8. 4. William H. Press, Brian P. Flannery, Saul A. Teukolsky, William T. Vetterling. Numerical Recipes in C. Cambridge, UK: Cambridge University Press, 1988. (See Sections 16.1 and 16.2.) 5. Kendall E. Atkinson. An Introduction to Numerical Analysis. John Wiley & Sons - 1989 6. F. Cellier, E. Kofman. Continuous System Simulation. Springer Verlag, 2006. ISBN 0-387-26102-8. 7. Gaussian Quadrature Rule of Integration - Notes, PPT, Matlab, Mathematica, Maple, Mathcad at Holistic Numerical Methods Institute 8. Burden, Richard L.; J. Douglas Faires (2000). Numerical Analysis (7th Ed. ed.). Brooks/Cole. ISBN 0-534-38216-9. |