Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
16 views

Numerics Chapter 6 Numerical Diffentaion and Integration

The document discusses numerical differentiation and integration techniques. It covers the concepts of derivatives, integrals, and the inverse relationship between differentiation and integration. It then describes various numerical methods for approximating derivatives and integrals, including finite difference methods, Newton-Cotes formulas, the trapezoidal rule, and applying integration rules over multiple intervals.

Uploaded by

abelt1327
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Numerics Chapter 6 Numerical Diffentaion and Integration

The document discusses numerical differentiation and integration techniques. It covers the concepts of derivatives, integrals, and the inverse relationship between differentiation and integration. It then describes various numerical methods for approximating derivatives and integrals, including finite difference methods, Newton-Cotes formulas, the trapezoidal rule, and applying integration rules over multiple intervals.

Uploaded by

abelt1327
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 48

CHAPTER-V

NUMERICAL DIFFERENTIATION &


INTEGRATION
the derivative represents the rate of change of a dependent variable with respect to an independent variable.
If y is the dependent variable and x is the independent variable, the first derivative of y = f(x) w.r.t. to x,
represented by dy/dx, is given by

The graphical definition of a derivative: as x approaches zero in going from (a) to (c), the
difference approximation becomes a derivative.
The inverse process to differentiation in calculus is integration. Mathematically, integration is represented by

which stands for the integral of the function f(x) w.r.t. the independent variable x, evaluated between the limits
x = a to x = b. The function f(x) is referred to as the integrand.

Graphical representation of the integral of f(x)


between the limits x = a to b. The integral is
equivalent to the area under the curve
Non-Computer Methods for Differentiation and Integration
will typically be in one of the following three forms:
1. A simple continuous function such as a polynomial, an exponential, or a trigonometric function.
may be evaluated analytically using calculus.
2. A complicated continuous function that is difficult or impossible to differentiate or integrate directly.
analytical solutions are often impractical or impossible approximate methods must be employed.
3. A tabulated function where the values of x and f(x) are given at a number of discrete points, as is
often the case with experimental or field data.
approximate methods must be employed.
A non-computer method for determining derivatives from data is called equal-area graphical differentiation.
The procedure followed in differentiation
1.the (x, y) data are tabulated
2.for each interval, a simple divided difference ∆y/∆x is employed to estimate the slope.
3.Then these values are plotted as a stepped curve versus x.
4.a smooth curve is drawn that attempts to approximate the area under the stepped curve. so that visually, the
positive and the negative areas are balanced

5.The rates at given values of x can then be read from the curve.
visually oriented approaches were employed to integrate tabulated data .A simple intuitive approach is to

1, plot the function on a grid and count the number of


boxes that approximate the area.
2,This number multiplied by the area of each box provides
a rough estimate of the total area under the curve.

3,This estimate can be refined, at the expense of


additional effort, by using a finer grid.
Another commonsense approach is to

1,divide the area into vertical segments, or strips, with a


height equal to the function value at the midpoint of each
strip.

2,The area of the rectangles can be then calculated and


summed to estimate the total area. it is assumed that the
value at the midpoint provides a valid approximation of
the average height of the function for each strip.

3,refined estimates are possible by using more (and


thinner) strips to approximate the integral.
Numerical differentiation
Lower Order Methods
By truncating the second- and higher-derivatives in the Taylor series

The first forward difference

Where fi is referred to as the first forward difference and h is called the step size. The entire term  f /h is
referred to as a first finite divided difference.

Similarly, by truncating the Taylor series between xi-1 and xi ,


the following formula for approximating the first derivative is obtained

Where fi is referred to as the first backward difference.

A third way to approximate the first derivative is to subtract backward Taylor series expansions (between xi-1
and xi ) from the forward Taylor series expansion (between xi and xi+1) resulting in
Lower Order Derivatives
First forward difference

First backward difference

Centered first order difference


Example 5.1: Evaluate the first derivative of the following function at x=0.5 with intervals of h=0.5 and h=0.25
using the forward, backward and centered difference expansions of Taylors series.

Exact Value

x=0.5, f’(x)=-0.9125
For h=0.5

Forward Diff.
Backward Diff.

Centered Diff.

For h=0.25

Forward Diff.

Backward Diff.
Centered Diff.

High-Accuracy Differentiation Formulas


can be generated by including additional terms from the Taylor series expansion. For example, the forward
Taylor series expansion can be written as

can be truncated by excluding the second- and higher-derivative terms

retain the second-derivative term by substituting the following approximation of the second derivative
Forward Finite-divided Difference Formulas
First derivative

When the second derivative is ignored

