Next: Ordinary Differential Equations Up: Numerical Analysis for Chemical Previous: Curve Fitting

Subsections

# Numerical Differentiation and Integration

The derivative represents the rate of cchange of a dependent variable with respect to an independent variable.

 (6.1)

The integration means the total value, or summation, of over the range to .

 (6.2)

# Newton-Cotes Integration of Equations

Newton-Gregory forward polynomial : If the -values are evenly spaced, instead of using divided difference, ordinary differences'' are more useful; the differences in -values are not divided by the differences in -values.

 (6.3)

where , with , the uniform spacing in -values.

The Newton-Cotes formulas are based on the strategy of replacing a complicated function or tabulated data with an approximating function that is easy to integrate:

 (6.4)

where is the Newton-Gregory interpolating polynomial. For

 (6.5)

For

 (6.6)

See the figure 21.1 in the textbook.

## The Trapezoidal rule

The trapezoidal rule is the first of the Newton-Cotes closed integration formulas

 (6.7)

where

 (6.8)

The result of integration is

 (6.9)

which is called as trapezoidal rule.

One way to improve the accuracy of the trapezoidal rule is to divide the integration interval from to into a number of segments and apply the method to each segment. The width of segments

 (6.10)

The integration is

 (6.11)

## Simpson's rule

Another way to obtain a more accurate estimate of an integral is to use higher-order polynomial to connect the points.

Simpson's 1/3 rule : use a second-order polynomial

 (6.12)

Simpson's 1/3 rule is

 (6.13)

The label 1/3'' stems from the fact that is divided by 3.

Simpson's 3/8 rule : use a third-order Lagrange polynomial

 (6.14)

Simpson's 3/8 rule is

 (6.15)

See the figure 21.11 in the textbook.

# Intergrations of Equations

## Romberg integration

Richardson's extrapolation : use two estimates of an integral to compute a third. It improves the results of numerical integration on the basis of the integral estimate themselves.

Two separate estimate using step sizes of and

 (6.16)

The error of the multiple-application trapezoidal rule is

 (6.17)

Assume that is constant regardless of step size

 (6.18)

Rearranage the above equation

 (6.19)

which can be substituted into eq. (6.16)

 (6.20)

which can be solved for

 (6.21)

Thus, we have developed an estimate of the truncation error in terms of the integral estimates and their step sizes. This estimate can then be substituted into

 (6.22)

to yield an improved estimate of the integral:

 (6.23)

For the special case where the interval is halved

 (6.24)

or

 (6.25)

The Romberg integration algorithm

 (6.26)

where and are the more and less accurate integral and is the improved integral.

• Trapezoidal rule : two parameters model

 (6.27)

where the 's are the unknown parameters.
• Gauss Quadrature : four parameters model

 (6.28)

where the 's, , are the unknown parameters.

The trapezoidal rule's formula can be derived from another point of view, the method of undetermined coefficients. Because the trapezoidal rule is a two parameters model, we need two relationships that connect two parameters.

 (6.29)

and

 (6.30)

 (6.31)

The trapezoidal rule must pass through the end point and results in a large error. But suppose that the constraints of fixed base points was removed and we were freely evaluate the area under a straight line joining any two points on the curve. See the figure 22.5 to figure out the differences.

The object of Gauss quadrature is to determine the coefficients of an equation of the form

 (6.32)

with assuming that eq. (6.32) fit the integral of a constant, a linear, a parabolic, and a cubic function

 (6.33) (6.34) (6.35) (6.36)

These relationships yield the two-point Gauss-Legendre formula

 (6.37)

Because Gauss quadrature requires function evalutions at nonuniformly spaced points within the integration interval, it is not appropriate for cases where the function is unknown.

## Improper integrals

Improper intergral that is one with a lower limit of or an upper limit of , usually can be evaluated by makeing a change of variable that transforms the infinite range to one that is finite.

# Numerical Differentiation

Improve derivative estimates
• Decrease the step size
• Use a higher-order formula
• Combine two derivative estimates to compute more accurate approximation

## High-accuracy differentiation formulas

The forward Taylor series expansion can be written as

 (6.38)

which can be solved for

 (6.39)

If we truncate the second- and higher-derivative terms

 (6.40)

The accuracy of the above equation depend on the step size .

In contrast to this approach, substitue the second-derivative term

 (6.41)

into eq. (6.39) to yield

 (6.42)

or, by collecting terms,

 (6.43)

Notice that inclusion of the second-derivative term has improved the accuracy to .

## Richardson extrapolation

In similar with Richardson extrapolation for integral, an estimate for derivatives can be written as

 (6.44)

For centered difference approximations with , the application of this formula will yield a new derivative estimate of .

## Derivatives of unequally spaced data

One way to handle nonequispaceddata is to fit a second-order Lagrange interpolating polynomial to each set of three adjacent points.

## Numerical integration/differentiation formulas with libraties and packages

Various subroutines and functions are exist to solve integral and derivative problems in Matlab and IMSL.

# Engineering Applications: Numerical Integration and Differentiation

Next: Ordinary Differential Equations Up: Numerical Analysis for Chemical Previous: Curve Fitting
Taechul Lee
2001-11-29