Unit 6: Numerical Methods
Interpolation
Interpolation is a technique used to estimate unknown values by utilizing known data points. This is particularly useful in various fields, including engineering, computer graphics, and data analysis. Two common forms of interpolation are Newtonβs Interpolation and Lagrangeβs Interpolation.
1. Finite Differences
Finite differences are used to approximate derivatives and can be instrumental in interpolation. The main idea is to replace derivatives with differences in function values. There are three primary types of finite differences:
-
Forward Difference: This measures the change in the function values at subsequent points.
-
Backward Difference: This measures the change in function values at preceding points.
-
Central Difference: This averages the forward and backward differences, providing a better approximation for the derivative.
These differences are the foundation of various interpolation formulas.
2. Newtonβs Interpolation Formula
Newtonβs interpolation uses the concept of divided differences to construct a polynomial that passes through a set of known points. The formula is expressed as:
Where is the interpolating polynomial, are known data points, and represents the nth divided difference at point .
Example:
Given points , we can use Newton's interpolation formula to find the polynomial that fits these points.
- Calculate the divided differences.
- Construct the polynomial using the formula.
3. Lagrangeβs Interpolation Formula
Lagrangeβs interpolation provides another way to construct a polynomial through known data points. The formula is given by:
where
Here, are the Lagrange basis polynomials that ensure passes through all the given points.
Example:
For the points , the Lagrange polynomial can be constructed similarly to Newton's method, using the above formula to find the basis polynomials and summing them up.
Numerical Differentiation
Numerical differentiation is the process of estimating the derivative of a function based on discrete data points. It is particularly useful when dealing with experimental or observational data.
1. Forward Difference Method
The forward difference method estimates the derivative at a point using values from that point and subsequent points:
2. Backward Difference Method
The backward difference method estimates the derivative using previous points:
3. Central Difference Method
The central difference method provides a more accurate estimate by averaging the forward and backward differences:
Example:
Given values , , and :
- Forward Difference:
- Backward Difference:
- Central Difference:
Numerical Integration
Numerical integration is essential for estimating the value of definite integrals when analytical solutions are challenging to obtain. Two commonly used methods are the Trapezoidal Rule and Simpsonβs Rule.
1. Trapezoidal Rule
The Trapezoidal Rule approximates the area under a curve by dividing it into trapezoids. The formula for numerical integration using the trapezoidal rule is:
where .
Example:
For from to :
- Calculate and :
- Apply the Trapezoidal Rule:
2. Simpsonβs Rule
Simpsonβs Rule is a more accurate method that uses parabolic segments to approximate the area under the curve. The formula is:
where .
Example:
For from to :
- Calculate , , and :
- Apply Simpsonβs Rule:
3. Bound of Truncation Error
The truncation error in numerical integration measures how much the approximation differs from the exact value. For the Trapezoidal Rule, the truncation error can be expressed as:
For Simpsonβs Rule, the error is given by:
Where is the number of subintervals, and denotes the k-th derivative of .
Solution of Ordinary Differential Equations
Ordinary differential equations (ODEs) describe the relationship between functions and their derivatives. Numerical methods are often employed to find approximate solutions when analytical solutions are not feasible.
1. Eulerβs Method
Eulerβs method is the simplest numerical technique for solving first-order ODEs. It uses the formula:
Where is the step size, is the current value, and is the function defining the differential equation.
Example:
Given with initial condition and :
- Repeat for subsequent steps.
2. Modified Eulerβs Method
The Modified Eulerβs Method (also known as the Heunβs Method) improves upon the basic Euler method by averaging the slopes. The formula is:
- Predict:
- Correct:
3. Runge-Kutta 4th Order Method
The Runge-Kutta 4th Order Method is a more sophisticated approach that provides greater
accuracy. The formula is:
Where:
This method provides a more accurate solution over a larger range of values compared to previous methods.