When the second derivative is included


Second Derivative
Third Derivative

Fourth Derivative

Backward Finite-divided Difference Formulas

First Derivative
Second Derivative

Third Derivative

Fourth Derivative
Centered Finite-divided Difference Formulas
First Derivative

2 points required

Second Derivative

3 points required

Third Derivative

4 points required
Fourth Derivative

4 points required

Example 5.2 Recall that in we estimated the derivative of


at x = 0.5 using finite divided differences and a step size of h = 0.25, where the errors were computed on the
basis of the true value of -0.9125. Repeat this computation, but employ the high-accuracy formulas
The forward difference of accuracy O(h2) is computed as

The backward difference of accuracy O(h2) is computed as


The center difference of accuracy O(h4) is computed as
NUMERICAL AND INTEGRATION
Newton-Cotes integration formulas
The Newton-Cotes formulas They are based on the strategy of replacing a complicated function or tabulated
data with an approximating function that is easy to integrate:

Where n is the order of the polynomial

Closed and open forms of the


Newton-Cotes formulas are available.

The closed forms are those where the data The open forms have integration limits that
points at the beginning and end of the limits extend beyond the range of the data.
of integration are known.
The approximation of an integral by the area
under (a) a single straight line and (b) a single
parabola

The approximation of an integral by the


area under three straight-line segments
The difference between (a) closed and (b) open integration formulas.

Open Newton-Cotes formulas are not generally used for definite integration. However, they are utilized for
evaluating improper integrals and for the solution of ordinary differential equations.
Trapezoidal Rule
Simpson’s Rule [INTRODUCTION]
Simpson’s Rule [1/3]
Simpson’s Rule [3/8]
Trapezoidal Rule

A specific case of Simpson’s polynomial method where the approximation polynomial used is first order/linear

called the trapezoidal rule.


Graphical depiction of the trapezoidal rule.

(a) The formula for computing the area of a


trapezoid: height times the average of the bases.
(b) For the trapezoidal rule, the concept is the
same but the trapezoid is on its side.
I = (b - a) x average height

where, for the trapezoidal rule, the average height is the average of the function values at the end points,
or [ f(a) - f(b)]/2.
Example 5.3 : Graphical depiction of the use of a single application of the trapezoidal rule to
approximate the integral of f(x) = 0.2 + 25x - 200x 2+ 675x3 -900x4 + 400x5 from x = 0 to 0.8

where ζ lies somewhere in the interval from


a to b.
Single Application of the Trapezoidal Rule: Integrate the following function from x=0 up to x=0.8 using

i . Direct Integration [ANS: 1.640533]


ii. Numerical Integration

Area= width * Average Height


