Next: Partial Differential Equations
Up: Numerical Analysis for Chemical
Previous: Numerical Differentiation and Integration
Subsections
Differential equation is
- differential equations : composed of an unknown function and its
derivatives.
- rate equations : it expresses the rate of change of a variable as a
function of variables and parameters.
Variables are divied by
- dependent variables
- independent variables
Differential equation is classified as
- ordinary differential equation : one independent variable
- partial differential equation : more than one independent variables
A differential equation is usually accompanied by auxiliary conditions to
specify the solution completely. For first-order ODEs an initial value is
required to determine the constant and obtain a unique solution.
- initial-value problem : all conditions are specified at the same
value of the independent variable.
- boundary-value problem : specification of conditions occurs at
different values of the independent variable.
Ordinary differential equation is
The solution is
or, in mathmatical terms,
 |
(7.1) |
The slope estimate of
is used to extrapolate from an old value
to a new value
over a distance
.
Figure 7.1:
Graphical depiction of a one-step method.
|
|
Euler's method is
 |
(7.2) |
More smaller step-size gives more accurate solution but further step-size
reduction requires much computation times.
A funcdermental source of error in Euler's method is that the derivative at
the beginning of the interval is assumed to apply across the entire
interval.
Heun's Method : average two derivatives which are obtained at the
initial point and the end point. The slope at the beginning of an interval
 |
(7.3) |
is used to extrapolate linearly to
 |
(7.4) |
This equation is called a predictor equation. The slope at the end of the
interval
 |
(7.5) |
Thus, the two slopes can be combined to obtain an average slope for the
interval
 |
(7.6) |
This average slope is then used to extrapolate linearly from
to
 |
(7.7) |
which is called a correct equation. See the figure 25.9 at p 688.
The Heun method is a predictor-corrector approach.
The Midpoint Method : use Euler's method to predict a value of
at the midpoint of the interval.
 |
(7.8) |
This slope is then used to extrapolate linear form from
to
 |
(7.9) |
Runge-Kutta methods achieve the accuracy of a Taylor series approach
without requiring the calculation of higher derivatives.
 |
(7.10) |
where
is called an increment function, which can be
interpreted as a representative slope over the interval. The increment
function is
 |
(7.11) |
where the
's are constants and the
's are
Notice that the
's are recurrence relationship. Because each
is a
functional evaluation, this recurrence makes RK methods efficient for
computer calculations.
Second-order Runge-Kutta Methods
The second-order version of RK method:
 |
(7.13) |
where
To determine values for the constant
,
,
, and
, use
a Taylor's series for
in terms of
and
 |
(7.15) |
where
is
 |
(7.16) |
Then,
 |
(7.17) |
The basic strategy underlying Runge-Kutta methods is to use algebraic
manipulations to solve for values of
,
,
, and
that
make eq (7.13) and eq (7.17) equivalent.
The Taylor's series for a two-variable function is
 |
(7.18) |
This gives
 |
(7.19) |
By correcting terms
![$\displaystyle y_{i+1} = y_i + \left[a_1 f(x_i,y_i) + a_2 f(x_i,y_i)\right]h + \...
...ial x} + a_2 q_{11} f(x_i,y_i) \frac{\partial f}{\partial y} \right]h^2+ O(h^3)$](img412.png) |
(7.20) |
Comparing this equation with eq (7.17)
Because these three equations contain the four unknown constants, we must
assume a value of one of the unknowns to determine the other three. Suppose
that we specify a value for
.
Also we can choose an infinite number of values for
, there are an
infinite number of second-order RK methods.
Heun Method with a Single Corrector(
)
Assume
 |
(7.26) |
These parameters yield
 |
(7.27) |
where
Midpoint Method(
)
 |
(7.30) |
where
Ralston's Method (
)
 |
(7.33) |
where
See the figure 25.14 at p 699.
Fourth-order Runge-Kutta Methods
The classical fourth-order RK method
 |
(7.36) |
where
See the figure 25.16 at p 704.
The procedure for solving a system of equations simply involves applying
the one-step technique for every equation at each step before proceeding to
the next step.
- Automatically adjust the step size to avoid overkills
- Need an estimate of the local truncation error be obtained at each
step
Strategies for adaptive RK
- Use different step sizes to calculate local error
- Use different order of RK method to calculate local error
A stiffness system is one involving repidly changing components together
with slowly changing ones. In many cases, the rapidly varying components
die away quickly, after which the solution becomes dominated by the slowly
varying components.
An example of a single stiff ODE is
 |
(7.38) |
If
,
 |
