SlideShare a Scribd company logo
1 of 47
Chapter 5
Numerical Differentiation and
Integration
5.1. Numerical Differentiation
οƒ˜Differentiation gives a measure of the rate at which a quantity changes.
οƒ˜One of the well-known fundamental of these rates is the relationship between
position, velocity and acceleration. If the position, x of an object that is moving
along a straight line is known as a function of time, t,
𝑋 = 𝑓(𝑑)
𝑉 =
𝑑𝑋
𝑑𝑑
=
𝑑𝑓(𝑑)
𝑑𝑑
π‘Ž =
𝑑𝑉
𝑑𝑑
=
𝑑2𝑓(𝑑)
𝑑𝑑
οƒ˜Many models in engineering and physics are expressed in terms of rated.
οƒ˜ In electrical
οƒ˜ In analysing conduction of heat
οƒ˜Differentiation is also used for finding maximum and minimum values of functions.
The Need for Numerical Differentiation
οƒ˜The function to be differentiated can be gives as
οƒ˜Analytical Expression or
οƒ˜A set of discrete-points (tabulated data)
οƒ˜ When the function is given as a simple mathematical expression, the derivative can be
determined analytically.
οƒ˜ When analytical differentiation of the expression is difficult (or not possible), or the
function is specified as a set of discrete points, differentiation is done using a numerical
method.
Approaches to Numerical Differentiation
οƒ˜ Numerical differentiation is carries out on data that are specified as a set of discrete
points.
οƒ˜ Two approaches can be used to calculate a numerical approximation of the derivative at
one of the points.
1. To use a finite difference approximation of the derivative
2. To Approximate the points with an analytical expression that can be easily differentiated,
and then to calculate the derivative by differentiation the analytical expression.
1. To use a finite difference approximation of the derivative
1. To Approximate the points with an analytical expression that can be easily
differentiated, and then to calculate the derivative by differentiation the analytical
expression. The approximate analytical expression can be derived by using curve
fitting.
2.
Finite Difference Approximation of the Derivative
οƒ˜ The derivative 𝑓′(π‘₯) of a function 𝑓(π‘₯) at the point π‘₯ = π‘Ž is
defined as:
𝑑𝑓(π‘₯)
𝑑π‘₯ π‘₯=π‘Ž
= 𝑓′ π‘Ž = lim
π‘₯β†’π‘Ž
𝑓 π‘₯ βˆ’ 𝑓(π‘Ž)
π‘₯ βˆ’ π‘Ž
οƒ˜The derivative is the value of the slope of tangent line to the
function at π‘₯ = π‘Ž.
οƒ˜The derivative is obtained by taking a point π‘₯ near x = π‘Ž and
calculating the slope of the line that connects the two points.
οƒ˜The accuracy of calculating the derivative in this way increases
as point x is closer to point a.
οƒ˜In the limit as point x approaches point a, the derivative is the
slope of the line that is tangent to f(x) at x = a.
Finite Difference Approximation of the Derivative
οƒ˜ In finite difference approximations of the derivative, values of the function at different points in
the neighbourhood of the point x = a are used for estimating the slope.
οƒ˜ It should be remembered that the function that is being differentiated is prescribed by a set of
discrete points (tabulated data).
οƒ˜ Various finite difference approximation formulas exist. Three such formulas, where the derivative
is calculated from the values of two points, are presented.
οƒ˜ Forward Difference
οƒ˜ Backward Difference
οƒ˜ Central Difference
οƒ˜Forward Difference is the slope of the line that connects points
(π‘₯𝑖, 𝑓 π‘₯𝑖 and (π‘₯𝑖+1, 𝑓 π‘₯𝑖+1
𝑑𝑓
𝑑π‘₯ π‘₯=π‘₯𝑖
=
𝑓 π‘₯𝑖+1 βˆ’π‘“(π‘₯𝑖)
π‘₯𝑖+1βˆ’π‘₯𝑖
οƒ˜Backward Difference is the slope of the line that connects
points (π‘₯π‘–βˆ’1, 𝑓 π‘₯π‘–βˆ’1 and (π‘₯𝑖, 𝑓 π‘₯𝑖
𝑑𝑓
𝑑π‘₯ π‘₯=π‘₯𝑖
=
𝑓 π‘₯𝑖 βˆ’π‘“(π‘₯π‘–βˆ’1)
π‘₯π‘–βˆ’π‘₯π‘–βˆ’1
οƒ˜Central Difference is the slope of the line that connects points
(π‘₯π‘–βˆ’1, 𝑓 π‘₯π‘–βˆ’1 and (π‘₯𝑖+1, 𝑓 π‘₯𝑖+1
𝑑𝑓
𝑑π‘₯ π‘₯=π‘₯𝑖
=
𝑓 π‘₯𝑖+1 βˆ’π‘“(π‘₯π‘–βˆ’1)
π‘₯𝑖+1βˆ’π‘₯π‘–βˆ’1
Finite Difference Formulas Using Taylor Series
Expansion
οƒ˜The forward, backward and central difference formulas, as well
as many other finite difference formulas for approximating
derivatives can be derived by using Taylor Series Expansion.
οƒ˜The Formulas give estimate of the derivative at a point from
the values of points in its neighbourhood.
οƒ˜The number of points used in the calculation varies with the
formula and the points can be ahead, behind, or on both sides of
the point at which the derivative is calculated.
οƒ˜It also provides estimate for the truncation error in the
approximation.
Finite Difference Formulas of First Derivative
Taylor series of a function at point x
𝑓 π‘₯ = 𝑓 π‘₯0 +
1
1!
𝑓′ π‘₯0 π‘₯ βˆ’ π‘₯0 +
1
2!
𝑓′′ π‘₯0 π‘₯ βˆ’ π‘₯0
2 + β‹―
Can be written as
𝑓 π‘₯ = 𝑓 π‘₯0 +
1
1!
𝑓′
π‘₯0 β„Ž +
1
2!
𝑓′′
π‘₯0 β„Ž2
+ β‹― +
1
𝑛!
𝑓(𝑛)
π‘₯0 β„Žπ‘›
Where h = π‘₯ βˆ’ π‘₯0 ,𝑓(𝑛) π‘₯0 =
𝑑𝑓(𝑛)
𝑑π‘₯(𝑛)
Taylor Approximation or Polynomial
𝑓 π‘₯ = 𝑓 π‘₯0 +
1
1!
𝑓′ π‘₯0 β„Ž +
1
2!
𝑓′′ π‘₯0 β„Ž2 + β‹― +
1
𝑛!
𝑓 𝑛 π‘₯0 β„Ž2 + 𝑅𝑛+1
Where the remainder, 𝑅𝑛+1 is given by
𝑅𝑛+1
=
1
(𝑛 + 1)!
𝑓 𝑛+1
ΞΆ β„Ž(𝑛+1)
Where ΞΆ lies between π‘₯ π‘Žπ‘›π‘‘ π‘₯0 and the approximation is obtained by
truncating the remainder part.
Finite Difference Formulas of First Derivative
Based on Taylor series Expansion
Two point Forward difference for first derivative at point π‘₯𝑖+1 can be approximated.
𝑓 π‘₯𝑖+1 = 𝑓 π‘₯𝑖 +
1
1!
𝑓′
π‘₯𝑖 β„Ž +
1
2!
𝑓′′
π‘₯𝑖 β„Ž2
+
1
3!
𝑓′′′
π‘₯𝑖 β„Ž3
+
1
4!
𝑓4
π‘₯𝑖 β„Ž4
+ β‹―
Where β„Ž = π‘₯𝑖+1 βˆ’ π‘₯𝑖 is the spacing between the points.
By using two term Taylor series expansion with remainder
𝑓 π‘₯𝑖+1 = 𝑓 π‘₯𝑖 + 𝑓′
π‘₯𝑖 β„Ž +
1
2!
𝑓′′
ΞΆ β„Ž2
Solving this for 𝑓′ π‘₯𝑖 yields
𝑓′
π‘₯𝑖 =
𝑓 π‘₯𝑖+1 βˆ’ 𝑓 π‘₯𝑖
β„Ž
βˆ’
𝑓′′
ΞΆ
2!
β„Ž
Where π‘‘π‘Ÿπ‘’π‘›π‘π‘Žπ‘‘π‘–π‘œπ‘› π‘’π‘Ÿπ‘Ÿπ‘œπ‘Ÿ = βˆ’
𝑓′′ ΞΆ
2!
β„Ž = 𝑂(β„Ž)
Note that the magnitude of truncation error is not really known, but the equation
implies that smaller h gives a smaller error.
𝒇′ π’™π’Š =
𝒇 π’™π’Š+𝟏 βˆ’ 𝒇 π’™π’Š
𝒉
+ 𝑢(𝒉)
Finite Difference Formulas of First Derivative
Based on Taylor series Expansion
Two point Backward difference for first derivative at point π‘₯𝑖+1 can be
approximated.
𝑓 π‘₯π‘–βˆ’1 = 𝑓 π‘₯𝑖 βˆ’
1
1!
𝑓′
π‘₯𝑖 β„Ž +
1
2!
𝑓′′
π‘₯𝑖 β„Ž2
βˆ’
1
3!
𝑓′′′
π‘₯𝑖 β„Ž3
+
1
4!
𝑓4
π‘₯𝑖 β„Ž4
+ β‹―
Where β„Ž = π‘₯𝑖 βˆ’ π‘₯π‘–βˆ’1 is the spacing between the points.
By using two term Taylor series expansion with remainder
𝑓 π‘₯π‘–βˆ’1 = 𝑓 π‘₯𝑖 βˆ’ 𝑓′
π‘₯𝑖 β„Ž +
1
2!
𝑓′′
ΞΆ β„Ž2
Solving this for 𝑓′ π‘₯𝑖 yields
𝑓′ π‘₯𝑖 =
𝑓 π‘₯𝑖 βˆ’ 𝑓 π‘₯π‘–βˆ’1
β„Ž
+
𝑓′′ ΞΆ
2!
β„Ž
An approximate value of the derivative, can be calculated if the second term on the
right hand side is ignored.
𝒇′
π’™π’Š =
𝒇 π’™π’Š βˆ’ 𝒇 π’™π’Šβˆ’πŸ
𝒉
+ 𝑢(𝒉)
Finite Difference Formulas of First Derivative
Based on Taylor series Expansion
Central Difference for first derivative at point π‘₯𝑖+1 can be approximated by
subtracting the backward difference from forward difference Taylor series
approximation with three terms and remainder.
𝑓 π‘₯𝑖+1 = 𝑓 π‘₯𝑖 + 𝑓′
π‘₯𝑖 β„Ž +
1
2!
𝑓′′
π‘₯𝑖 β„Ž2
+
1
3!
𝑓′′′
ΞΆ 1β„Ž3
βˆ’βˆ’ βˆ’πΉ
𝑓 π‘₯π‘–βˆ’1 = 𝑓 π‘₯𝑖 βˆ’ 𝑓′
π‘₯𝑖 β„Ž +
1
2!
𝑓′′
π‘₯𝑖 β„Ž2
βˆ’
1
3!
𝑓′′′
ΞΆ 2β„Ž3
βˆ’βˆ’ βˆ’π΅
Which gives
𝑓 π‘₯𝑖+1 βˆ’ 𝑓 π‘₯π‘–βˆ’1 = 2𝑓′
π‘₯𝑖 β„Ž +
1
3!
𝑓′′′
ΞΆ 1β„Ž3
+
1
3!
𝑓′′′
ΞΆ 2β„Ž3
Solving this for 𝑓′
π‘₯𝑖 and ignoring the remainder which is of order β„Ž2
, yields
𝒇′ π’™π’Š =
𝒇 π’™π’Š+𝟏 βˆ’ 𝒇 π’™π’Šβˆ’πŸ
πŸπ’‰
+ 𝑢(π’‰πŸ)
Finite Difference Formulas of First Derivative
A comparison of the three differences show that in both forward and
backward difference approximation, truncation error is of order h,
while in the central difference, it is of order π’‰πŸ
. This shows that the
central difference approximation gives a more accurate approximation
of the derivative.
𝑓′
π‘₯𝑖 =
𝑓 π‘₯𝑖+1 βˆ’ 𝑓 π‘₯𝑖
β„Ž
+ 𝑂(β„Ž)
𝑓′
π‘₯𝑖 =
𝑓 π‘₯𝑖 βˆ’ 𝑓 π‘₯π‘–βˆ’1
β„Ž
+ 𝑂(β„Ž)
𝑓′ π‘₯𝑖 =
𝑓 π‘₯𝑖+1 βˆ’ 𝑓 π‘₯π‘–βˆ’1
2β„Ž
+ 𝑂(β„Ž2)
Three Point Forward & Backward Finite Difference Formulas of First Derivative
οƒ˜Forward difference evaluates the derivative at point π‘₯𝑖 based on π‘₯𝑖+1 οƒ  is useful for
π’™πŸ and all interior point. (can not be used for π‘₯𝑛)
οƒ˜Backward difference evaluates the derivative at point π‘₯𝑖 based on π‘₯π‘–βˆ’1οƒ is useful for 𝒙𝒏
and all interior point. (can not be used for π‘₯1)
οƒ˜Central difference evaluates the derivative at point π‘₯𝑖 based on π‘₯𝑖+1 π‘Žπ‘›π‘‘ π‘₯π‘–βˆ’1οƒ is useful
only for interior points and not for end points ( π’™πŸπ’π’“ 𝒙𝒏).
οƒ˜An estimate for the first derivative at the endpoints, with error of O(h2), can be calculated
with three-point forward and backward difference formulas, which are derived next.
Three Point Forward Difference
οƒ˜The three-point forward difference formula calculates the derivative at point π‘₯𝑖 from the
value at that point and the next two points, π’™π’Š+𝟏 and π’™π’Š+𝟐 .
οƒ˜Using three terms of Taylor series expansion with remainder
𝑓 π‘₯𝑖+1 = 𝑓 π‘₯𝑖 + 𝑓′ π‘₯𝑖 β„Ž +
𝟏
𝟐!
𝒇′′ π’™π’Š π’‰πŸ +
1
3!
𝑓′′′ ΞΆ 1β„Ž3 βˆ’βˆ’ βˆ’π‘’π‘ž1
𝑓 π‘₯𝑖+2 = 𝑓 π‘₯𝑖 + 𝑓′
π‘₯𝑖 2β„Ž +
𝟏
𝟐!
𝒇′′
π’™π’Š (πŸπ’‰)𝟐
+
1
3!
𝑓′′′
ΞΆ 1(2β„Ž)3
βˆ’βˆ’ βˆ’π‘’π‘ž2
And the above two equations are combined such that the terms with second derivative
vanish so that the error would be minimum.
οƒ˜ Multiply π‘’π‘ž1 by 4 and subtract π‘’π‘ž2οƒ  4 π’†π’’πŸ - π’†π’’πŸ
4𝑓 π‘₯𝑖+1 βˆ’ 𝑓 π‘₯𝑖+2 = 3𝑓 π‘₯𝑖 + 2𝑓′
π‘₯𝑖 β„Ž +
4
3!
𝑓′′′
ΞΆ 1β„Ž3
βˆ’
1
3!
𝑓′′′
ΞΆ 1(2β„Ž)3
Solving for 𝑓′ π‘₯𝑖
𝒇′ π’™π’Š =
βˆ’πŸ‘π’‡ π’™π’Š + πŸ’π’‡ π’™π’Š+𝟏 βˆ’ 𝒇 π’™π’Š+𝟐
πŸπ’‰
+ 𝑢(π’‰πŸ)
Similarly it can be derived for the Three Point Backward Difference (try it)
𝒇′ π’™π’Š =
𝒇 π’™π’Šβˆ’πŸ βˆ’ πŸ’π’‡ π’™π’Šβˆ’πŸ + πŸ‘π’‡ π’™π’Š +
πŸπ’‰
+ 𝑢(π’‰πŸ)
Order of
truncation
error
With less error we
can calculate
derivatives at end
points
Finite Difference for the Second Derivative
οƒ˜Same approach can used to develop finite difference formulas for higher-
order derivatives.
Central Difference
οƒ˜ Using four terms of Taylor series expansion with remainder (O(h))
𝑓 π‘₯𝑖+1 = 𝑓 π‘₯𝑖 + 𝑓′ π‘₯𝑖 β„Ž +
1
2!
𝑓′′ π‘₯𝑖 β„Ž2 +
1
3!
𝑓′′′ π‘₯𝑖 β„Ž3 +
1
4!
𝑓′′′′ ΞΆ 1β„Ž4
𝑓 π‘₯π‘–βˆ’1 = 𝑓 π‘₯𝑖 βˆ’
1
1!
𝑓′ π‘₯𝑖 β„Ž +
1
2!
𝑓′′ π‘₯𝑖 β„Ž2 βˆ’
1
3!
𝑓′′′ π‘₯𝑖 β„Ž3 +
1
4!
𝑓′′′′ ΞΆ 2β„Ž4
οƒ˜Eliminate the first derivatives by adding both equations together.
𝑓 π‘₯𝑖+1 + 𝑓 π‘₯π‘–βˆ’1 = 2𝑓 π‘₯𝑖 +
2
2!
𝑓′′
π‘₯𝑖 β„Ž2
+
1
4!
𝑓′′′′
ΞΆ 1β„Ž4
+ +
1
4!
𝑓′′′′
ΞΆ 2β„Ž4
Solving for 𝒇′′ π’™π’Š while neglecting the remainder part
𝑓′′ π‘₯𝑖 =
𝑓 π‘₯π‘–βˆ’1 βˆ’ 2𝑓 π‘₯𝑖 + 𝑓 π‘₯𝑖+1
β„Ž2
+ 𝑂(β„Ž2)
Finite Difference for the Second Derivative
Three point Forward difference
Using three terms of Taylor series expansion with remainder
𝑓 π‘₯𝑖+1 = 𝑓 π‘₯𝑖 + 𝒇′ π’™π’Š 𝒉 +
1
2!
𝑓′′ π‘₯𝑖 β„Ž2 +
1
3!
𝑓′′′ ΞΆ 1β„Ž3 βˆ’βˆ’ βˆ’π‘’π‘ž1
𝑓 π‘₯𝑖+2 = 𝑓 π‘₯𝑖 + 𝒇′ π’™π’Š πŸπ’‰ +
1
2!
𝑓′′ π‘₯𝑖 (2β„Ž)2+
1
3!
𝑓′′′ ΞΆ 1(2β„Ž)3 βˆ’βˆ’ βˆ’π‘’π‘ž2
In order to cancel out the first derivative οƒ  2 π’†π’’πŸ βˆ’ π’†π’’πŸ
Then solving for 𝑓′′
π‘₯𝑖 yields
𝑓′′ π‘₯𝑖 =
𝑓 π‘₯𝑖 βˆ’ 2𝑓 π‘₯𝑖+1 + 𝑓 π‘₯𝑖+2
β„Ž2
+ 𝑂(β„Ž)
Not
interested
in 𝒇′
π’™π’Š
Finite Difference for the Second Derivative
Three point Backward difference
Using three terms of Taylor series expansion with remainder
𝑓 π‘₯π‘–βˆ’1 = 𝑓 π‘₯𝑖 βˆ’ 𝒇′ π’™π’Š 𝒉 +
1
2!
𝑓′′ π‘₯𝑖 β„Ž2 βˆ’
1
3!
𝑓′′′ ΞΆ 1β„Ž3 βˆ’βˆ’ βˆ’π‘’π‘ž1
𝑓 π‘₯π‘–βˆ’2 = 𝑓 π‘₯𝑖 βˆ’ 𝒇′ π’™π’Š πŸπ’‰ +
1
2!
𝑓′′ π‘₯𝑖 2β„Ž 2 βˆ’
1
3!
𝑓′′′ ΞΆ 2(2β„Ž)3 βˆ’βˆ’ βˆ’π‘’π‘ž2
In order to cancel out the first derivative οƒ  2 π’†π’’πŸ βˆ’ π’†π’’πŸ
Then solving for 𝑓′′
π‘₯𝑖 yields
𝒇′′ π’™π’Š =
𝒇 π’™π’Šβˆ’πŸ βˆ’ πŸπ’‡ π’™π’Šβˆ’πŸ + 𝒇 π’™π’Š
π’‰πŸ
+ 𝑢(𝒉)
Not
interested
in 𝒇′
π’™π’Š
Example
Calculate the first derivative of a function 𝑓 π‘₯ = π‘₯3, π‘Žπ‘‘ π‘₯ = 3
using both two point and three point forward difference
method.
Where the points are
a) π‘₯ = 3 , π‘₯ = 4 π‘Žπ‘›π‘‘ π‘₯ = 5
b) π‘₯ = 3, π‘₯ = 3.25 π‘Žπ‘›π‘‘ π‘₯ = 3.5
Compare the result with the exact value.
Example
Example
Numerical Integration
οƒ˜ Integration is frequently encountered when solving
problems and calculating quantities in engineering and
science.
οƒ˜ One of the simplest examples for the application of
integration is the calculation of the length of a curve.
When a curve in the x-y plane is given by the equation y
= f(x), the length L of the curve between the points x = a
and x = b is given by:
The general form of a definite integral (also called an antiderivative) is:
where f(x), called the integrand, is a function of the
independent variable x, and a and b are the limits
of the integration. The value of the
integral I(f) is a number when a and b are numbers
𝐼 𝑓 =
π‘Ž
𝑏
𝑓 π‘₯ 𝑑π‘₯ βˆ’βˆ’βˆ’ βˆ’(βˆ—)
The Need For Numerical Integration
The integrand could be
οƒ˜ Analytical Expression
οƒ˜ A set of discrete points ( tabulated data)
Numerical integration is needed
οƒ˜ when analytical integration is difficult or not possible, and
οƒ˜ when the integrand is given as a set of discrete points.
Overview of Numerical Integration
οƒ˜ The Numerical evaluation of a single integral deals with estimating the number I(f) that is the integral of a
function f(x) over an interval from a to b.
οƒ˜ If the integrand is an analytical function, the numerical integration is done using a finite number of points
at which the integrand is evaluated.
οƒ˜ One strategy is to use only the end points of the interval (a,f(a)) and (b,f(b)).
οƒ˜ This may not give accurate result specially if the interval is wide and/or the integrand varies significantly within
the interval.
οƒ˜ Higher accuracy can be achieved using a composite method where [a,b] is divided in to smaller
subintervals.
The integral of each subinterval is calculated, and the results are added together to give the value of
the whole integral.
οƒ˜In all cases the numerical integration is done using a set of discrete points for the
integrand.
οƒ˜When the integrand is an analytical function, the location of the points within the
interval [a,b] can be defined by user or defined by the integration method.
οƒ˜When the integrand is a given set of tabulated points, the location of the points is fixed
and cannot be changed.
Overview of Numerical Integration
οƒ˜ Several methods are developed for carrying out numerical integration.
οƒ˜ In each of this methods, a formula is derived for calculating an approximate value of the integral from
discrete values of the integrand.
οƒ˜ This methods can be divided in to groups called
οƒ˜ Open methods
οƒ˜ Closed methods
Closed Methods
οƒ˜ In closed methods, the end points of the interval are used in the formula that estimated the value of the
integral.
Example: trapezoidal and Simpson’s Method
Open Methods
οƒ˜ In open Methods, the interval of integration extends beyond the range od the endpoints that are actually
used for calculating the values of the integral
Example: Midpoint and Gauss Quadrature Method
Newton-Cotes Integration Formulas
οƒ˜ In numerical Integration methods that use Newton-Cotes integration formulas, the value of the integrand
between the discrete points is estimated using a function that can be easily integrated.
οƒ˜ The value of the integral is then obtained by integration.
οƒ˜ When the original integrand is an analytical function, the Newton-Cotes formula replaces is with a simpler
function.
οƒ˜ When the original integrand is a set of data points, the Newton-Cotes formula interpolates the integrand
between the given points.
οƒ˜ A different option for integration, once the integrand f(x) is specified as a discrete points, is to use curve-fit
the points with a function F(x) that best fits the points.
οƒ˜ F(x) is a polynomial or simple function whose antiderivative can be found easily, and the integral is
evaluated using direct analysis.
Rectangle and Midpoint Methods
Rectangle Method
οƒ˜ Simplest of all approximations is to take f(x) over the interval x = [a,b]
f(x) οƒ  as a constant equal to the value of f(x) at either end of the points
𝐼 𝑓 =
π‘Ž
𝑏
𝑓 π‘₯ 𝑑π‘₯ = 𝑓 π‘Ž 𝑏 βˆ’ π‘Ž π‘œπ‘ŸπΌ 𝑓 =
π‘Ž
𝑏
𝑓 π‘₯ 𝑑π‘₯ = 𝑓 𝑏 𝑏 βˆ’ π‘Ž
Rectangle and Midpoint Methods
Rectangle Method
οƒ˜ Simplest of all approximations is to take f(x) over the interval x = [a,b]
𝐼 𝑓 =
π‘Ž
𝑏
𝑓 π‘₯ 𝑑π‘₯ = 𝑓 π‘Ž 𝑏 βˆ’ π‘Ž π‘œπ‘ŸπΌ 𝑓 =
π‘Ž
𝑏
𝑓 π‘₯ 𝑑π‘₯ = 𝑓 𝑏 𝑏 βˆ’ π‘Ž
When the integrand is assumed to be
οƒ˜ 𝑓 π‘Ž the integral is underestimated
οƒ˜ 𝑓 𝑏 the integral is overestimated
Rectangle and Midpoint Methods
Composite Rectangle Method
οƒ˜ The domain [a,b] is divided in to N intervals.
οƒ˜ The integral in each subinterval is calculated with the rectangle method , and the value
of the whole integral is obtained by adding the values of the integral in the subintervals.
οƒ˜ The points include π‘₯1, π‘₯1, π‘₯3, … π‘₯𝑁+1 π‘€β„Žπ‘’π‘Ÿπ‘’ π‘₯1 = a and π‘₯𝑁+1 = b
Rectangle and Midpoint Methods
Composite Rectangle Method
𝐼 𝑓 =
π‘Ž
𝑏
𝑓 π‘₯ 𝑑π‘₯ = 𝑓 π‘₯1 π‘₯2 βˆ’ π‘₯1 + 𝑓 π‘₯2 π‘₯3 βˆ’ π‘₯2 +. . . +𝑓 π‘₯𝑖 π‘₯𝑖+1 βˆ’ π‘₯𝑖 +. . . +𝑓 π‘₯𝑁 π‘₯𝑁+1 βˆ’ π‘₯𝑁
𝐼 𝑓 =
π‘Ž
𝑏
𝑓 π‘₯ 𝑑π‘₯ =
𝑖=1
𝑁
𝑓 π‘₯𝑖 π‘₯𝑖+1 βˆ’ π‘₯𝑖 𝑑π‘₯
οƒ˜ When the subinterval has the same width, h
𝐼 𝑓 =
π‘Ž
𝑏
𝑓 π‘₯ 𝑑π‘₯ = β„Ž
𝑖=1
𝑁
𝑓 π‘₯𝑖 𝑑π‘₯
Rectangle and Midpoint Methods
Midpoint Method
οƒ˜ AN improvement over naΓ―ve rectangle metho
οƒ˜ The value of the integrand at the middle of the interval, that if f(
π‘Ž+𝑏
2
) is used.
𝐼 𝑓 =
π‘Ž
𝑏
𝑓 π‘₯ 𝑑π‘₯ =
π‘Ž
𝑏
𝑓
π‘Ž + 𝑏
2
𝑑π‘₯ = 𝑓
π‘Ž + 𝑏
2
𝑏 βˆ’ π‘Ž
οƒ˜ The value of the integral is still approximated as the area of a
rectangle, but with an important difference.
οƒ˜ The are is that of an equivalent rectangle.
οƒ˜ It is more accurate approximation than the rectangle method
οƒ˜ For a monotonic function as shown in the figure the regions of the
area under the curve that are ignored may be approximately offset
by those regions above the curve that are included but not always
true.
οƒ˜ The accuracy can be increased by using composite method.
Rectangle and Midpoint Methods
Composite Midpoint Method
οƒ˜ The domain [a,b] is divided in to N intervals.
οƒ˜ The integral in each subinterval is calculated with the midpoint method , and the value
of the whole integral is obtained by adding the values of the integral in the subintervals.
οƒ˜ The points include π‘₯1, π‘₯1, π‘₯3, … π‘₯𝑁+1 π‘€β„Žπ‘’π‘Ÿπ‘’ π‘₯1 = a and π‘₯𝑁+1 = b
Rectangle and Midpoint Methods
Composite Rectangle Method
𝐼 𝑓 =
π‘Ž
𝑏
𝑓 π‘₯ 𝑑π‘₯
= 𝑓
π‘₯1 + π‘₯2
2
π‘₯2 βˆ’ π‘₯1 + 𝑓
π‘₯2 + π‘₯3
2
π‘₯3 βˆ’ π‘₯2 +. . . +𝑓
π‘₯𝑖 + π‘₯𝑖+1
2
π‘₯𝑖+1 βˆ’ π‘₯𝑖 +. . . +𝑓
π‘₯𝑁 + π‘₯𝑁+1
2
π‘₯𝑁+1 βˆ’ π‘₯𝑁
𝐼 𝑓 =
π‘Ž
𝑏
𝑓 π‘₯ 𝑑π‘₯ =
𝑖=1
𝑁
𝑓
π‘₯𝑖 + π‘₯𝑖+1
2
π‘₯𝑖+1 βˆ’ π‘₯𝑖 𝑑π‘₯
οƒ˜ When the subinterval has the same width, h
𝐼 𝑓 =
π‘Ž
𝑏
𝑓 π‘₯ 𝑑π‘₯ = β„Ž
𝑖=1
𝑁
𝑓
π‘₯𝑖 + π‘₯𝑖+1
2
𝑑π‘₯
Trapezoidal Method
οƒ˜ Refinement of both Rectangle and midpoint method
οƒ˜ A linear function is used to approximate the integrand over the interval of integration.
οƒ˜ Newton’s form of interpolating polynomials with two points π‘₯ = π‘Ž π‘Žπ‘›π‘‘ π‘₯ = 𝑏 ,yields
𝑓 π‘₯ = 𝑓 π‘Ž + π‘₯ βˆ’ π‘Ž
𝑓 𝑏 βˆ’ 𝑓 π‘Ž
𝑏 βˆ’ π‘Ž
βˆ’βˆ’βˆ’βˆ’ βˆ’ βˆ—βˆ—
οƒ˜ Substituting equation (**) in to equation (*)
𝐼 𝑓 =
π‘Ž
𝑏
𝑓 π‘₯ 𝑑π‘₯ =
π‘Ž
𝑏
π‘₯ βˆ’ π‘Ž
𝑓 𝑏 βˆ’ 𝑓 π‘Ž
𝑏 βˆ’ π‘Ž
𝑑π‘₯
= 𝑓 π‘Ž (𝑏 βˆ’ π‘Ž) +
1
2
[𝑓 𝑏 βˆ’ 𝑓 π‘Ž ](𝑏 βˆ’ π‘Ž)
Simplifying the result gives an approximate formula known as trapezoidal rule or method
𝑰 𝒇 =
𝒇 𝒂 + 𝒇 𝒃
𝟐
(𝒃 βˆ’ 𝒂)
Trapezoidal Method
οƒ˜ Examining the result before simplification
οƒ˜ The first term
𝑓 π‘Ž 𝑏 βˆ’ π‘Ž , π‘Ÿπ‘’π‘π‘Ÿπ‘’π‘ π‘’π‘›π‘‘π‘  π‘‘β„Žπ‘’ π‘Žπ‘Ÿπ‘’π‘Ž π‘œπ‘“ π‘Ž π‘Ÿπ‘’π‘π‘‘π‘Žπ‘›π‘”π‘™π‘’ π‘œπ‘“ β„Žπ‘’π‘–π‘”β„Žπ‘‘ 𝑓 π‘Ž π‘Žπ‘›π‘‘ π‘™π‘’π‘›π‘”π‘‘β„Ž (𝑏 βˆ’ π‘Ž)
οƒ˜ The second term
1
2
𝑓 𝑏 βˆ’ 𝑓 π‘Ž 𝑏 βˆ’ π‘Ž , 𝑖𝑠 π‘‘β„Žπ‘’ π‘Žπ‘Ÿπ‘’π‘Ž π‘œπ‘“ π‘Ž π‘‘π‘Ÿπ‘–π‘Žπ‘›π‘”π‘™π‘’ π‘€β„Žπ‘œπ‘ π‘’ π‘π‘Žπ‘ π‘’ 𝑖𝑠 𝑏 βˆ’ π‘Ž π‘Žπ‘›π‘‘ π‘€β„Žπ‘œπ‘ π‘’ β„Žπ‘’π‘”β„Žπ‘‘ 𝑖𝑠𝑓 𝑏
βˆ’ 𝑓 π‘Ž
οƒ˜ This serve too reinforce a notion that in this method the area under curve f(x) is
approximated by the are of a trapezoid (rectangle + triangle).
οƒ˜ This is more accurate than using rectangle to approximate the
the shape of the region under f(x).
οƒ˜ Similar to other methods we have seen trapezoidal method accuracy
Can also be increased using composite method.
Composite Trapezoidal Method
οƒ˜ The domain [a,b] is divided in to N intervals.
οƒ˜ The integral in each subinterval is calculated with the Trapezoidal method , and the value of the
whole integral is obtained by adding the values of the integral in the subintervals.
οƒ˜ The points include π‘₯1, π‘₯1, π‘₯3, … π‘₯𝑁+1 π‘€β„Žπ‘’π‘Ÿπ‘’ π‘₯1 = a and π‘₯𝑁+1 = b
𝐼 𝑓 =
π‘Ž
𝑏
𝑓 π‘₯ 𝑑π‘₯ =
π‘₯1
π‘₯2
𝑓 π‘₯ 𝑑π‘₯ +
π‘₯2
π‘₯3
𝑓 π‘₯ 𝑑π‘₯ + β‹― +
π‘₯𝑖
π‘₯𝑖+1
𝑓 π‘₯ 𝑑π‘₯ + β‹― +
π‘₯𝑁
π‘₯𝑁+1
𝑓 π‘₯ 𝑑π‘₯
𝐼 𝑓 =
π‘Ž
𝑏
𝑓 π‘₯ 𝑑π‘₯ =
𝑖=1
𝑁
π‘₯𝑖
π‘₯𝑖+1
𝑓 π‘₯ 𝑑π‘₯
Applying the trapezoidal rule to each subinterval [π‘₯𝑖, π‘₯𝑖+1]
𝐼𝑖 𝑓 =
π‘₯𝑖
π‘₯𝑖+1
𝑓 π‘₯ 𝑑π‘₯ β‰ˆ
𝒇 π’™π’Š + 𝒇 π’™π’Š+𝟏
𝟐
π’™π’Š+𝟏 βˆ’ π’™π’Š
Composite Trapezoidal Method
οƒ˜ Substituting the trapezoidal approximation in the right side of this equation
𝐼 𝑓 = π‘Ž
𝑏
𝑓 π‘₯ 𝑑π‘₯ = 𝑖=1
𝑁
π‘₯𝑖
π‘₯𝑖+1
𝑓 π‘₯ 𝑑π‘₯, gives
𝐼 𝑓 =
π‘Ž
𝑏
𝑓 π‘₯ 𝑑π‘₯ =
𝑖=1
𝑁
[𝑓 π‘₯𝑖 + 𝑓(π‘₯𝑖+1)](π‘₯𝑖+1 βˆ’ π‘₯𝑖)
The subintervals need not be identical or equally spaced, how ever if they have the same width
𝐼 𝑓 =
π‘Ž
𝑏
𝑓 π‘₯ 𝑑π‘₯ =
β„Ž
2
𝑖=1
𝑁
[𝑓 π‘₯𝑖+1 + 𝑓 π‘₯𝑖 ]
This can be further reduced to
𝐼 𝑓 =
β„Ž
2
[𝑓 π‘Ž + 2𝑓 π‘₯2 + 2𝑓 π‘₯3 + β‹― + 2𝑓 π‘₯𝑁 + 𝑓 𝑏 ]
𝐼 𝑓 =
β„Ž
2
𝑓 π‘Ž + 𝑓 𝑏 + β„Ž
𝑖=2
𝑁
𝑓(π‘₯𝑖)
Simpson’s Method
οƒ˜ Unlike Trapezoidal method which uses straight line, the integrand is
approximated with nonlinear function that can be easily integrated.
οƒ˜ There are two classes
οƒ˜ The one that uses quadratic (Simpson’s 1/3 Method)
οƒ˜ The other which uses Cubic polynomial (Simpson’s 3/8 Method)
Simpson’s 1/3 Method
οƒ˜ In this method second order (quadratic) polynomial is used to approximate the
integrand.
οƒ˜ The coefficients of quadratic polynomial can be determined from three points.
οƒ˜ For an integral ovel the domain [a,b], the three points used are the two end
points x1=a and x3=b and the midpoint x2 = (a+b)/2 .
Simpson’s 1/3 Method
οƒ˜ The polynomial can be written in the form:
𝑝 π‘₯ = 𝛼 + 𝛽 π‘₯ βˆ’ π‘₯1 + 𝛾(π‘₯ βˆ’ π‘₯1)(π‘₯ βˆ’ π‘₯2)
Where the 𝛼 𝛽 and 𝛾 are unknown constants evaluated from the condition that the
polynomial passes through the points, p(π‘₯1) = f(π‘₯1), p(π‘₯2) = f(π‘₯2), and p(π‘₯3) = f(π‘₯3),.
οƒ˜ This conditions yield,
𝛼 = 𝑓 π‘₯1 , 𝛽 =
𝑓 π‘₯2 βˆ’ 𝑓 π‘₯1
π‘₯2 βˆ’ π‘₯1
, π‘Žπ‘›π‘‘ 𝛾 =
𝑓(π‘₯3) βˆ’ 2𝑓 π‘₯2 + 𝑓(π‘₯1)
2(β„Ž)2
οƒ˜ Where β„Ž = (𝑏 βˆ’ π‘Ž)/2
οƒ˜ Substituting back the constants and integrating p(x) over the interval [a,b]
𝐼 =
π‘₯1
π‘₯3
𝑓 π‘₯ 𝑑π‘₯ =
π‘₯1
π‘₯3
𝑝 π‘₯ 𝑑π‘₯ =
β„Ž
3
[𝑓 π‘₯1 + 4𝑓 π‘₯2 + 𝑓(π‘₯3)]
=
β„Ž
3
[𝑓 π‘Ž + 4𝑓
π‘Ž + 𝑏
2
+ 𝑓(𝑏)]
Simpson’s 1/3 Method
οƒ˜ The name 1/3 comes from the fact there is a factor 1/3 multiplying the expression in
brackets.
οƒ˜ As with the rectangular and trapezoidal a more accurate evaluation of integral can be done
with composite Simpson’s 1/3 Method/
Simpson’s 1/3 Composite Method
𝐼𝑖 =
π‘₯π‘–βˆ’1
π‘₯𝑖+1
𝑓 π‘₯ 𝑑π‘₯ =
β„Ž
3
𝑓 π‘₯π‘–βˆ’1 + 4𝑓 π‘₯𝑖 + 𝑓 π‘₯𝑖+1
Substituting the same width h = π‘₯𝑖+1 βˆ’ π‘₯𝑖 = π‘₯𝑖- π‘₯π‘–βˆ’1
𝐼 𝑓 =
π‘₯1
π‘₯𝑁+1
𝑓 π‘₯ 𝑑π‘₯ =
β„Ž
3
𝑓 π‘Ž + 4𝑓 π‘₯2 + 𝑓 π‘₯3 + 4𝑓 4 + β‹― + 𝑓 π‘₯π‘βˆ’1 + 4𝑓 π‘₯𝑁 + 𝑓 𝑏
This can be further reduced to
𝐼 𝑓 =
π‘₯1
π‘₯𝑁+1
𝑓 π‘₯ 𝑑π‘₯ =
β„Ž
3
𝑓 π‘Ž + 4
𝑖=2,4,6
𝑁
𝑓 π‘₯𝑖 + 2
𝑗=3,5,7
π‘βˆ’1
𝑓 π‘₯𝑗 + + 𝑓 𝑏 π‘€β„Žπ‘’π‘Ÿπ‘’ β„Ž =
(𝑏 βˆ’ π‘Ž)
𝑁
Simpson’s 1/3 formula can be used only when this two conditions are satisfied
οƒ˜ The Subintervals must be equally spaced
οƒ˜ The number of subinterval within [a,b] must be even number
Simpson’s 3/8 Method
οƒ˜ In this method third order (Cubic) polynomial is used to approximate the integrand.
οƒ˜ The coefficients of cubic polynomial can be determined from four points.
οƒ˜ For an integral ovel the domain [a,b], the three points used are the two end points x1=a and
x4=b and the two points x2 and x3 are the two points used to divide the interval [a,b] in to
three equal parts.
𝑝 π‘₯ = 𝐢3𝑋3 + 𝐢2𝑋2 + 𝐢1X+ 𝐢0
Where 𝐢3, 𝐢2 , 𝐢1 and 𝐢0 are constants evaluated from the conditions that the polynomial passes
through the points p(π‘₯1) = f(π‘₯1), p(π‘₯2) = f(π‘₯2), p(π‘₯3) = f(π‘₯3), and p(π‘₯4) = f(π‘₯4). Once the constants
are determined, the polynomial can be easily integrated to give.
𝐼 =
π‘Ž
𝑏
𝑓 π‘₯ 𝑑π‘₯ =
π‘Ž
𝑏
𝑝 π‘₯ 𝑑π‘₯ =
3β„Ž
8
[𝑓 π‘Ž + 3𝑓 π‘₯2 + 3𝑓 π‘₯3 + 𝑓(𝑏)]
The name came from the factor 3/8 multiplying the expression in the
bracket.
Note that the Simpson’s 3/8 method integral equation is the weighted
addition at the two endpoint.
As with other methods, the accuracy of this method is also increased
By using composite method.
Simpson’s 3/8 Composite Method
οƒ˜ The domain [a,b] is divided in to N intervals.
οƒ˜ Can be used for subinterval with that arbitrary width, but this derivation is done for those
subintervals with equal width , β„Ž = (π‘βˆ’π‘Ž)
𝑁 .
οƒ˜ The points include π‘₯1, π‘₯1, π‘₯3, … π‘₯𝑁+1 π‘€β„Žπ‘’π‘Ÿπ‘’ π‘₯1 = a and π‘₯𝑁+1 = b
οƒ˜ Since three points are needed the Simpson’s 3/8 method is applies to three adjacent
subintervals.
οƒ˜ The whole subinterval has to be divided in to a number of subintervals that is divisible by 3.
οƒ˜ The integral in each group of three subinterval is calculated with the Simpson’s 3/8 Method
and the value of the whole integral is obtained by adding the values of the integral in the
subinterval groups.
Simpson’s 3/8 Composite Method
Where the whole domain is divided by 12
𝐼 𝑓 =
3β„Ž
8
{𝑓 π‘Ž + 3[𝑓 π‘₯2 + 𝑓 π‘₯3 + +𝑓 π‘₯5 + 𝑓 π‘₯6 + +𝑓 π‘₯8 + 𝑓 π‘₯9 + 𝑓 π‘₯11 + +𝑓 π‘₯12 ] +
2[𝑓 4 + 𝑓 π‘₯7 + 𝑓 π‘₯10 + 𝑓 𝑏 ]
For the general case when the domain [a, b] is divided into N subintervals (where Nis at least 6 and
divisible by the above equation can be generalized to:
𝐼 𝑓 =
3β„Ž
8
[𝑓 π‘Ž + 3
𝑖=
π‘βˆ’1
[𝑓 π‘₯𝑖 + 𝑓 π‘₯𝑖+ 𝑓 π‘₯12 ] + 2
𝑖=
π‘βˆ’1
𝑓 π‘₯𝑖 + 𝑓 𝑏 ]
Simpson’s 3/8 method can be used if the following conditions are met:
οƒ˜ The subintervals are equally spaced
οƒ˜ The number of subintervals within [a,b] must be divisible by 3.

More Related Content

Similar to Numerical differentiation and integration

Calculus academic journal (sample)
Calculus academic journal (sample)Calculus academic journal (sample)
Calculus academic journal (sample)Vincentius Soesanto
Β 
numericai matmatic matlab uygulamalar ali abdullah
numericai matmatic  matlab  uygulamalar ali abdullahnumericai matmatic  matlab  uygulamalar ali abdullah
numericai matmatic matlab uygulamalar ali abdullahAli Abdullah
Β 
The derivatives module03
The derivatives module03The derivatives module03
The derivatives module03REYEMMANUELILUMBA
Β 
A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...
A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...
A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...mathsjournal
Β 
Slope of the Tangent Line.pptx
Slope of the Tangent Line.pptxSlope of the Tangent Line.pptx
Slope of the Tangent Line.pptxRoquiMabugayGonzaga
Β 
2. Fixed Point Iteration.pptx
2. Fixed Point Iteration.pptx2. Fixed Point Iteration.pptx
2. Fixed Point Iteration.pptxsaadhaq6
Β 
4 ESO Academics - UNIT 03 - POLYNOMIALS. ALGEBRAIC FRACTIONS
4 ESO Academics - UNIT 03 - POLYNOMIALS. ALGEBRAIC FRACTIONS4 ESO Academics - UNIT 03 - POLYNOMIALS. ALGEBRAIC FRACTIONS
4 ESO Academics - UNIT 03 - POLYNOMIALS. ALGEBRAIC FRACTIONSGogely The Great
Β 
CALIFORNIA STATE UNIVERSITY, NORTHRIDGEMECHANICAL ENGINEERIN.docx
CALIFORNIA STATE UNIVERSITY, NORTHRIDGEMECHANICAL ENGINEERIN.docxCALIFORNIA STATE UNIVERSITY, NORTHRIDGEMECHANICAL ENGINEERIN.docx
CALIFORNIA STATE UNIVERSITY, NORTHRIDGEMECHANICAL ENGINEERIN.docxRAHUL126667
Β 
Integrales definidas y ecuaciones diferenciales
Integrales definidas y ecuaciones diferencialesIntegrales definidas y ecuaciones diferenciales
Integrales definidas y ecuaciones diferencialescrysmari mujica
Β 
Exercise 1a transfer functions - solutions
Exercise 1a   transfer functions - solutionsExercise 1a   transfer functions - solutions
Exercise 1a transfer functions - solutionswondimu wolde
Β 
Matlab lab manual
Matlab lab manualMatlab lab manual
Matlab lab manualnmahi96
Β 
Basic%20Cal%20Final.docx.docx
Basic%20Cal%20Final.docx.docxBasic%20Cal%20Final.docx.docx
Basic%20Cal%20Final.docx.docxSalwaAbdulkarim1
Β 
Lesson 21: More Algebra
Lesson 21: More AlgebraLesson 21: More Algebra
Lesson 21: More AlgebraKevin Johnson
Β 
Math ia analysis
Math ia analysisMath ia analysis
Math ia analysis12903
Β 

Similar to Numerical differentiation and integration (20)

Calculus academic journal (sample)
Calculus academic journal (sample)Calculus academic journal (sample)
Calculus academic journal (sample)
Β 
numericai matmatic matlab uygulamalar ali abdullah
numericai matmatic  matlab  uygulamalar ali abdullahnumericai matmatic  matlab  uygulamalar ali abdullah
numericai matmatic matlab uygulamalar ali abdullah
Β 
The derivatives module03
The derivatives module03The derivatives module03
The derivatives module03
Β 
Euler Method
Euler MethodEuler Method
Euler Method
Β 
Chapter two
Chapter twoChapter two
Chapter two
Β 
Simple Linear Regression
Simple Linear RegressionSimple Linear Regression
Simple Linear Regression
Β 
A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...
A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...
A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...
Β 
Slope of the Tangent Line.pptx
Slope of the Tangent Line.pptxSlope of the Tangent Line.pptx
Slope of the Tangent Line.pptx
Β 
2. Fixed Point Iteration.pptx
2. Fixed Point Iteration.pptx2. Fixed Point Iteration.pptx
2. Fixed Point Iteration.pptx
Β 
4 ESO Academics - UNIT 03 - POLYNOMIALS. ALGEBRAIC FRACTIONS
4 ESO Academics - UNIT 03 - POLYNOMIALS. ALGEBRAIC FRACTIONS4 ESO Academics - UNIT 03 - POLYNOMIALS. ALGEBRAIC FRACTIONS
4 ESO Academics - UNIT 03 - POLYNOMIALS. ALGEBRAIC FRACTIONS
Β 
CALIFORNIA STATE UNIVERSITY, NORTHRIDGEMECHANICAL ENGINEERIN.docx
CALIFORNIA STATE UNIVERSITY, NORTHRIDGEMECHANICAL ENGINEERIN.docxCALIFORNIA STATE UNIVERSITY, NORTHRIDGEMECHANICAL ENGINEERIN.docx
CALIFORNIA STATE UNIVERSITY, NORTHRIDGEMECHANICAL ENGINEERIN.docx
Β 
Integral calculus
Integral calculusIntegral calculus
Integral calculus
Β 
Integrales definidas y ecuaciones diferenciales
Integrales definidas y ecuaciones diferencialesIntegrales definidas y ecuaciones diferenciales
Integrales definidas y ecuaciones diferenciales
Β 
Exercise 1a transfer functions - solutions
Exercise 1a   transfer functions - solutionsExercise 1a   transfer functions - solutions
Exercise 1a transfer functions - solutions
Β 
Matlab lab manual
Matlab lab manualMatlab lab manual
Matlab lab manual
Β 
Basic%20Cal%20Final.docx.docx
Basic%20Cal%20Final.docx.docxBasic%20Cal%20Final.docx.docx
Basic%20Cal%20Final.docx.docx
Β 
Lesson 21: More Algebra
Lesson 21: More AlgebraLesson 21: More Algebra
Lesson 21: More Algebra
Β 
Matlab lab.pdf
Matlab lab.pdfMatlab lab.pdf
Matlab lab.pdf
Β 
Math ia analysis
Math ia analysisMath ia analysis
Math ia analysis
Β 
Fourier series
Fourier series Fourier series
Fourier series
Β 

Recently uploaded

IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
Β 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
Β 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
Β 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
Β 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
Β 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
Β 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
Β 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
Β 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
Β 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
Β 
πŸ”9953056974πŸ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
πŸ”9953056974πŸ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...πŸ”9953056974πŸ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
πŸ”9953056974πŸ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...9953056974 Low Rate Call Girls In Saket, Delhi NCR
Β 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
Β 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
Β 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
Β 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
Β 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
Β 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
Β 

Recently uploaded (20)

IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
Β 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Β 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
Β 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
Β 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
Β 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
Β 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
Β 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
Β 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
Β 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
Β 
πŸ”9953056974πŸ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
πŸ”9953056974πŸ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...πŸ”9953056974πŸ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
πŸ”9953056974πŸ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
Β 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
Β 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
Β 
young call girls in Rajiv ChowkπŸ” 9953056974 πŸ” Delhi escort Service
young call girls in Rajiv ChowkπŸ” 9953056974 πŸ” Delhi escort Serviceyoung call girls in Rajiv ChowkπŸ” 9953056974 πŸ” Delhi escort Service
young call girls in Rajiv ChowkπŸ” 9953056974 πŸ” Delhi escort Service
Β 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
Β 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
Β 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Β 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
Β 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
Β 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
Β 

Numerical differentiation and integration

  • 2. 5.1. Numerical Differentiation οƒ˜Differentiation gives a measure of the rate at which a quantity changes. οƒ˜One of the well-known fundamental of these rates is the relationship between position, velocity and acceleration. If the position, x of an object that is moving along a straight line is known as a function of time, t, 𝑋 = 𝑓(𝑑) 𝑉 = 𝑑𝑋 𝑑𝑑 = 𝑑𝑓(𝑑) 𝑑𝑑 π‘Ž = 𝑑𝑉 𝑑𝑑 = 𝑑2𝑓(𝑑) 𝑑𝑑 οƒ˜Many models in engineering and physics are expressed in terms of rated. οƒ˜ In electrical οƒ˜ In analysing conduction of heat οƒ˜Differentiation is also used for finding maximum and minimum values of functions.
  • 3. The Need for Numerical Differentiation οƒ˜The function to be differentiated can be gives as οƒ˜Analytical Expression or οƒ˜A set of discrete-points (tabulated data) οƒ˜ When the function is given as a simple mathematical expression, the derivative can be determined analytically. οƒ˜ When analytical differentiation of the expression is difficult (or not possible), or the function is specified as a set of discrete points, differentiation is done using a numerical method. Approaches to Numerical Differentiation οƒ˜ Numerical differentiation is carries out on data that are specified as a set of discrete points. οƒ˜ Two approaches can be used to calculate a numerical approximation of the derivative at one of the points. 1. To use a finite difference approximation of the derivative 2. To Approximate the points with an analytical expression that can be easily differentiated, and then to calculate the derivative by differentiation the analytical expression.
  • 4. 1. To use a finite difference approximation of the derivative
  • 5. 1. To Approximate the points with an analytical expression that can be easily differentiated, and then to calculate the derivative by differentiation the analytical expression. The approximate analytical expression can be derived by using curve fitting. 2.
  • 6. Finite Difference Approximation of the Derivative οƒ˜ The derivative 𝑓′(π‘₯) of a function 𝑓(π‘₯) at the point π‘₯ = π‘Ž is defined as: 𝑑𝑓(π‘₯) 𝑑π‘₯ π‘₯=π‘Ž = 𝑓′ π‘Ž = lim π‘₯β†’π‘Ž 𝑓 π‘₯ βˆ’ 𝑓(π‘Ž) π‘₯ βˆ’ π‘Ž οƒ˜The derivative is the value of the slope of tangent line to the function at π‘₯ = π‘Ž. οƒ˜The derivative is obtained by taking a point π‘₯ near x = π‘Ž and calculating the slope of the line that connects the two points. οƒ˜The accuracy of calculating the derivative in this way increases as point x is closer to point a. οƒ˜In the limit as point x approaches point a, the derivative is the slope of the line that is tangent to f(x) at x = a.
  • 7. Finite Difference Approximation of the Derivative οƒ˜ In finite difference approximations of the derivative, values of the function at different points in the neighbourhood of the point x = a are used for estimating the slope. οƒ˜ It should be remembered that the function that is being differentiated is prescribed by a set of discrete points (tabulated data). οƒ˜ Various finite difference approximation formulas exist. Three such formulas, where the derivative is calculated from the values of two points, are presented. οƒ˜ Forward Difference οƒ˜ Backward Difference οƒ˜ Central Difference
  • 8. οƒ˜Forward Difference is the slope of the line that connects points (π‘₯𝑖, 𝑓 π‘₯𝑖 and (π‘₯𝑖+1, 𝑓 π‘₯𝑖+1 𝑑𝑓 𝑑π‘₯ π‘₯=π‘₯𝑖 = 𝑓 π‘₯𝑖+1 βˆ’π‘“(π‘₯𝑖) π‘₯𝑖+1βˆ’π‘₯𝑖
  • 9. οƒ˜Backward Difference is the slope of the line that connects points (π‘₯π‘–βˆ’1, 𝑓 π‘₯π‘–βˆ’1 and (π‘₯𝑖, 𝑓 π‘₯𝑖 𝑑𝑓 𝑑π‘₯ π‘₯=π‘₯𝑖 = 𝑓 π‘₯𝑖 βˆ’π‘“(π‘₯π‘–βˆ’1) π‘₯π‘–βˆ’π‘₯π‘–βˆ’1
  • 10. οƒ˜Central Difference is the slope of the line that connects points (π‘₯π‘–βˆ’1, 𝑓 π‘₯π‘–βˆ’1 and (π‘₯𝑖+1, 𝑓 π‘₯𝑖+1 𝑑𝑓 𝑑π‘₯ π‘₯=π‘₯𝑖 = 𝑓 π‘₯𝑖+1 βˆ’π‘“(π‘₯π‘–βˆ’1) π‘₯𝑖+1βˆ’π‘₯π‘–βˆ’1
  • 11. Finite Difference Formulas Using Taylor Series Expansion οƒ˜The forward, backward and central difference formulas, as well as many other finite difference formulas for approximating derivatives can be derived by using Taylor Series Expansion. οƒ˜The Formulas give estimate of the derivative at a point from the values of points in its neighbourhood. οƒ˜The number of points used in the calculation varies with the formula and the points can be ahead, behind, or on both sides of the point at which the derivative is calculated. οƒ˜It also provides estimate for the truncation error in the approximation.
  • 12. Finite Difference Formulas of First Derivative Taylor series of a function at point x 𝑓 π‘₯ = 𝑓 π‘₯0 + 1 1! 𝑓′ π‘₯0 π‘₯ βˆ’ π‘₯0 + 1 2! 𝑓′′ π‘₯0 π‘₯ βˆ’ π‘₯0 2 + β‹― Can be written as 𝑓 π‘₯ = 𝑓 π‘₯0 + 1 1! 𝑓′ π‘₯0 β„Ž + 1 2! 𝑓′′ π‘₯0 β„Ž2 + β‹― + 1 𝑛! 𝑓(𝑛) π‘₯0 β„Žπ‘› Where h = π‘₯ βˆ’ π‘₯0 ,𝑓(𝑛) π‘₯0 = 𝑑𝑓(𝑛) 𝑑π‘₯(𝑛) Taylor Approximation or Polynomial 𝑓 π‘₯ = 𝑓 π‘₯0 + 1 1! 𝑓′ π‘₯0 β„Ž + 1 2! 𝑓′′ π‘₯0 β„Ž2 + β‹― + 1 𝑛! 𝑓 𝑛 π‘₯0 β„Ž2 + 𝑅𝑛+1 Where the remainder, 𝑅𝑛+1 is given by 𝑅𝑛+1 = 1 (𝑛 + 1)! 𝑓 𝑛+1 ΞΆ β„Ž(𝑛+1) Where ΞΆ lies between π‘₯ π‘Žπ‘›π‘‘ π‘₯0 and the approximation is obtained by truncating the remainder part.
  • 13. Finite Difference Formulas of First Derivative Based on Taylor series Expansion Two point Forward difference for first derivative at point π‘₯𝑖+1 can be approximated. 𝑓 π‘₯𝑖+1 = 𝑓 π‘₯𝑖 + 1 1! 𝑓′ π‘₯𝑖 β„Ž + 1 2! 𝑓′′ π‘₯𝑖 β„Ž2 + 1 3! 𝑓′′′ π‘₯𝑖 β„Ž3 + 1 4! 𝑓4 π‘₯𝑖 β„Ž4 + β‹― Where β„Ž = π‘₯𝑖+1 βˆ’ π‘₯𝑖 is the spacing between the points. By using two term Taylor series expansion with remainder 𝑓 π‘₯𝑖+1 = 𝑓 π‘₯𝑖 + 𝑓′ π‘₯𝑖 β„Ž + 1 2! 𝑓′′ ΞΆ β„Ž2 Solving this for 𝑓′ π‘₯𝑖 yields 𝑓′ π‘₯𝑖 = 𝑓 π‘₯𝑖+1 βˆ’ 𝑓 π‘₯𝑖 β„Ž βˆ’ 𝑓′′ ΞΆ 2! β„Ž Where π‘‘π‘Ÿπ‘’π‘›π‘π‘Žπ‘‘π‘–π‘œπ‘› π‘’π‘Ÿπ‘Ÿπ‘œπ‘Ÿ = βˆ’ 𝑓′′ ΞΆ 2! β„Ž = 𝑂(β„Ž) Note that the magnitude of truncation error is not really known, but the equation implies that smaller h gives a smaller error. 𝒇′ π’™π’Š = 𝒇 π’™π’Š+𝟏 βˆ’ 𝒇 π’™π’Š 𝒉 + 𝑢(𝒉)
  • 14. Finite Difference Formulas of First Derivative Based on Taylor series Expansion Two point Backward difference for first derivative at point π‘₯𝑖+1 can be approximated. 𝑓 π‘₯π‘–βˆ’1 = 𝑓 π‘₯𝑖 βˆ’ 1 1! 𝑓′ π‘₯𝑖 β„Ž + 1 2! 𝑓′′ π‘₯𝑖 β„Ž2 βˆ’ 1 3! 𝑓′′′ π‘₯𝑖 β„Ž3 + 1 4! 𝑓4 π‘₯𝑖 β„Ž4 + β‹― Where β„Ž = π‘₯𝑖 βˆ’ π‘₯π‘–βˆ’1 is the spacing between the points. By using two term Taylor series expansion with remainder 𝑓 π‘₯π‘–βˆ’1 = 𝑓 π‘₯𝑖 βˆ’ 𝑓′ π‘₯𝑖 β„Ž + 1 2! 𝑓′′ ΞΆ β„Ž2 Solving this for 𝑓′ π‘₯𝑖 yields 𝑓′ π‘₯𝑖 = 𝑓 π‘₯𝑖 βˆ’ 𝑓 π‘₯π‘–βˆ’1 β„Ž + 𝑓′′ ΞΆ 2! β„Ž An approximate value of the derivative, can be calculated if the second term on the right hand side is ignored. 𝒇′ π’™π’Š = 𝒇 π’™π’Š βˆ’ 𝒇 π’™π’Šβˆ’πŸ 𝒉 + 𝑢(𝒉)
  • 15. Finite Difference Formulas of First Derivative Based on Taylor series Expansion Central Difference for first derivative at point π‘₯𝑖+1 can be approximated by subtracting the backward difference from forward difference Taylor series approximation with three terms and remainder. 𝑓 π‘₯𝑖+1 = 𝑓 π‘₯𝑖 + 𝑓′ π‘₯𝑖 β„Ž + 1 2! 𝑓′′ π‘₯𝑖 β„Ž2 + 1 3! 𝑓′′′ ΞΆ 1β„Ž3 βˆ’βˆ’ βˆ’πΉ 𝑓 π‘₯π‘–βˆ’1 = 𝑓 π‘₯𝑖 βˆ’ 𝑓′ π‘₯𝑖 β„Ž + 1 2! 𝑓′′ π‘₯𝑖 β„Ž2 βˆ’ 1 3! 𝑓′′′ ΞΆ 2β„Ž3 βˆ’βˆ’ βˆ’π΅ Which gives 𝑓 π‘₯𝑖+1 βˆ’ 𝑓 π‘₯π‘–βˆ’1 = 2𝑓′ π‘₯𝑖 β„Ž + 1 3! 𝑓′′′ ΞΆ 1β„Ž3 + 1 3! 𝑓′′′ ΞΆ 2β„Ž3 Solving this for 𝑓′ π‘₯𝑖 and ignoring the remainder which is of order β„Ž2 , yields 𝒇′ π’™π’Š = 𝒇 π’™π’Š+𝟏 βˆ’ 𝒇 π’™π’Šβˆ’πŸ πŸπ’‰ + 𝑢(π’‰πŸ)
  • 16. Finite Difference Formulas of First Derivative A comparison of the three differences show that in both forward and backward difference approximation, truncation error is of order h, while in the central difference, it is of order π’‰πŸ . This shows that the central difference approximation gives a more accurate approximation of the derivative. 𝑓′ π‘₯𝑖 = 𝑓 π‘₯𝑖+1 βˆ’ 𝑓 π‘₯𝑖 β„Ž + 𝑂(β„Ž) 𝑓′ π‘₯𝑖 = 𝑓 π‘₯𝑖 βˆ’ 𝑓 π‘₯π‘–βˆ’1 β„Ž + 𝑂(β„Ž) 𝑓′ π‘₯𝑖 = 𝑓 π‘₯𝑖+1 βˆ’ 𝑓 π‘₯π‘–βˆ’1 2β„Ž + 𝑂(β„Ž2)
  • 17. Three Point Forward & Backward Finite Difference Formulas of First Derivative οƒ˜Forward difference evaluates the derivative at point π‘₯𝑖 based on π‘₯𝑖+1 οƒ  is useful for π’™πŸ and all interior point. (can not be used for π‘₯𝑛) οƒ˜Backward difference evaluates the derivative at point π‘₯𝑖 based on π‘₯π‘–βˆ’1οƒ is useful for 𝒙𝒏 and all interior point. (can not be used for π‘₯1) οƒ˜Central difference evaluates the derivative at point π‘₯𝑖 based on π‘₯𝑖+1 π‘Žπ‘›π‘‘ π‘₯π‘–βˆ’1οƒ is useful only for interior points and not for end points ( π’™πŸπ’π’“ 𝒙𝒏). οƒ˜An estimate for the first derivative at the endpoints, with error of O(h2), can be calculated with three-point forward and backward difference formulas, which are derived next.
  • 18. Three Point Forward Difference οƒ˜The three-point forward difference formula calculates the derivative at point π‘₯𝑖 from the value at that point and the next two points, π’™π’Š+𝟏 and π’™π’Š+𝟐 . οƒ˜Using three terms of Taylor series expansion with remainder 𝑓 π‘₯𝑖+1 = 𝑓 π‘₯𝑖 + 𝑓′ π‘₯𝑖 β„Ž + 𝟏 𝟐! 𝒇′′ π’™π’Š π’‰πŸ + 1 3! 𝑓′′′ ΞΆ 1β„Ž3 βˆ’βˆ’ βˆ’π‘’π‘ž1 𝑓 π‘₯𝑖+2 = 𝑓 π‘₯𝑖 + 𝑓′ π‘₯𝑖 2β„Ž + 𝟏 𝟐! 𝒇′′ π’™π’Š (πŸπ’‰)𝟐 + 1 3! 𝑓′′′ ΞΆ 1(2β„Ž)3 βˆ’βˆ’ βˆ’π‘’π‘ž2 And the above two equations are combined such that the terms with second derivative vanish so that the error would be minimum. οƒ˜ Multiply π‘’π‘ž1 by 4 and subtract π‘’π‘ž2οƒ  4 π’†π’’πŸ - π’†π’’πŸ 4𝑓 π‘₯𝑖+1 βˆ’ 𝑓 π‘₯𝑖+2 = 3𝑓 π‘₯𝑖 + 2𝑓′ π‘₯𝑖 β„Ž + 4 3! 𝑓′′′ ΞΆ 1β„Ž3 βˆ’ 1 3! 𝑓′′′ ΞΆ 1(2β„Ž)3 Solving for 𝑓′ π‘₯𝑖 𝒇′ π’™π’Š = βˆ’πŸ‘π’‡ π’™π’Š + πŸ’π’‡ π’™π’Š+𝟏 βˆ’ 𝒇 π’™π’Š+𝟐 πŸπ’‰ + 𝑢(π’‰πŸ) Similarly it can be derived for the Three Point Backward Difference (try it) 𝒇′ π’™π’Š = 𝒇 π’™π’Šβˆ’πŸ βˆ’ πŸ’π’‡ π’™π’Šβˆ’πŸ + πŸ‘π’‡ π’™π’Š + πŸπ’‰ + 𝑢(π’‰πŸ) Order of truncation error With less error we can calculate derivatives at end points
  • 19. Finite Difference for the Second Derivative οƒ˜Same approach can used to develop finite difference formulas for higher- order derivatives. Central Difference οƒ˜ Using four terms of Taylor series expansion with remainder (O(h)) 𝑓 π‘₯𝑖+1 = 𝑓 π‘₯𝑖 + 𝑓′ π‘₯𝑖 β„Ž + 1 2! 𝑓′′ π‘₯𝑖 β„Ž2 + 1 3! 𝑓′′′ π‘₯𝑖 β„Ž3 + 1 4! 𝑓′′′′ ΞΆ 1β„Ž4 𝑓 π‘₯π‘–βˆ’1 = 𝑓 π‘₯𝑖 βˆ’ 1 1! 𝑓′ π‘₯𝑖 β„Ž + 1 2! 𝑓′′ π‘₯𝑖 β„Ž2 βˆ’ 1 3! 𝑓′′′ π‘₯𝑖 β„Ž3 + 1 4! 𝑓′′′′ ΞΆ 2β„Ž4 οƒ˜Eliminate the first derivatives by adding both equations together. 𝑓 π‘₯𝑖+1 + 𝑓 π‘₯π‘–βˆ’1 = 2𝑓 π‘₯𝑖 + 2 2! 𝑓′′ π‘₯𝑖 β„Ž2 + 1 4! 𝑓′′′′ ΞΆ 1β„Ž4 + + 1 4! 𝑓′′′′ ΞΆ 2β„Ž4 Solving for 𝒇′′ π’™π’Š while neglecting the remainder part 𝑓′′ π‘₯𝑖 = 𝑓 π‘₯π‘–βˆ’1 βˆ’ 2𝑓 π‘₯𝑖 + 𝑓 π‘₯𝑖+1 β„Ž2 + 𝑂(β„Ž2)
  • 20. Finite Difference for the Second Derivative Three point Forward difference Using three terms of Taylor series expansion with remainder 𝑓 π‘₯𝑖+1 = 𝑓 π‘₯𝑖 + 𝒇′ π’™π’Š 𝒉 + 1 2! 𝑓′′ π‘₯𝑖 β„Ž2 + 1 3! 𝑓′′′ ΞΆ 1β„Ž3 βˆ’βˆ’ βˆ’π‘’π‘ž1 𝑓 π‘₯𝑖+2 = 𝑓 π‘₯𝑖 + 𝒇′ π’™π’Š πŸπ’‰ + 1 2! 𝑓′′ π‘₯𝑖 (2β„Ž)2+ 1 3! 𝑓′′′ ΞΆ 1(2β„Ž)3 βˆ’βˆ’ βˆ’π‘’π‘ž2 In order to cancel out the first derivative οƒ  2 π’†π’’πŸ βˆ’ π’†π’’πŸ Then solving for 𝑓′′ π‘₯𝑖 yields 𝑓′′ π‘₯𝑖 = 𝑓 π‘₯𝑖 βˆ’ 2𝑓 π‘₯𝑖+1 + 𝑓 π‘₯𝑖+2 β„Ž2 + 𝑂(β„Ž) Not interested in 𝒇′ π’™π’Š
  • 21. Finite Difference for the Second Derivative Three point Backward difference Using three terms of Taylor series expansion with remainder 𝑓 π‘₯π‘–βˆ’1 = 𝑓 π‘₯𝑖 βˆ’ 𝒇′ π’™π’Š 𝒉 + 1 2! 𝑓′′ π‘₯𝑖 β„Ž2 βˆ’ 1 3! 𝑓′′′ ΞΆ 1β„Ž3 βˆ’βˆ’ βˆ’π‘’π‘ž1 𝑓 π‘₯π‘–βˆ’2 = 𝑓 π‘₯𝑖 βˆ’ 𝒇′ π’™π’Š πŸπ’‰ + 1 2! 𝑓′′ π‘₯𝑖 2β„Ž 2 βˆ’ 1 3! 𝑓′′′ ΞΆ 2(2β„Ž)3 βˆ’βˆ’ βˆ’π‘’π‘ž2 In order to cancel out the first derivative οƒ  2 π’†π’’πŸ βˆ’ π’†π’’πŸ Then solving for 𝑓′′ π‘₯𝑖 yields 𝒇′′ π’™π’Š = 𝒇 π’™π’Šβˆ’πŸ βˆ’ πŸπ’‡ π’™π’Šβˆ’πŸ + 𝒇 π’™π’Š π’‰πŸ + 𝑢(𝒉) Not interested in 𝒇′ π’™π’Š
  • 22. Example Calculate the first derivative of a function 𝑓 π‘₯ = π‘₯3, π‘Žπ‘‘ π‘₯ = 3 using both two point and three point forward difference method. Where the points are a) π‘₯ = 3 , π‘₯ = 4 π‘Žπ‘›π‘‘ π‘₯ = 5 b) π‘₯ = 3, π‘₯ = 3.25 π‘Žπ‘›π‘‘ π‘₯ = 3.5 Compare the result with the exact value.
  • 25. Numerical Integration οƒ˜ Integration is frequently encountered when solving problems and calculating quantities in engineering and science. οƒ˜ One of the simplest examples for the application of integration is the calculation of the length of a curve. When a curve in the x-y plane is given by the equation y = f(x), the length L of the curve between the points x = a and x = b is given by:
  • 26. The general form of a definite integral (also called an antiderivative) is: where f(x), called the integrand, is a function of the independent variable x, and a and b are the limits of the integration. The value of the integral I(f) is a number when a and b are numbers 𝐼 𝑓 = π‘Ž 𝑏 𝑓 π‘₯ 𝑑π‘₯ βˆ’βˆ’βˆ’ βˆ’(βˆ—)
  • 27. The Need For Numerical Integration The integrand could be οƒ˜ Analytical Expression οƒ˜ A set of discrete points ( tabulated data) Numerical integration is needed οƒ˜ when analytical integration is difficult or not possible, and οƒ˜ when the integrand is given as a set of discrete points.
  • 28. Overview of Numerical Integration οƒ˜ The Numerical evaluation of a single integral deals with estimating the number I(f) that is the integral of a function f(x) over an interval from a to b. οƒ˜ If the integrand is an analytical function, the numerical integration is done using a finite number of points at which the integrand is evaluated. οƒ˜ One strategy is to use only the end points of the interval (a,f(a)) and (b,f(b)). οƒ˜ This may not give accurate result specially if the interval is wide and/or the integrand varies significantly within the interval. οƒ˜ Higher accuracy can be achieved using a composite method where [a,b] is divided in to smaller subintervals. The integral of each subinterval is calculated, and the results are added together to give the value of the whole integral. οƒ˜In all cases the numerical integration is done using a set of discrete points for the integrand. οƒ˜When the integrand is an analytical function, the location of the points within the interval [a,b] can be defined by user or defined by the integration method. οƒ˜When the integrand is a given set of tabulated points, the location of the points is fixed and cannot be changed.
  • 29. Overview of Numerical Integration οƒ˜ Several methods are developed for carrying out numerical integration. οƒ˜ In each of this methods, a formula is derived for calculating an approximate value of the integral from discrete values of the integrand. οƒ˜ This methods can be divided in to groups called οƒ˜ Open methods οƒ˜ Closed methods Closed Methods οƒ˜ In closed methods, the end points of the interval are used in the formula that estimated the value of the integral. Example: trapezoidal and Simpson’s Method Open Methods οƒ˜ In open Methods, the interval of integration extends beyond the range od the endpoints that are actually used for calculating the values of the integral Example: Midpoint and Gauss Quadrature Method
  • 30. Newton-Cotes Integration Formulas οƒ˜ In numerical Integration methods that use Newton-Cotes integration formulas, the value of the integrand between the discrete points is estimated using a function that can be easily integrated. οƒ˜ The value of the integral is then obtained by integration. οƒ˜ When the original integrand is an analytical function, the Newton-Cotes formula replaces is with a simpler function. οƒ˜ When the original integrand is a set of data points, the Newton-Cotes formula interpolates the integrand between the given points. οƒ˜ A different option for integration, once the integrand f(x) is specified as a discrete points, is to use curve-fit the points with a function F(x) that best fits the points. οƒ˜ F(x) is a polynomial or simple function whose antiderivative can be found easily, and the integral is evaluated using direct analysis.
  • 31. Rectangle and Midpoint Methods Rectangle Method οƒ˜ Simplest of all approximations is to take f(x) over the interval x = [a,b] f(x) οƒ  as a constant equal to the value of f(x) at either end of the points 𝐼 𝑓 = π‘Ž 𝑏 𝑓 π‘₯ 𝑑π‘₯ = 𝑓 π‘Ž 𝑏 βˆ’ π‘Ž π‘œπ‘ŸπΌ 𝑓 = π‘Ž 𝑏 𝑓 π‘₯ 𝑑π‘₯ = 𝑓 𝑏 𝑏 βˆ’ π‘Ž
  • 32. Rectangle and Midpoint Methods Rectangle Method οƒ˜ Simplest of all approximations is to take f(x) over the interval x = [a,b] 𝐼 𝑓 = π‘Ž 𝑏 𝑓 π‘₯ 𝑑π‘₯ = 𝑓 π‘Ž 𝑏 βˆ’ π‘Ž π‘œπ‘ŸπΌ 𝑓 = π‘Ž 𝑏 𝑓 π‘₯ 𝑑π‘₯ = 𝑓 𝑏 𝑏 βˆ’ π‘Ž When the integrand is assumed to be οƒ˜ 𝑓 π‘Ž the integral is underestimated οƒ˜ 𝑓 𝑏 the integral is overestimated
  • 33. Rectangle and Midpoint Methods Composite Rectangle Method οƒ˜ The domain [a,b] is divided in to N intervals. οƒ˜ The integral in each subinterval is calculated with the rectangle method , and the value of the whole integral is obtained by adding the values of the integral in the subintervals. οƒ˜ The points include π‘₯1, π‘₯1, π‘₯3, … π‘₯𝑁+1 π‘€β„Žπ‘’π‘Ÿπ‘’ π‘₯1 = a and π‘₯𝑁+1 = b
  • 34. Rectangle and Midpoint Methods Composite Rectangle Method 𝐼 𝑓 = π‘Ž 𝑏 𝑓 π‘₯ 𝑑π‘₯ = 𝑓 π‘₯1 π‘₯2 βˆ’ π‘₯1 + 𝑓 π‘₯2 π‘₯3 βˆ’ π‘₯2 +. . . +𝑓 π‘₯𝑖 π‘₯𝑖+1 βˆ’ π‘₯𝑖 +. . . +𝑓 π‘₯𝑁 π‘₯𝑁+1 βˆ’ π‘₯𝑁 𝐼 𝑓 = π‘Ž 𝑏 𝑓 π‘₯ 𝑑π‘₯ = 𝑖=1 𝑁 𝑓 π‘₯𝑖 π‘₯𝑖+1 βˆ’ π‘₯𝑖 𝑑π‘₯ οƒ˜ When the subinterval has the same width, h 𝐼 𝑓 = π‘Ž 𝑏 𝑓 π‘₯ 𝑑π‘₯ = β„Ž 𝑖=1 𝑁 𝑓 π‘₯𝑖 𝑑π‘₯
  • 35. Rectangle and Midpoint Methods Midpoint Method οƒ˜ AN improvement over naΓ―ve rectangle metho οƒ˜ The value of the integrand at the middle of the interval, that if f( π‘Ž+𝑏 2 ) is used. 𝐼 𝑓 = π‘Ž 𝑏 𝑓 π‘₯ 𝑑π‘₯ = π‘Ž 𝑏 𝑓 π‘Ž + 𝑏 2 𝑑π‘₯ = 𝑓 π‘Ž + 𝑏 2 𝑏 βˆ’ π‘Ž οƒ˜ The value of the integral is still approximated as the area of a rectangle, but with an important difference. οƒ˜ The are is that of an equivalent rectangle. οƒ˜ It is more accurate approximation than the rectangle method οƒ˜ For a monotonic function as shown in the figure the regions of the area under the curve that are ignored may be approximately offset by those regions above the curve that are included but not always true. οƒ˜ The accuracy can be increased by using composite method.
  • 36. Rectangle and Midpoint Methods Composite Midpoint Method οƒ˜ The domain [a,b] is divided in to N intervals. οƒ˜ The integral in each subinterval is calculated with the midpoint method , and the value of the whole integral is obtained by adding the values of the integral in the subintervals. οƒ˜ The points include π‘₯1, π‘₯1, π‘₯3, … π‘₯𝑁+1 π‘€β„Žπ‘’π‘Ÿπ‘’ π‘₯1 = a and π‘₯𝑁+1 = b
  • 37. Rectangle and Midpoint Methods Composite Rectangle Method 𝐼 𝑓 = π‘Ž 𝑏 𝑓 π‘₯ 𝑑π‘₯ = 𝑓 π‘₯1 + π‘₯2 2 π‘₯2 βˆ’ π‘₯1 + 𝑓 π‘₯2 + π‘₯3 2 π‘₯3 βˆ’ π‘₯2 +. . . +𝑓 π‘₯𝑖 + π‘₯𝑖+1 2 π‘₯𝑖+1 βˆ’ π‘₯𝑖 +. . . +𝑓 π‘₯𝑁 + π‘₯𝑁+1 2 π‘₯𝑁+1 βˆ’ π‘₯𝑁 𝐼 𝑓 = π‘Ž 𝑏 𝑓 π‘₯ 𝑑π‘₯ = 𝑖=1 𝑁 𝑓 π‘₯𝑖 + π‘₯𝑖+1 2 π‘₯𝑖+1 βˆ’ π‘₯𝑖 𝑑π‘₯ οƒ˜ When the subinterval has the same width, h 𝐼 𝑓 = π‘Ž 𝑏 𝑓 π‘₯ 𝑑π‘₯ = β„Ž 𝑖=1 𝑁 𝑓 π‘₯𝑖 + π‘₯𝑖+1 2 𝑑π‘₯
  • 38. Trapezoidal Method οƒ˜ Refinement of both Rectangle and midpoint method οƒ˜ A linear function is used to approximate the integrand over the interval of integration. οƒ˜ Newton’s form of interpolating polynomials with two points π‘₯ = π‘Ž π‘Žπ‘›π‘‘ π‘₯ = 𝑏 ,yields 𝑓 π‘₯ = 𝑓 π‘Ž + π‘₯ βˆ’ π‘Ž 𝑓 𝑏 βˆ’ 𝑓 π‘Ž 𝑏 βˆ’ π‘Ž βˆ’βˆ’βˆ’βˆ’ βˆ’ βˆ—βˆ— οƒ˜ Substituting equation (**) in to equation (*) 𝐼 𝑓 = π‘Ž 𝑏 𝑓 π‘₯ 𝑑π‘₯ = π‘Ž 𝑏 π‘₯ βˆ’ π‘Ž 𝑓 𝑏 βˆ’ 𝑓 π‘Ž 𝑏 βˆ’ π‘Ž 𝑑π‘₯ = 𝑓 π‘Ž (𝑏 βˆ’ π‘Ž) + 1 2 [𝑓 𝑏 βˆ’ 𝑓 π‘Ž ](𝑏 βˆ’ π‘Ž) Simplifying the result gives an approximate formula known as trapezoidal rule or method 𝑰 𝒇 = 𝒇 𝒂 + 𝒇 𝒃 𝟐 (𝒃 βˆ’ 𝒂)
  • 39. Trapezoidal Method οƒ˜ Examining the result before simplification οƒ˜ The first term 𝑓 π‘Ž 𝑏 βˆ’ π‘Ž , π‘Ÿπ‘’π‘π‘Ÿπ‘’π‘ π‘’π‘›π‘‘π‘  π‘‘β„Žπ‘’ π‘Žπ‘Ÿπ‘’π‘Ž π‘œπ‘“ π‘Ž π‘Ÿπ‘’π‘π‘‘π‘Žπ‘›π‘”π‘™π‘’ π‘œπ‘“ β„Žπ‘’π‘–π‘”β„Žπ‘‘ 𝑓 π‘Ž π‘Žπ‘›π‘‘ π‘™π‘’π‘›π‘”π‘‘β„Ž (𝑏 βˆ’ π‘Ž) οƒ˜ The second term 1 2 𝑓 𝑏 βˆ’ 𝑓 π‘Ž 𝑏 βˆ’ π‘Ž , 𝑖𝑠 π‘‘β„Žπ‘’ π‘Žπ‘Ÿπ‘’π‘Ž π‘œπ‘“ π‘Ž π‘‘π‘Ÿπ‘–π‘Žπ‘›π‘”π‘™π‘’ π‘€β„Žπ‘œπ‘ π‘’ π‘π‘Žπ‘ π‘’ 𝑖𝑠 𝑏 βˆ’ π‘Ž π‘Žπ‘›π‘‘ π‘€β„Žπ‘œπ‘ π‘’ β„Žπ‘’π‘”β„Žπ‘‘ 𝑖𝑠𝑓 𝑏 βˆ’ 𝑓 π‘Ž οƒ˜ This serve too reinforce a notion that in this method the area under curve f(x) is approximated by the are of a trapezoid (rectangle + triangle). οƒ˜ This is more accurate than using rectangle to approximate the the shape of the region under f(x). οƒ˜ Similar to other methods we have seen trapezoidal method accuracy Can also be increased using composite method.
  • 40. Composite Trapezoidal Method οƒ˜ The domain [a,b] is divided in to N intervals. οƒ˜ The integral in each subinterval is calculated with the Trapezoidal method , and the value of the whole integral is obtained by adding the values of the integral in the subintervals. οƒ˜ The points include π‘₯1, π‘₯1, π‘₯3, … π‘₯𝑁+1 π‘€β„Žπ‘’π‘Ÿπ‘’ π‘₯1 = a and π‘₯𝑁+1 = b 𝐼 𝑓 = π‘Ž 𝑏 𝑓 π‘₯ 𝑑π‘₯ = π‘₯1 π‘₯2 𝑓 π‘₯ 𝑑π‘₯ + π‘₯2 π‘₯3 𝑓 π‘₯ 𝑑π‘₯ + β‹― + π‘₯𝑖 π‘₯𝑖+1 𝑓 π‘₯ 𝑑π‘₯ + β‹― + π‘₯𝑁 π‘₯𝑁+1 𝑓 π‘₯ 𝑑π‘₯ 𝐼 𝑓 = π‘Ž 𝑏 𝑓 π‘₯ 𝑑π‘₯ = 𝑖=1 𝑁 π‘₯𝑖 π‘₯𝑖+1 𝑓 π‘₯ 𝑑π‘₯ Applying the trapezoidal rule to each subinterval [π‘₯𝑖, π‘₯𝑖+1] 𝐼𝑖 𝑓 = π‘₯𝑖 π‘₯𝑖+1 𝑓 π‘₯ 𝑑π‘₯ β‰ˆ 𝒇 π’™π’Š + 𝒇 π’™π’Š+𝟏 𝟐 π’™π’Š+𝟏 βˆ’ π’™π’Š
  • 41. Composite Trapezoidal Method οƒ˜ Substituting the trapezoidal approximation in the right side of this equation 𝐼 𝑓 = π‘Ž 𝑏 𝑓 π‘₯ 𝑑π‘₯ = 𝑖=1 𝑁 π‘₯𝑖 π‘₯𝑖+1 𝑓 π‘₯ 𝑑π‘₯, gives 𝐼 𝑓 = π‘Ž 𝑏 𝑓 π‘₯ 𝑑π‘₯ = 𝑖=1 𝑁 [𝑓 π‘₯𝑖 + 𝑓(π‘₯𝑖+1)](π‘₯𝑖+1 βˆ’ π‘₯𝑖) The subintervals need not be identical or equally spaced, how ever if they have the same width 𝐼 𝑓 = π‘Ž 𝑏 𝑓 π‘₯ 𝑑π‘₯ = β„Ž 2 𝑖=1 𝑁 [𝑓 π‘₯𝑖+1 + 𝑓 π‘₯𝑖 ] This can be further reduced to 𝐼 𝑓 = β„Ž 2 [𝑓 π‘Ž + 2𝑓 π‘₯2 + 2𝑓 π‘₯3 + β‹― + 2𝑓 π‘₯𝑁 + 𝑓 𝑏 ] 𝐼 𝑓 = β„Ž 2 𝑓 π‘Ž + 𝑓 𝑏 + β„Ž 𝑖=2 𝑁 𝑓(π‘₯𝑖)
  • 42. Simpson’s Method οƒ˜ Unlike Trapezoidal method which uses straight line, the integrand is approximated with nonlinear function that can be easily integrated. οƒ˜ There are two classes οƒ˜ The one that uses quadratic (Simpson’s 1/3 Method) οƒ˜ The other which uses Cubic polynomial (Simpson’s 3/8 Method) Simpson’s 1/3 Method οƒ˜ In this method second order (quadratic) polynomial is used to approximate the integrand. οƒ˜ The coefficients of quadratic polynomial can be determined from three points. οƒ˜ For an integral ovel the domain [a,b], the three points used are the two end points x1=a and x3=b and the midpoint x2 = (a+b)/2 .
  • 43. Simpson’s 1/3 Method οƒ˜ The polynomial can be written in the form: 𝑝 π‘₯ = 𝛼 + 𝛽 π‘₯ βˆ’ π‘₯1 + 𝛾(π‘₯ βˆ’ π‘₯1)(π‘₯ βˆ’ π‘₯2) Where the 𝛼 𝛽 and 𝛾 are unknown constants evaluated from the condition that the polynomial passes through the points, p(π‘₯1) = f(π‘₯1), p(π‘₯2) = f(π‘₯2), and p(π‘₯3) = f(π‘₯3),. οƒ˜ This conditions yield, 𝛼 = 𝑓 π‘₯1 , 𝛽 = 𝑓 π‘₯2 βˆ’ 𝑓 π‘₯1 π‘₯2 βˆ’ π‘₯1 , π‘Žπ‘›π‘‘ 𝛾 = 𝑓(π‘₯3) βˆ’ 2𝑓 π‘₯2 + 𝑓(π‘₯1) 2(β„Ž)2 οƒ˜ Where β„Ž = (𝑏 βˆ’ π‘Ž)/2 οƒ˜ Substituting back the constants and integrating p(x) over the interval [a,b] 𝐼 = π‘₯1 π‘₯3 𝑓 π‘₯ 𝑑π‘₯ = π‘₯1 π‘₯3 𝑝 π‘₯ 𝑑π‘₯ = β„Ž 3 [𝑓 π‘₯1 + 4𝑓 π‘₯2 + 𝑓(π‘₯3)] = β„Ž 3 [𝑓 π‘Ž + 4𝑓 π‘Ž + 𝑏 2 + 𝑓(𝑏)]
  • 44. Simpson’s 1/3 Method οƒ˜ The name 1/3 comes from the fact there is a factor 1/3 multiplying the expression in brackets. οƒ˜ As with the rectangular and trapezoidal a more accurate evaluation of integral can be done with composite Simpson’s 1/3 Method/ Simpson’s 1/3 Composite Method 𝐼𝑖 = π‘₯π‘–βˆ’1 π‘₯𝑖+1 𝑓 π‘₯ 𝑑π‘₯ = β„Ž 3 𝑓 π‘₯π‘–βˆ’1 + 4𝑓 π‘₯𝑖 + 𝑓 π‘₯𝑖+1 Substituting the same width h = π‘₯𝑖+1 βˆ’ π‘₯𝑖 = π‘₯𝑖- π‘₯π‘–βˆ’1 𝐼 𝑓 = π‘₯1 π‘₯𝑁+1 𝑓 π‘₯ 𝑑π‘₯ = β„Ž 3 𝑓 π‘Ž + 4𝑓 π‘₯2 + 𝑓 π‘₯3 + 4𝑓 4 + β‹― + 𝑓 π‘₯π‘βˆ’1 + 4𝑓 π‘₯𝑁 + 𝑓 𝑏 This can be further reduced to 𝐼 𝑓 = π‘₯1 π‘₯𝑁+1 𝑓 π‘₯ 𝑑π‘₯ = β„Ž 3 𝑓 π‘Ž + 4 𝑖=2,4,6 𝑁 𝑓 π‘₯𝑖 + 2 𝑗=3,5,7 π‘βˆ’1 𝑓 π‘₯𝑗 + + 𝑓 𝑏 π‘€β„Žπ‘’π‘Ÿπ‘’ β„Ž = (𝑏 βˆ’ π‘Ž) 𝑁 Simpson’s 1/3 formula can be used only when this two conditions are satisfied οƒ˜ The Subintervals must be equally spaced οƒ˜ The number of subinterval within [a,b] must be even number
  • 45. Simpson’s 3/8 Method οƒ˜ In this method third order (Cubic) polynomial is used to approximate the integrand. οƒ˜ The coefficients of cubic polynomial can be determined from four points. οƒ˜ For an integral ovel the domain [a,b], the three points used are the two end points x1=a and x4=b and the two points x2 and x3 are the two points used to divide the interval [a,b] in to three equal parts. 𝑝 π‘₯ = 𝐢3𝑋3 + 𝐢2𝑋2 + 𝐢1X+ 𝐢0 Where 𝐢3, 𝐢2 , 𝐢1 and 𝐢0 are constants evaluated from the conditions that the polynomial passes through the points p(π‘₯1) = f(π‘₯1), p(π‘₯2) = f(π‘₯2), p(π‘₯3) = f(π‘₯3), and p(π‘₯4) = f(π‘₯4). Once the constants are determined, the polynomial can be easily integrated to give. 𝐼 = π‘Ž 𝑏 𝑓 π‘₯ 𝑑π‘₯ = π‘Ž 𝑏 𝑝 π‘₯ 𝑑π‘₯ = 3β„Ž 8 [𝑓 π‘Ž + 3𝑓 π‘₯2 + 3𝑓 π‘₯3 + 𝑓(𝑏)] The name came from the factor 3/8 multiplying the expression in the bracket. Note that the Simpson’s 3/8 method integral equation is the weighted addition at the two endpoint. As with other methods, the accuracy of this method is also increased By using composite method.
  • 46. Simpson’s 3/8 Composite Method οƒ˜ The domain [a,b] is divided in to N intervals. οƒ˜ Can be used for subinterval with that arbitrary width, but this derivation is done for those subintervals with equal width , β„Ž = (π‘βˆ’π‘Ž) 𝑁 . οƒ˜ The points include π‘₯1, π‘₯1, π‘₯3, … π‘₯𝑁+1 π‘€β„Žπ‘’π‘Ÿπ‘’ π‘₯1 = a and π‘₯𝑁+1 = b οƒ˜ Since three points are needed the Simpson’s 3/8 method is applies to three adjacent subintervals. οƒ˜ The whole subinterval has to be divided in to a number of subintervals that is divisible by 3. οƒ˜ The integral in each group of three subinterval is calculated with the Simpson’s 3/8 Method and the value of the whole integral is obtained by adding the values of the integral in the subinterval groups.
  • 47. Simpson’s 3/8 Composite Method Where the whole domain is divided by 12 𝐼 𝑓 = 3β„Ž 8 {𝑓 π‘Ž + 3[𝑓 π‘₯2 + 𝑓 π‘₯3 + +𝑓 π‘₯5 + 𝑓 π‘₯6 + +𝑓 π‘₯8 + 𝑓 π‘₯9 + 𝑓 π‘₯11 + +𝑓 π‘₯12 ] + 2[𝑓 4 + 𝑓 π‘₯7 + 𝑓 π‘₯10 + 𝑓 𝑏 ] For the general case when the domain [a, b] is divided into N subintervals (where Nis at least 6 and divisible by the above equation can be generalized to: 𝐼 𝑓 = 3β„Ž 8 [𝑓 π‘Ž + 3 𝑖= π‘βˆ’1 [𝑓 π‘₯𝑖 + 𝑓 π‘₯𝑖+ 𝑓 π‘₯12 ] + 2 𝑖= π‘βˆ’1 𝑓 π‘₯𝑖 + 𝑓 𝑏 ] Simpson’s 3/8 method can be used if the following conditions are met: οƒ˜ The subintervals are equally spaced οƒ˜ The number of subintervals within [a,b] must be divisible by 3.