Area= (b-a) * (f(a)+f(b))/2
Area= (0.8-0)* (0.2+0.232)/2
Area=0.1738[error=89.5%]
To obtain this estimate, the function’s second derivative over the interval can be computed by differentiating
the original function twice to give

} = {−400 𝑥 +2025 {𝑥} ^ {2} −3600 {𝑥} ^ {3} +2000 {𝑥} ^ {4 } | <?> lsub {0} lsup {0.8}} over {0.8−0 ¿
𝑓
Multiple Application of the Trapezoidal Rule
One way to improve the accuracy of the trapezoidal rule is to divide the integration interval from a to b
into a number of segments and apply the method to each segment. The areas of individual segments can
then be added to yield the integral for the entire interval. The resulting equations are called multiple-
application, or composite ,integration formulas
There are n + 1 equally spaced base points (x0, x1, x2, . . . ,xn). Consequently, there are n segments of equal
width:

If a and b are designated as x0 and xn, respectively, the total integral can be represented as

Substituting the trapezoidal rule for each integral


An error for the multiple-application trapezoidal rule can be obtained by summing the individual errors for
each segment to give
Example 5.4 Use the two-segment trapezoidal rule to estimate the integral of

from x=0 up to x=0.8

n = 2 (h = 0.4):

f(0) = 0.2 f(0.4) = 2.456 f(0.8) = 0.232


Example 5.5 Multi-Segment Trapezoidal Integration Using (i) 2, (ii) 4, (iii) 6 segments, integrate

from x=0 to x=0.8

n=2 : two adjacent trapezoids


(i.e. 2 equal intervals, 3 points)

using 2 interval= (b-a)/n=(0.8-0)/2=0.4


intermediate points:[0, 0.4, 0.8]
F(0)=0.2 f(0.4)=2.456 f(0.8)=0.232
I=(0.4/2)*(f(0)+f(0.4)*2+f(0.8)=1.0688

using 4 interval= (b-a)/n=(0.8-0)/4=0.2


intermediate points:[0, 0.2, 0.4, 0.6, 0.8]
F(0)=0.2 f(0.2)=1.288 f(0.4)=2.456 f(0.6)=3.464 f(0.8)=0.232
I=(0.2/2) * (f(0)+f(0.2) * 2+f(0.4)* 2+f(0.6) * 2+f(0.8)=1.4848
using 8 interval (b-a)/n=(0.8-0)/8=0.1
intermediate points:[0, 0.1, 0.2, 0.3, …, 0.8]
F(0)=0.2 f(0.1)=1.289 f(0.2)=1.288 f(0.3)=1.607 f(0.4)=2.456 f(0.5)=3.325 f(0.6)=3.464
f(0.7)=2.363 f(0.8)=0.232

I=(0.1/2)*(f(0)+f(0.1)*2+f(0.2)*2+f(0.3)*2+f(0.4)*2+f(0.5)*2+f(0.6)*2+f(0.7)*2+f(0.8))=1.6008
SIMPSON’S RULES
Aside from applying the trapezoidal rule with finer segmentation, another way to obtain a more accurate
estimate of an integral is to use higher-order polynomials to connect the points.

Example
if there is an extra point midway between f(a) and f(b), the three points can be connected with a parabola . If
there are two points equally spaced between f(a) and f(b), the four points can be connected with a third-order
polynomial
Simpson’s 1/3 Rule
if there is an extra point midway between f(a) and f(b), the three points can be connected with a parabola
Simpson’s 1/3 rule results when a second-order interpolating polynomial

If a and b are designated as x0 and x2 and f2(x) is represented by a second-order Lagrange polynomial
where, for this case, h = (b - a)/2. This equation is known as Simpson’s 1/3 rule. It is the second Newton-
Cotes closed integration formula. The label “1/3” stems from the fact that h is divided by 3

f4=the average fourth


derivative for the interval
Example 5.6 : Single Application of Simpson’s 1/3 Rule

from a = 0 to b = 0.8. Recall that the exact integral is 1.640533.


f(0) =0.2 f(0.4) = 2.456 f(0.8) = 0.232

Therefore, can be used to compute

which represents an exact error of

Et=1.640533 - 1.367467 = 0.2730667 et = 16.6%

= =-4800/2=-2400
where -2400 is the average fourth derivative for the interval
The Multiple-Application Simpson’s 1/3 Rule
Just as with the trapezoidal rule, Simpson’s rule can be improved by dividing the integration interval
into a number of segments of equal width

Graphical representation of the multiple application


of Simpson’s 1/3 rule. Note that the method can be
employed only if the number of segments is even.
Substituting Simpson’s 1/3 rule for the individual integral
An error estimate for the multiple-application Simpson's rule is obtained in the same fashion as for the
trapezoidal rule by summing the individual errors for the segments and averaging the derivative.

where f -(4) is the average fourth derivative for the interval.

the multiple-application version of Simpson’s 1/3 rule yields very accurate results. For this reason, it is considered
superior to the trapezoidal rule for most applications.

it is limited to cases where the values are equi-spaced. Further, it is limited to situations
where there are an even number of segments and an odd number of points.
Example 5.7: Use Multiple-Application Simpson’s 1/3 Rule with n = 4 to estimate the integral of

from a = 0 to b = 0.8. Recall that the exact integral is 1.640533.

n = 4 (h = 0.2)
Simpson’s 3/8 Rule

In a similar manner to the derivation of the trapezoidal and Simpson’s 1/3 rule, a third order Lagrange
polynomial can be fit to four points and integrated:

where h =(b - a)/3. This equation is called Simpson’s 3/8 rule because h is multiplied by 3/8. It is the
third Newton-Cotes closed integration formula.

the 3/8 rule has utility when the number of segments is odd
Example 5.8: Use Simpson’s 3/8 rule to integrate

from a = 0 to b = 0.8
A single application of Simpson’s 3/8 rule requires four equally spaced points:
Use it in conjunction with Simpson’s 1/3 rule to integrate the same function for five segments.
The data needed for a five-segment application (h = 0.16) is
Needs 5 segments or 6 points (3 points(2 intervals) for
1/3 application, 4 points (3 intervals) for 3/8 application
=7 points-1 common point=6 points)
The integral for the first two segments is obtained using Simpson’s 1/3 rule :

For the last three segments, the 3/8 rule can be used to obtain

The total integral is computed by summing the two results:


Illustration of how Simpson’s 1/3 and 3/8 rules can
be applied in tandem to handle multiple applications
with odd numbers of intervals.

You might also like