(7.39) |
The solution is initially dominated by the fast exponential term
(
). After a very short period
, this transient
dies out and the solution becomes dictated by the slow exponential
(
).
Step size consideration: Insight into the step size required for
stability for a solution.
 |
(7.40) |
If
,
 |
(7.41) |
Thus, the solution starts at
and asymptotically approaches zero.
Use Euler's method
 |
(7.42) |
Substituting
 |
(7.43) |
or
 |
(7.44) |
The stability of this formula clearly depend on the step size
. That is,
must be less than 1.
For the fast transient part, the step size to maintain stability must be
very small. In addition, an even smaller step size is required to obtain an
accurate solution.
Implicit method: developed by evaluating the derivative at the
future time
 |
(7.45) |
Substituting the derivative term
 |
(7.46) |
which can be solved for
 |
(7.47) |
For this case, regardless of the size of the step,
as
. See the figure 26.2 at p 722.
The one-step methods utilize information at a single point
to predict
a value of the dependent variable
at a future point
. Alternative approaches, called multistep methods, are base on
information of the previous points. The curvature of the lines connecting
these previous values provides information regarding the trajectory of the
solution. The multistep methods exploit this information to solve ODEs.
The non-self-starting Huen method
The Heun method use Euler's method as predictor
 |
(7.48) |
and the trapezoidal rule as a corrector
 |
(7.49) |
Thus, the predictor and the corrector have local truncation errors of
and
, repectively. Consequently, one way to improve Heun's
method is to develop a predictor that has a local error of
. This
can be accomplished by using Euler's method and the slope at
, and
extra information from a previous point
, as in
 |
(7.50) |
Notice that eq. (7.50) attains
at the expense of
employing a larger step size,
. In addition, eq. (7.50) is
not self-starting because it involves a previous value of the dependent
variable
. Because of the fact it is called the non-self-starting
Heun method.
Derivation of non-self-starting Heun method
Consider the general ODE
 |
(7.51) |
Integrating between limits at
and
 |
(7.52) |
Integrated value is
 |
(7.53) |
Use trapezoidal rule to integrate the second term at right hand side
 |
(7.54) |
which is the corrector equation for the Heun method and the trapezoidal
rule gives the local truncation error of
.
A similar approach can be used to derive the predictor. For this case, the
integration limits are from
to
.
 |
(7.55) |
which can be integrated and rearranged to yield
 |
(7.56) |
Use the first Newton-Cote open integration formula
 |
(7.57) |
which is called the midpoint method.
 |
(7.58) |
which is the predictor for the non-self-starting Heun.
Integration formulas
The non-self-starting Heun method employs an open integration formula (the
midpoint method) to make an initial estimate. This predictor step requires
a previous data point. Then, a closed integration formula (the trapezoidal
rule) is applied iteratively to improve the solution.
Newton-Cotes formulas estimate the integral over an interval spanning
several points. In constrast, the Adam formulas use a set of points from an
interval to estimate the integral solely for the last segment in the
interval. See the figure 26.7 p 734.
- Newton-Cotes Formulas
- Open formulas
 |
(7.59) |
if
 |
(7.60) |
which is referred to as the midpoint method and was used previously as
the predictor in the non-self-starting Heun method.
- Closed formulas
 |
(7.61) |
if
 |
(7.62) |
which is equivalent to the trapezoidal rule.
- Adams Formulas : Many popular computer algorithms for multistep
solution of ODEs are based on these methods.
- Open formulas(Adams-Bashforth) : start with a forward Taylor series
expansion at
 |
(7.63) |
which can also be written as
 |
(7.64) |
Use a backward difference
 |
(7.65) |
Then
 |
(7.66) |
- Closed formulas(Adams-Moulton) : start with a backward Taylor
series around
 |
(7.67) |
Solving for
yields
 |
(7.68) |
Use a difference to approximate the first derivative
 |
(7.69) |
Then
 |
(7.70) |
Boundary-value : which is specified at the extreme points or boundaries of
a system.
Classification of boundary condition
- Dirichlet condition : the value of independent variable is specified
at a boundary
- Neumann condition : the value of the derivative of independent
variable is specified at a boundary
The shooting method: based on converting the boundary-value
problem into an equivalent initial-value problem. A trial-and-error
approach is then implemented to solve the initial-value version.
Finite-difference methods: finite divided differences are
substituted for the derivatives in the original equation. Thus, a linear
differential equation is transformed into a set of simultaneous algebraic
equations.
See the textbook
Next: Partial Differential Equations
Up: Numerical Analysis for Chemical
Previous: Numerical Differentiation and Integration
Taechul Lee
2001-11-29