ordinary differential equations - tu dresden · the water level in the container is described by a...

70
Chapter 5 Ordinary differential equations Peter-WolfgangGr¨aber Systems Analysis in Water Management

Upload: others

Post on 12-Mar-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

Chapter 5

Ordinary differential equations

Peter­Wolfgang Graber Systems Analysis in Water Management

Page 2: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

Ordinary differential equations �ODE) are characterized by the fact that the

searched function is dependent on a variable, while in a partial differential equation

�PDE) more arguments and their appropriate derivatives appear as in the following

examples:

dx

dt+ t2 · x = 2t2 Ordinary differential equation (ODE)

∂f

∂x+∂f

∂y= 0 Partial differential equation (PDE)

Table 5 illustrates the characteristics:

Table 5.1: Representation of differential equations

ODE PDE

Numberone variable

(independent parameter)several variables

(independent parameters)Variables x� y� z or t x� y� z and/or t

Example v =ds

dt

�v = k · grad(h)

�v = k ·

�∂h

∂x�i+

∂h

∂y�j +

∂h

∂z�k

Illustration

1-D function withtangent function

Vertex with arbitrarycurved surface

In the following derivations and examples with the ordinary differential equations it is

assumed that ”x” stands for the function value and ”t” for the argument. Of course

all propositions can also be made with other arguments, and for the dependent func-

tions arbitrary variable names can be used. The particular use of the letter x as

a symbol of variable name appears in many mathematic teaching materials and in

the signal theory (See Graeber: Lehrmaterial zur Automatisierung- stechnik bzw.

Grundwassermesstechnik).

In partial differential equations x, y and z are used as independent local coordinates.

114

Page 3: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

The general form of an ODE is:

F

t� x(t)�dx(t)

dt�d2x(t)

dt2� · · · �

dnx(t)

dtn

= g(t) (5.1)

These differential equations are identified according to 5, if correspondent conditions

are fulfilled.

Table 5.2: identification of differential equations

Description Condition Example

Order of the ODE ndnx

dtn+dn−1x

dtn−1+dn−2x

dtn−2= 0

inhomogeneous g(t) �= 0dx

dt+ t2 · x = 2t2

homogeneous g(t) = 0dx

dt+ t2 · x = 0

explicitdnx

dtn= 0

d2x

dt2= 0

implicit F

t� x�dx

dt�dnx

dtn

= 0dx

dt+ t2 · x− 2t2 = 0

linear a1(t) �= a1(x� t) tdx

dt+ t2x = 2t2

non-linear a1(t) = a1(x� t) xdx

dt+ t2x = 2t2

115

Page 4: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.1 Setting up equations

In the further sections solving differential equations is based on the mathematical

description of natural processes. The derivatives of mathematical equations as trans-

formation of natural processes is noted as modelling and as the transformation of

mathematical model. The development of such mathematical models is the subject of

chapter 11.2.1theoretical/experimental process analysis. The method described here

is only how the mathematical models to be completed according to the physical or

chemical basic laws and their effects. This way of the theoretical process analysis, also

designated as mathematical modelling, is generally preferred by natural scientists.

In the theoretical process analysis the reciprocal effects of the process variables, state

variables are formulated as mathematical model equations with their neighbourhoods.

The most substantially reciprocal effects between the system and its neighbourhood are

divided into causes and effects. The causes and the effects are called input and output

variables. The description by means of the physical or chemical basic law is usually

in formation of the balance equation, particularly the formation of the energy and

mass balance equations.

Mostly the energy balance equations lead to the force equilibrium law and the flux

laws. Generally we can speak of the transformation from potential to kinetic energy.

Such energy transformations take place on so called flow resistances. A kinetic energy

in form of material or mass flow results from different potential energies at the in- or

outflow resistance (e.g. conduit, aquifer, electrical resistance), which act as driving

force. We also say that flow resistances corresponding potential energy, also called

as potential, is abolished, ”drops” (e.g. pressure difference, voltage drop). The mass

balance equation assumes that mass is neither created nor destroyed within a regarded

system (e.g. container, representative unit volume). The mass balance of a system can

only be changed by outside sources or sinks. If dynamic systems are considered, the

storage effect must be included likewise the mass balance. This means that all mass

flows, which affect a system, must be zero in sum (junction law). Mathematically this

circumstance can be also described by the divergence of a flow vector, which must be

zero in this case (div�v = 0).

Systems Analysis in Water Management Peter­Wolfgang Graber

Page 5: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.1. Setting up equations

5.1.1 Examples of setting up differential equations:

1. Find the relationship between the flow rate V , which flows from a pipe with free

gradient, and the water level if the pipe is connected to a reservoir (see figure

5.1). According to the equilibrium of forces follows:

Figure 5.1: Diagram of the pressure ratios

patm + phydr1 = patm + phydr2

The hydrostatic water pressure amounts to:

phydr = h · ρ · g

The systems strives to reach a steady state

phydr = 0

h · ρ · g = 0

h = 0

This is the steady state.

To study the non-steady-state a appropriate differential equation must be setted

up. These we get by setting up the balance equation

V = h · A

dV

dt=d (h · A)

dt

= Adh

dt+ h

dA

dt

117

Page 6: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

Since in the current reservoir the walls are perpendicular, e.g. A = const., the

change of the areal A over the time is equal to zero.

dV

dt= A

dh

dt(5.2)

Then again is the flow rate dependent form the difference of the pressure ratios

and of the hydraulic resistance of the pipe. Along the pipe appears a decrease

of the pressure which is among others proportional to the length of the pipe

and inversely proportional to the profile of the pipe. This is collected as the hy-

draulic resistance. Then the decrease of pressure is proportional to the hydraulic

resistance.

V =(patm + phydr1)− (patm + phydr2)

Rhydr

=phydr1 − phydr2

Rhydr

= ρ · gh− 0

Rhydr

V =ρ · g · h

Rhydr

The discharge is equal to the balance equation 5.2:

Adh

dt=ρ · g · h

Rhydr

A

Rhydr · ρ · g

dh

dt− h = 0

The water level in the container is described by a homogeneous ordinary differ-

ential equation of first order.

To solve such equations see section 5.2.1 (ODE of first order), page 125.

Under the initial condition that the initial water level ht=0 = hAnf is, we get the

solution:

h = hAnf · e−tT

with T =A

Rhydr · ρ · g

2. Find the differential equation to determinate the temperature of an industrial

furnace with an filament heating (see figure 5.2). To simplify the theoretical

118

Page 7: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.1. Setting up equations

Figure 5.2: Illustration of an filament heated industrial furnace

process analysis we assume that the furnace temperature is not spatial dependent

and the leakage heat flow is only controlled by the difference of the furnace

temperature and the outside temperature. The overall mass m has the specific

heat capacity c.

The energy balance for the furnace is:

m · cdϑidt

= Pel −Qv (5.3)

According to the Newton Law for heat transfer follows:

Qv = α · A(ϑi − ϑa)

Inserted in equation 5.3 we optain:

m · cdϑidt

= Pel − α · A(ϑi − ϑa)

m · c

α · A

dϑidt

+ ϑi =Pelα · A

+ ϑa

For the temperature profile inside the furnace we get an inhomogeneous ODE

of first order. For the solution of such equations see section 5.2.1 ODE of first

order, page 125 and section 5.2.1.2 solution of inhomogeneous ODE, page 128.

Here under the condition the right side is Pel

α·A+ ϑa = const. and the initial

119

Page 8: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

temperature inside the furnace is ϑi�t=0 = ϑi�Anf the solution is:

ϑi =

�Pelα · A

+ ϑa

��

1− e−tT

+ ϑi�Anf

mit T =m · c

α · A

T is called the time constant and is a measure for the temperature alteration

speed ϑi inside the furnace.

120

Page 9: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.1. Setting up equations

5.1.2 Exercises for setting up ODE’s:

Exercises to 5.1

1. The ground water level reincrease and therewith the refill of the former surface

mines under natural conditions lasts to long. Therefore one tries to accelerate

the refilling process.

Find a differential equation for the refilling process h(1�2)(t) without considering

the aquifer and eventually groundwater recharge rates. In all cases the initial

condition ht=0(1�2) = 0 is given.

a) constant volume flow rate (see figure 5.3)

b) variable volume flow rate (see figure 5.4)

c) linked storage cascade (see figure 5.5)

d) V1 + V2 = const

Figure 5.3: Refilling of an old surface mine with constant volume flow rate

2. For the given hydraulic diagram (see figure 5.6) with the corresponding block

diagram set up the differential equation.

Assume linear conditions and a homogeneous, isotropic aquifer with the param-

eters k = 5 · 10−4ms, n0 = 0.2, zRmittel = 20m, l = 50m.

3. For the water level regulation of a feeder a float regulation is used (see figure

5.7).

Set up the differential equation for the calculation of the water level H. The

areal of the reservoir is A. The volume flow rate V depends on the water level

H.

V = K · Vmax · (Hmax −H)

121

Page 10: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

Figure 5.4: Refilling of an old surface mine with variable volume flow rate

Figure 5.5: Linked storage cascade

4. For a steady experiment a soil sample with the volume VB is given into a beaker

with water VH20. The pollutant concentration in the soil shall be CB = 125mgl, in

the water CH20t=0= 0mg

lat the time t = 0. In a first approximation a pollutant

transport out of the soil into the water will occur (see figure 5.8).

Set up the differential equation for the concentration regime in the water. The

water solid ratio (W/F = 1) will be one. The diffusion resistance RDiff is given.

mqu = 125 mg (pollutant in the soil), VB = VH2O = 1l, RDiff

5. Two objects with different temperatures(T1 und T2) get connected at the time

t = 0. The heat transfer is determined by the thermical conductivity Rtherm and

by the heat capacities(W1 und W2) of both objects.

Draw a thermical block diagram and set up the corresponding differential equa-

tion for the variationZeichnen of the temperature T2(t).

122

Page 11: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.1. Setting up equations

Figure 5.6: Representation of the groundwater level with a block diagram

Figure 5.7: Water level regulation of a feeder

123

Page 12: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

Figure 5.8: Pollutant transport out of the soil into the water

124

Page 13: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.2 Analytical solution methods

5.2.1 First order ordinary differential equations

A solution for the following first order ODE should be found:

a1(t)dx

dt+ a0(t)x = g(t)

The following notations are often used:

dx

dt= x

dy

dx= y�

First the inhomogeneous ODE will be transferred to a homogeneous ODE:

a1(t)dxhdt

+ a0(t)xh = 0 (5.4)

There are several methods to solve homogeneous ODE, and the separation of vari-

ables and the ansatz method will be described now.

5.2.1.1 Solution of homogeneous differential equations

An arbitrary homogeneous first order ODE has the notation:

a1(t)dxhdt

+ a0(t)xh = 0 (5.5)

For simplification the functions a0 and a1 are regarded as constants.

Peter­Wolfgang Graber Systems Analysis in Water Management

Page 14: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

• Separation of the variables

The separation of variables is a method to transform the ODE to an equation where

on both sides is a total differential in one variable. Then both sides are integrable and

the solution can be found.

a1dxhdt

+ a0xh = 0

dxhdt

= −a0

a1

xh

dxhxh

= −a0

a1

dt

� 1

xhdxh = −

a0

a1

�dt

ln xh + C1 = −a0

a1

· t ln xh − lnC2 = −a0

a1

· t

ln xh = −

�a0

a1

· t+ C1

or ln xh = lnC2 −

�a0

a1

· t

xh = e−

�a0a1·t+C1

xh = C2 · e−

�a0a1·t

(5.6)

Both solutions are possible according to the logarithm laws (see section 1.1, page 6)

and transferable to each other. E.g.:

C2 = eC1 or C1 = − lnC2 (5.7)

Since the integration constants C1 and C2 are still indefinite as well as the logarithms

and exponential functions of the constants, both solutions are equal. Given some inital

or final conditions the constants can be derived, e.g. C1 and C2 at t = 0 with the initial

condition xh0 :

C1 = − ln xh0 C2 = xh0 (5.8)

For both variants the solution of the homogeneous first order ODE is:

xh = xh0 · e−(

a0a1·t)

(5.9)

Example for using the separation of variables:

Find the solution of the ODE

dx

dt+ t2 · x = 0 with: xt=0 = 3

126

Page 15: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.2. Analytical solution methods

According to the algorithm we try to separate the total differentials (dx and dt), each

on one side of the equation.

dx

dt= −t2x

1

xdx = −t2dt

�1

xdx =

−t2dt

ln x = −1

3t3 + C1

x = e−1

3t3+C1

x = C2e− 1

3t3

Using the initial condition xt=0 = 3 in the general solution the constant will be C2 = 3,

so the solution is x = 3e−13t3 .

• Ansatz method

The basic idea of the ansatz method is to find a possible solution by using functions

which solve similar problems.

The most popular ansatz functions are combinations of exponential functions and/or

sine/cosine functions as well as general power series.

The advantage is that no longer difficult integrations have to be done, the ansatz

functions have to be derivated, which is often more simply to realize:

Differential equation: a1 ·dxh

dt+ a0xh = 0

Ansatz: xh = K · eλt

Derivation of the ansatz: dxh

dt= λ ·K · eλt

Inserting into the homogeneous ODE: a1 · λ ·K · eλt + a0 ·K · eλt = 0

λ = −a0

a1

(5.10)

127

Page 16: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

The reciprocal value of the constant λ is the time. It is denoted as time T or τ .

Then the solution is:

xh = K · e−a0

a1t= K · e−

tT = K · e−

tτ (5.11)

As in the separation of variables the constants are determined from the initial or final

conditions. I.e. K can be determined at t = 0 with xh0 :

K = xh0 (5.12)

This yields the solution:

xh = xh0 · e−(

a0a1t)

(5.13)

This is the same solution for the ODE like in the other method.

5.2.1.2 Solution of the inhomogeneous first order ODE

A general inhomogeneous first order ODE can be written in the form:

a1dx

dt+ a0x = g(t) (5.14)

Its general solution results from adding the homogeneous solution xh(t) (for the ODE

with g(t) = 0) to a particular solution xp(t), i.e.

x(t) = xp(t) + xh(t) (5.15)

A method to get the particular solution xp(t) in this case is the variation of constants.

After finding the homogeneous solution xh(t) in this method we assume the constant

is dependent on the arguments.

128

Page 17: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.2. Analytical solution methods

• Variation of constants

The solution will be carried out in four steps.

ODE: a1dx

dt+ a0x = g(t)

First step homogeneous equation: a1dxhdt

+ a0xh = 0

Second step separation of variables:dx

xh= −a0

a1dt

solution of the homogeneous equation: xh = Ce−a0

a1t

Third step variation of constants: xp = C(t)e−a0

a1t

According to the rule of product differentiation:

dxpdt

=dC

dt· e

−a0a1t+ C ·

−a0

a1

· e−a0

a1t

(5.16)

Fourth step insertion into the original ODE: a1dxpdt

+ a0xp = g(t)

a1 ·

�dC

dt· e

−a0

a1t+ C ·

−a0

a1

· e−a0

a1t

+ a0 · C · e−a0

a1t= g(t)

a1 ·dC

dt· e

−a0

a1t+ a1 · C ·

−a0

a1

· e−a0

a1t+ a0 · C · e

−a0

a1t= g(t)

a1 ·dC

dt· e

−a0

a1t= g(t)

dC

dt=g(t)

a1

· e+a0

a1t

(5.17)

This homogeneous first order ODE can be solved by the above methods, i.e. the

separation of variables:

dC = g(t)a1· e

+a0

a1tdt

�dC =

� g(t)a1· e

+a0

a1tdt

C(t) =� g(t)

a1· e

+a0

a1tdt

(5.18)

129

Page 18: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

Thus the general solution of the differential equation is:

x(t) = xp(t) + xh(t) (5.19)

x = Ce−

a0a1t+

�g(t)

a1

· ea0

a1tdt e

−a0

a1t

(5.20)

The constants are determined by initial or final conditions, as in the method of variables

separation, e.g. C at t = 0 with xh0 is:

C = x0 −

��g(t)

a1

· ea0ta1 dt

t=0

(5.21)

Then the solution is:

x(t) =

x0 −

�g(t)

a1

· e+a0

a1tdt

t=0

· e−a0

a1t+

��g(t)

a1

· e+a0

a1tdt

· e−a0

a1t

(5.22)

The solvability depends on the integrability of the pertubation function g(t).

Note:

The product integration is just for some functions possible. Especialy if a function

is the integral or the derivative of a function the product integration is used:�

u · dv = u · v −

v · du (5.23)

That what we should keep in mind is not the final formula, but the way to

the formula:

1. Transfer the equation into a homogeneous differential equation

2. Separation of variables

3. Variation of the constants or ansatz method

4. Insertion into the differential equation

Remarks on the variation of constants method:

1. It can be only used for linear differential equations.

2. The general solution is linearly dependent on the constants.

3. The general solution has a part without constants, which is a particular solution

of the inhomogeneous differential equation.

4. It frequently occurs that a non-linear differential equation is transferred into a

linear one by a simple substitution.

130

Page 19: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.2. Analytical solution methods

Examples for solving inhomogeneous differential equations:

1. Find the solution of the ODE

tx− x = t2 cos t

Solution:

ODE: tx− x = t2 cos t

1. Find the homogeneous solution: tx− x = 0

2. Separation of variables:dx

x=dt

t

⇒ xh = Ct

3. Variation of constants: xp = C(t)t

⇒ x = Ct+ C

4. Insertion into the ODE: t(Ct+ C)− Ct = t2 cos t

⇒ t2C = t2 cos t

⇒ C = cos t

⇒ C = sin t+ C1

General Solution: x = (C1 + sin t)t = t sin t+ C1t

131

Page 20: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

2. Find the solution of the ODE:

2tx · x+ t2 − x2 + 1 = 0

Solution:

By the substitution z = x2 and z = 2x · x the ODE is transferd to the equation

tz−z = −1−t2, Which is a linear ODE of the unknown function z. This equation

can be solved with the ansatz method:

ODE: 2txx+ t2 − x2 + 1 = 0

Substitution: z = x2� z = 2x · x

Substituted ODE: tz − z = −1− t2

1. Find the homogeneous solution: tz − z = 0

2. Separation of variables:dz

z=dt

t⇒ zh = Ct

3. Variation of constants: zp = C(t)t

⇒ z = Ct+ C

4. Insertion into the ODE: t(Ct+ C)− Ct = −1− t2

⇒ t2C = −1− t2

⇒ C = −1

t2− 1

⇒ C =1

t− t+ C1

General solution for z: z = 1− t2 + C1t

Back substitution: x2 = 1− t2 + C1t

General solution for x: x =�

1− t2 + C1t

132

Page 21: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.2. Analytical solution methods

5.2.1.3 Exercises

Exercises to 5.2.1:

1. Find the solutions of the following ODE’s:

a) y� = (y − 3) cos x

b) y� = ex+y

c) y� sin x = y ln y

d) 2xy� + y2

x= 0

e) y� + y + ex = 0

f) y� + yx

= sin x

g)dx

dt+ t2 · x = 2t2

h) y� = −xy2 with y(0) = 2

i)dx

dt+ t2x = 0 with x(0) = 3

j) tdx

dt− x = t2 cos t with x(π/2) = π

2. The differential equation for a system with simple memory effect is:

T xa + xa = K xe

(xa output value, xe input value, T time constant, K proportional transfer func-

tion)

How does the output value xa change in dependency on the time t if:

xe = c · t (c = const.)

3. Find the general and the special solution for the given initial conditions:

a) y� = xy + 2x with y(0) = 2

b) y� + x2y = x2 with y(2) = 1

4. For a given hydraulic scheme (see figure 5.9) with the associated block diagram

applies the differential equation:

hFl = R · CdzRdt

+ zR

133

Page 22: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

Linearised conditions and a homogeneous, isotropic aquifer with the following

parameters are assumed:

k = 5 · 10−4ms, n0 = 0.2, zRmiddle

= zRm= 20m, l = 50m .

Figure 5.9: Schematic representation of the groundwater level

Compute the change of the groundwater level, if the river surface as a first ap-

proximation changes as follows:

a) erratic (hFl = hFL · 1(t))

b) sinusoidal (hFl = hFLm sin(ω · t) + hFL0, with ω = 2π/τ and τ = 7d)

5. For the concentration C given by sorption of pollutants to the soil matrix applies

the ODE:

T1C + C = K

T1 is a time constant and K a constant.( T1 = 1d−1, K = 100mgl)

Given is the concentration C(t = 0) = 0.

a) Solve the ODE with help of the analytical methods and compute the con-

centration change for t = 1d.

b) Draw the concentration change in a diagram dependent on the time.

6. The padding to the remainder holes of the former brown coal open pit caused by

the rise of groundwater under natural conditions will last too long time. There-

fore external supply is introduced to the filling procedure (ht=0 = 0) for acceler-

ation.(see figure 5.10)

Adh

dt= VZustr

Solve the ODE with help of the analytical methods.

134

Page 23: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.2. Analytical solution methods

Figure 5.10: Refilling procedure of a remainder hole

7. The following ODE is given:

dh

dt+ k · h = g

with ht=0 = 0, g = 0.015m · s−1 and k = 0.01s−1

Solve the ODE with help of the analytical methods.

135

Page 24: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

5.2.2 Ordinary differential equations of higher order

A general solution of a differential equation with n-th order has n constants and repre-

sents geometrically a n-parametric curve family. For determination of a single solution

from this family we need n initial or boundary conditions.

Example of a2. order equation:

y2y�+y2−1 = 0 is the movement of a particle. The general solution of these differential

equation is (x− C)2 + y2 = 1. This equation stands for all circles of the radius r = 1

with the centre on the x axis. The initial condition y(0) = 1 yields the constant C = 0;

then the single solution is x2+y2 = 1. The particle moves around the circle with radius

r = 1 whose centre is on the origin of the coordinate system.

Different types of higher order differential equation can be solved with different meth-

ods:

5.2.2.1 OED of type a

λ ·d2y

dt2+dy

dt= 0 (5.24)

The degrees of higher order differential equation can be reduced by means of the fol-

lowing substitution:

z =dy

dt(5.25)

The derivative is:dz

dt=d2y

dt2(5.26)

These two equations are inserted into the ODE:

λ ·dz

dt+ z = 0 (5.27)

The solution of this first order homogeneous ODE is given in the previous section (see

section 5.2.1.1, page 125) by:

z = k1e−tλ (5.28)

ordz

dt= −

k1

λe−

tλ (5.29)

136

Page 25: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.2. Analytical solution methods

Due to the substitution condition we get:

z =dy

dtdy

dt= k1e

−tλ

(5.30)

This differential equation can be solved again with the method of the separation of the

variables:

dy

dt= k1e

−tλ

�dy =

�k1e

−tλdt

y = −λ · k1 · e−tλ + k2

(5.31)

Since here two constants exists, two conditions equations must be found. For e−t

functions the values t = 0 and t = ∞ are helpful, since the values for this exponential

function in this case are simple (1 and 0):

k2 = y(∞)

k1 = −y(0)− y(∞)

λ

Then the solution is:

y(t) = (y(0)− y(∞)) · e−tλ + y(∞) (5.32)

Remark: This solution method can be applied also for the differential equation

ad2y

dt2+ b

dy

dt= g(t) (5.33)

The substitution z =dy

dtleads to a linear ODE, which can be solved by the method of

the variation of the constants.

5.2.2.2 ODE of type b

ad2y

dt2+ b

dy

dt+ cy = 0 (5.34)

This differential equation is to be solved according to the Ansatz method. Sense and

purpose of the substitution method are to avoid complicated operations of the inte-

gration of the differential equation and only carry out substantially simple operations

137

Page 26: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

of differentiation. A popular substitution is used here, which looks promising from

the experience. At the beginning all derivatives are developed, which appear in the

differential equation.

Given the following Ansatz and derivatives:

y = C · eλt

dydt

= C · λ · eλt

d2ydt2

= C · λ2 · eλt

(5.35)

Inserted into the differential equation this yields:

�aλ2 + bλ+ c

�· C · eλt = 0 (5.36)

For t �= −∞ we can divide by eλt with the result:

aλ2 + bλ+ c = 0 (5.37)

The standard form of this quadratic equation is:

λ2 +b

aλ+

c

a= 0 or λ2 + dλ+ f = 0 (5.38)

whereby d =b

aand f =

c

a.

This equation is also designated as the characteristic equation of an ODE. The

general solution of this characteristic equation is:

λ1�2 = −d

�d2

4− f (5.39)

Depending upon the coefficients d and f there are three different cases:

1. The first case is, ifd2

4− f > 0 =⇒

d2

4> f or b2 > 2 · c · a.

Then λ1 �= λ2 are real numbers,

λ1�2 = −d

�d2

4− f (5.40)

The solution is then:

y = C1eλ1t + C2e

λ2t (5.41)

The solution of this case is an asymptotic curve, which converges to a steady

state. This steady state is out of a real interval, if λ1 and λ2 are negetive values

138

Page 27: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.2. Analytical solution methods

2. The second case is, ifd2

4− f < 0 =⇒

d2

4< f� or b2 < 2 · c · a.

Then λ1�2 are complex numbers, since the radiant is negative.

λ1�2 = −d2±�

d2

4− f

λ1�2 = −d2±�

(−1)�f − d2

4

λ1�2 = −d2±�

(−1) ·��

f − d2

4

λ1�2 = −d2± j · β

(5.42)

Inserting this solution of the characteristic equation into the substitution function

follows:

y = C1 · e(− d

2+j·β)·t + C2 · e

(− d2−j·β)·t

y = e−d2·t�C1 · e

+j·β·t + C2 · e−j·β·t

�(5.43)

According to the calculation rules for exponential functions the sum of the ex-

ponents can be decomposed into a product of two exponential functions. At the

same time we can consider that the exponential functions with imaginary expo-

nent can be transformed into trigonometric functions.

Thus the solution is:

y = e−d2·t (C1 cos βt+ C2 sin βt) (5.44)

This function represents the general form of the oscillation equation. For special

cases we get sinusoidal oscillations. This is the case, if C1 or C2 are identically

equal to zero. With d = 0 we get an undamped oscillation, i.e. the amplitude is

constant, if d < 0 a damped, with which the amplitude goes to zero, and if d > 0

a swing oscillation.

3. The third case is, ifd2

4− f = 0 =⇒

d2

4= f or b2 = 2 · c · a

In this case the radiant is zero and we get two identically solution:

λ = λ1 = λ2 = −d

2= −

b

2a(5.45)

Thus the solution is no longer unique� We have two different functions, which

solve the ODE:

y1 = Ceλt

y2 = C1teλt + C2e

λt

(5.46)

139

Page 28: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

Examples of second order differential equations:

1. find the solution for the ODE: y�� − y = 0.

ODE : y�� − y = 0

Ansatz : y = eλt

: y� = λeλt

: y�� = λ2eλt

Insertion into the ODE :�λ2 − 1

�eλt = 0

Characteristic equation : λ2 − 1 = 0

Solution of the characteristic equ. : λ1�2 = ±1

general solution : y = C1et + C2e

−t

2. find the solution for the ODE: y + y = 0

ODE :··y + y = 0

·y

Ansatz : y = eλt

:·y = λeλt

:··y = λ2eλt

Insertion into the ODE :�λ2 + 1

�eλt = 0

Characteristic equation : λ2 + 1 = 0

Solution of the characteristic equ. : λ1�2 = ±j

: e±jt = cos t± j sin t

general solution : y = C1 cos t+ C2 sin t

140

Page 29: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.2. Analytical solution methods

3. find the solution for the ODE:··y + 2

·y + y = 0

ODE :··y + 2y� + y = 0

Ansatz : y = eλt

:·y = λeλt

:··y = λ2eλt

Insertion into the ODE : (λ2 + 2λ+ 1)eλt = 0

Characteristic equation : λ2 + 2λ+ 1 = 0

Solution of the characteristic equ. : λ1�2 = −1

general solution : y = C1te−t + C2e

−t

Remarks: This solution method can be likewise used for differential equation of higher

order (n ≥ 3) with the appropriate ansatz of higher order algebraic equations.

Example of 3rd order ODE

1. Find the solution of the ODE:···y +

·y = 0

ODE :···y +

·y = 0

Ansatz : y = eλt

:·y = λeλt �

··y = λ2eλt �

···y = λ3eλt

Insertion into the ODE :�λ3 + λ

�eλt = 0

Characteristic equation : λ3 + λ = λ(λ2 + 1) = 0

Solution of the characteristic equation : λ1 = +j� λ2 = −j� λ3 = 0

General solution : y = C1 + C2 cos x+ C3 sin x

141

Page 30: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

5.2.2.3 ODE of type c

d2y

dt2+

1

t

dy

dt+ y = 0 (5.47)

These ODE we can solve again with the Ansatz method. The ansatz and the deriva-

tives are:

y = 1 + a2t2 + a3t

3 + a4t4

dy

dt= 2a2t+ 3a3t

2 + 4a4t3...

d2y

dt2= 2a2 + 2 · 3a3t+ 4 · 3a4t

2..

If these equations are inserted into the ODE and if the equation is arranged according

to powers of t:

(1 + 2 · 2a2) · t0 + 3 · 3a3 · t

1 + (a2 + 4 · 4a4) · t2 + (a3 + 5 · 5a5) · t

3

+.........+ (an + (n+ 2)2 · an+2) · tn = 0

(5.48)

A solution of this equation, which applies to all t-values, is that the factors of the power

series members are equal to zero.

In this case:

a3 = a5 = a7 = .......a2n+1..... = 0

a2 = −1

22

a4 = −a2

42=

1

2242

a6 = −a4

62= −

1

224262

a2n = −a2n−2

(2n)2= (−1)

2n2

1

22 · 42 · 62 · · · · (2n)2= (−1)

2n2

1

Πnk=1 (2k)2

If we set these coefficients into the solution, then we receive the solution of differential

equation, which are called zero order Bessel function:

y = 1−t2

22+

t4

2242−

t6

224262+ .....+ (−1)

2n2

t2n

Πnk=1 (2k)2

+ ..... = I0(t) (5.49)

142

Page 31: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.2. Analytical solution methods

5.2.2.4 Exercises

Exercises to 5.2.2:

Find the solutions for the following ODE’s:

1. yy�� = y�2

2. y�� − y� = ex

3. y�� + 4y� + a0y = 0 fur a0 = 3� 4� 5

143

Page 32: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.3 Integral transforms

5.3.1 Time- and Frequency domain

An integral transform is a method to solve differential equations over a detour. We

distinguish two ranges in the transformations:

• the original or time domain and

• the complex variable or frequency domain.

The integration according to the arguments within the original range is transformed

into a multiplication in the complex variable domain. The difficult integration proce-

dures can be bypassed. The relations between the ranges and their special character-

istics are represented in the following scheme (see figure 5.11). The most well-known

Figure 5.11: Connection between original and complex variable domain

transformations are the Laplace, the Laplace Carson, the Fourier, the Lau-

rent and the Z transform. The theories of most these transformations can be gleaned

in the multifaceted literature. Therefore here we only deal with the substantial criteria

and disadvantages, which are against general application.

The following transformations are represented on the basis of time as argument, since

these are most frequent applications of engineers, albeit the transformations are appli-

Systems Analysis in Water Management Peter­Wolfgang Graber

Page 33: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.3. Integral transforms

cable to all arguments, i.e. also to space variables.

The group of the integral transforms can be divided into the continuous and discrete

transformations. The continuous integral transforms can be generally written:

F (f(t)) =

2t�

1t

k(t� f(t))f(t)dt (5.50)

Hereby k(t� f(t)) is designated as the kernel of the transform. To keep it simple only

one argument (i.e. t) is regarded.

As special cases the relations specified in table 5.3 are known.

Table 5.3: Special cases in continuous integral transforms

transformkernelk(t� f(t))

lower integrationbound

t1

upper integrationbound

t2

description

e−pt 0(−∞) ∞Laplace-

transform

pe−pt 0(−∞) ∞Laplace-

Carson-transform

e−jωt 0(−∞) ∞Fourier-

transform

The connection between the three mentioned integral transforms can be represented in

the following descriptive form. According to the definition it will be characterized as

complex frequency

p = σ + jω with s = real part and j = imaginary part (5.51)

If the real part of the complex frequency p converges to zero, the Laplace transform

changes into the Fourier transform. It means that arbitrary (theoretical) time pro-

cedure can be treated by means of the Laplace transform, and only sinusoidal one

by means of the Fourier transform. The Laplace transform is particularly suit-

able for application to deadbeat procedures, like e.g. bar signals. Nevertheless the

Fourier transform has a large advantage as it is simpler in practice. Each periodic or

145

Page 34: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

periodization function can be decomposed into a sum of sinusoidal oscillations by the

Fourier series analysis. This decomposition of the excitation functions and overlay of

the response functions are certainly only permitted in linear systems. The well-known

complex computing methods of electro-technology for sinusoidal alternating current

results from the Fourier transform. In the Fourier transformation the density of

such oscillations, the so called spectrum will be analysed and treated by the rule of

alternating current theory with only one sinusoidal oscillation, i.e. only one frequency.

The discrete transformations are in contrast represented by a sum formula:

F (f(t)) =�

n

k(tn� f(tn)) (5.52)

Here we get for the certain k(tn� f(tn)) some well-known special cases (see table 5.4).

Table 5.4: Special cases for discrete transformations

Transformation kernelk(tn� f(tn))

Summation bounds description

e−pn 0 ≤ n <∞discreteLaplace transform

1

zn−∞ < n <∞ Laurent transform

1

zn0 ≤ n <∞ Z transform

We can also explain the connection between Laplace and Z transform in the following

way. Replace in the Laplace integral for continuous functions

F (p) =

∞�

0

f(t)e−ptdt (5.53)

p = σ + jω

the function f(t) by the function value series f(nT ), and the corresponding integral by

an infinite sum and e−pt by e−pnT , then we get:

F (p) = T∞�

n=0

f(nT )e−npT (5.54)

with ept = z follows:

FT (z) = T∞�

n=0

f(nT )z−n = T · F (z) (5.55)

146

Page 35: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.3. Integral transforms

5.3.2 Laplace Transform

5.3.2.1 Forward transformation

The following symbols are used in the Laplace transform:

L {f (t)} = F (p) Laplace transform of the function f(t)

L−1 {F (p)} = L−1 {L {f (t)}} Laplace inverse transform

= f (t)

The transform of time or original domain into the Laplace domain takes place by

means of integral relationship stated above.

F (p) = L {f (t)} =

∞�

0

f(t)e−ptdt (5.56)

p = σ + jω

Examples for the application of the transform to functions:

Example 1:

f(t) = 0 (5.57)

F (p) = L {0} =

∞�

0

0 · e−ptdt = 0

Example 2:

f(t) = 1 (5.58)

F (p) = L {1} =

∞�

0

1 · e−ptdt

= −1

p·�e−pt�∞0

= −1

p· (−1)

=1

p

147

Page 36: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

Example 3:

f(t) = t (5.59)

F (p) = L {t} =

∞�

0

t · e−ptdt

= −

�e−pt

p2(pt+ 1)

�∞

0

=1

p2

There are tabular compositions of the Laplace transform for further basic functions

(see table 5.5, page 151).

5.3.2.2 Important calculation rules

• Addition theorem

L {f1(t) + f2(t)} = L {f1(t)}+ L {f2(t)}

This addition theorem will be proved exemplarily for the other calculation rules.

Hereby we use the definition of the Laplace transform, which is the integral of

the product of the exponential function with the function to transform:

L {f1(t) + f2(t)} =

∞�

0

e−pt(f1(t) + f2(t))dt

=

∞�

0

(e−ptf1(t) + e−ptf2(t))dt (5.60)

=

∞�

0

e−ptf1(t)dt+

∞�

0

e−ptf2(t)dt

According to the definition of the Laplace transform follows:

L {f1(t) + f2(t)} = L {f1(t)}+ L {f2(t)}

General form of the addition theorem

L {λ1f1(t) + . . .+ λnfn(t)} = λ1F1(p) + . . .+ λnFn(p) (5.61)

148

Page 37: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.3. Integral transforms

• Similarity theorem

L {f(at)} =1

aF�p

a

�(5.62)

• Theorem of damping

L�e−atf(t)

�= F (p+ a) (5.63)

• Shift theorem

L {f(t− a)} = e−apF (p)

to right,

positive in the future

L {f(t+ a)} = eap�

F (p)−a�

0

e−ptf(t)dt

to left,

negative in the history

with F (p) = L{f(t)}

Laplace transform

with out shift

(5.64)

• Differentiation

The differentiation rules are the basis for the application of the Laplace trans-

form to differential equations and their solutions.

L {f �(t)} = pF (p)− f(0)

L {f ��(t)} = p2F (p)− f(0)p− f �(0)

L�f (n)(t)

�= pnF (p)− f(0)pn−1 − f �(0)pn−2 − · · · − f (n−2)(0)p− f (n−1)(0)

(5.65)

• Integration

L

t�

0

f(τ)dτ

=

1

pF (p) (5.66)

• Convolution theorem

The convolution operation is important for transmission systems (see section

12.3):

L

t�

0

f1(t− τ)f2(τ)dτ

= L {f1 (t)} · L {f2 (τ)} = F1(p) · F2(p) (5.67)

149

Page 38: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

5.3.2.3 Inverse transformation

For the inverse transformation we use the so called L−1 transform.

L−1 {F (p)} = L−1 {L {f(t)}} = f(t) Laplace inverse transform (5.68)

In principle the following are possibilities can be used:

• Integral formula

f(t) =1

2πj

a+j∞�

a−j∞

L {f(t)} eptdp (5.69)

• Residue formula(decomposition into partial fractions)

f(t) =∞�

n=1

Resp=pn

�L {f(t)} ept

�(5.70)

Hereby pn are singularities in the left, complex half plane and (p− pn) yields the

corresponding poles.

• Series expansion

f(t) =∞�

n=0

anBn (σ0t) with Bn(σot) = e−σ0tLn (2σ0t) (5.71)

Because of this possibility the residue formula is always applicable and easy to handle

for the technical problems.

150

Page 39: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.3. Integral transforms

5.3.2.4 Correspondence table

Since these integrals are relatively complicated and different functions are very often

repeated, arithmetic rules and correspondence tables are set up, from which the

forward transformation and their inverse transformations are easy for reading (see

table 5.5).

Table 5.5: Correspondence table Laplace transform

Nr. F(p) = L{f(t)} f(t) = L−1{F(p)}

1 0 0

2 1p

1

3 1pn

tn�1

(n−1)�

4 1(p−α)n

tn�1

(n−1)�eαt

5 1(p−α)(p−β)

eβt−eαt

β−α

6 p(p−α)(p−β)

β eβt−αeαt

β−α

7 αp2+α2 sinαt

8 α cosβ+p sinβp2+α2 sin(αt+ β)

9 pp2+α2 cosαt

10 p cosβ−α sinβp2+α2 cos(αt+ β)

11 αp2−α2 sinhαt

12 pp2−α2 coshαt

151

Page 40: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

Table 5.5: Correspondence table - continuation

Nr. F(p) = L{f(t)} f(t) = L−1{F(p)}

13 p2+2α2

p(p2+4α2)cos2 αt

14 2α2

p(p2+4α2)sin2 αt

15 p2−2α2

p(p2−4α2)sinh2 αt

16 2α2pp4+4α4 sinαt sinhαt

17 α(p2+2α2)p4+4α4 sinαt coshαt

18 2αp(p2+α2)

t sinαt

19 p2−α2

(p2+α2)2t cosαt

20 2αp(p2−α2)2

t sinhαt

21 1√p

1√πt

22 1p√p

2 1√tπ

23 1√p2+α2

J0(αt) (Bessel function of order 0)

24 1√p2−α2

I0 (αt) (modified Bessel function of order 0)

25 arctan αp

sin(αt)t

26 arctan 2αpp2−α2+β2

2tsin(αt) · cos(βt)

152

Page 41: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.3. Integral transforms

5.3.3 Solution of differential equations by means of

Laplace transform

5.3.3.1 Algorithm

This solution method consists of three sub steps:

• Application of the LAPLACE transformation to the differential equation (or the

differential equation system) with consideration of initial conditions

• Solution of the resulting algebraic equation (or equation system) with F (p) as

unknown quantity

• Inverse transformation of F (p) and determination of the searched function, i.e.

solution function of the differential equation.

5.3.3.2 Examples

Example 1:

Find the solution of the ODE y(t) + y(t) = 1 with the initial conditions y(0) = 1 and

y(0) = 0:

• application of the Laplace transform:

ODE : y(t) + y(t) = 1

Laplace transform : L {y(t) + y(t)} = L {1}

Addition theorem : L {y(t)}+ L {y(t)} = L {1}

Transforming : p2F (p)− f(0)p− f �(0) + F (p) =1

p

Initial conditions : p2F (p)− p+ F (p) =1

p

153

Page 42: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

• Solution of the resulting algebraic equation with F (p):

�p2 + 1

�F (p) =

1

p+ p

�p2 + 1

�F (p) =

p2 + 1

p

F (p) =1

p

• Inverse transformation and determination of y(t) by means of the correspondence

table (see table 5.5, Page 151, row 2):

y(t) = L−1 {F (p)} = L−1

�1

p

= 1

Example 2:

Find the solution of the ODE y− 3y+2y = 2e−t by applying the Laplace transform.

The initial conditions are y(0) = 2 and y(0) = −1.

• applications of the Laplace transform:

ODE :··y − 3

·y + 2y = 2e−t

Laplce transform : L�··y − 3

·y + 2y

�= L

�2e−t

Addition theorem : L�··y (t)

�+ L

�−3

·y�

+ L {2y (t)} = L�2e−t

Transforming : p2F (p)− f (0) p− f � (0)

: − 3pF (p) + 3f (0) + 2F (p) =2

p+ 1

Initial conditions : p2F (p)− 2p+ 1− 3pF (p) + 6 + 2F (p) =2

p+ 1

• Solving the algebraic equation according to F (p):

�p2 − 3p+ 2

�F (p) =

2

p+ 1+ 2p− 7

F (p) =2 + (2p− 7) (p+ 1)

(p2 − 3p+ 2) (p+ 1)

154

Page 43: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.3. Integral transforms

• Inverse transform and determination of y(t):

The inverse transform is achieved in this case via expansion into partial fractions.

The zero positions of the denominator polynomial are searched and expressed as

sum product. In the case under consideration the denominator is equal to zero,

if:

p+ 1 = 0 =⇒ p1 = −1

p2 − 3p+ 2 = 0 =⇒ p2�3 = −

�−3

2

±

��−3

2

�2

− 2

p2 = +1, p3 = +2

The equation for F (p) can be written:

F (p) =2p2 − 5p− 5

(p+ 1)(p− 1)(p− 2)

Then the partial fraction is:

2p2 − 5p− 5

(p+ 1) (p− 1) (p− 2)=

A

p+ 1+

B

p− 1+

C

p− 2

A common denominator (p + 1)(p − 1)(p − 2) should be used to determine the

factors A, B and C:

2p2 − 5p− 5

(p+ 1) (p− 1) (p− 2)=A(p− 1)(p− 2) + B(p+ 1)(p− 2) + C(p+ 1)(p− 1)

(p+ 1)(p− 1)(p− 2)

This equation is fulfilled only when apart from the denominators the numerators

are also same, i.e.:

2p2 − 5p− 5 = A(p− 1)(p− 2) + B(p+ 1)(p− 2) + C(p+ 1)(p− 1)

2p2 − 5p− 5 = (A+ B + C)p2 + (−3A− B)p+ (2A− 2B − C)

It must be an identity and valid for all p values. That means the coefficients of

the power series of p are identical in each case. And we get follows:

p2 2 = A+ B + C

p1 −5 = −3A− B

p0 −5 = 2A− 2B − C

155

Page 44: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

This LES can be solved by the known methods, so the solution is:

A =1

3� B = 4� C = −

7

3

Then F (p) can be written in the following way:

F (p) =1

1

p+ 1+ 4 ·

1

p− 1−

7

1

p− 2

The inverse transform is to be read from the correspondence table (see table 5.5,

page 151, line 4) It is:

L−1

�1

(p− a)n

=tn−1

(n− 1)�eat for n = 1

L−1

�1

(p− a)1

= eat

for a1 = −1, a2 = 1, a3 = 2 gilt

L−1 {F (p)} = y (t) =1

3· ea1t + 4 · ea2t −

7

3· ea3t

y (t) =1

3e−t + 4et −

7

3e2t

Remark:

The same procedure can also be used for the solution of linear ODE systems with

constant coefficients.

5.3.3.3 Example of ODE systems

Find the solution of the ODE system:

··x = −

·y

··y =

·x

with the initial conditions x(0) = 0, x(0) = 1, y(0) = 0, y(0) = 0.

• application of the Laplace transform:

With F (p) = L {x (t)} and G (p) = L {y (t)} the application of the Laplace

156

Page 45: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.3. Integral transforms

transform to the system yields (under consideration of the initial conditions):

p2F (p)− 1 = −pG (p)

p2G (p) = pF (p)

• Solving the linear equation according to F (p), G(p):

According to the known rules or simple transformation, e.g. from the 2nd. equa-

tion:

G (p) =1

pF (p)

Insert in the equation : p2F (p)− 1 = −F (p)

Resolve to F (p) : F (p) =1

p2 + 1

G (p) =1

pF (p) =

1

p (p2 + 1)

• Inverse transform and derivation of x(t), y(t) with help of the correspondence

table (see table 5.5, page 151, row 3 and 7)

x (t) = L−1 {F (p)} = L−1

�1

p2 + 1

= sin t

y (t) = L−1 {G (p)} = L−1

�1

p (p2 + 1)

= L−1

�1

p−

p

(p2 + 1)

= 1− cos t

157

Page 46: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

5.3.3.4 Exercises to the integral transforms

Exercises to 5.3:

1. Solve the following ODE’s with the Laplace transform:

(a) y�(x) + y = 0 withy(x) = f(0) · e−x

f(0) = 1 → initial condition

(b) y��(t)− 3y�(t) + 2y(t) = 4 withy(0) = 1

y�(0) = 0

(c) y��(t) + 16y(t) = 32t withy(0) = 3

y�(0) = −2

(d) y��(t) + 4y�(t) + 4y(t) = 6e−2t withy(0) = 3

y�(0) = 8

(e) y���(t) + y�(t) = t+ 1 with

y(0) = 1

y�(0) = 1

y��(0) = 1

2. Solve the following equation systems with the Laplace transform:

(a)y�(t) + x(t) = 0

x�(t) + y(t) = 1

withx(0) = 0

y(0) = 0

(b)2x(t)− y(t)− y�(t) = 4(1− e−t)

2x�(t) + y(t) = 2(1 + 3e−2t)

withx(0) = 0

y(0) = 0

3. For the following hydraulic scheme (see figure 5.12) and the corresponding block

158

Page 47: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.3. Integral transforms

diagram applies the ODE

hFl = R · CdzRdt

+ zR

Linearized conditions and a homogeneous, isotropic aquifer are assumed and the

following parameters are given:

k = 5 · 10−4ms, n0 = 0� 2, zRmittel

= 20m, l = 50m

Compute the change of the water level with the Laplace transform, if the river

Figure 5.12: Schematic representation of the groundwater level

surface changes as a first approximation as follows:

a) erratic (hfl = hfl0 · 1(t))

b) sinusoidal (hfl = hfla sin(ω · t), with ω = 2π/τ and τ = 7 days).

(only the difference to the steady state shall be taken into account�)

4. For the concentration C in sorption of pollutants at the sail matrix applies the

ODE:

T1C + C = K

Hereby T1 is a time constant and K a constant. T1 = 1d−1, K = 100

The concentration change at time t = 0 shall be C(0) = 0.

a) Solve the ODE with the Laplace transform and compute the concentration

change at time t = 1d.

b) Sketch the principle time process of the concentration change.

5. The padding to the remainder holes of the former brown coal open pit caused by

the rise of groundwater under natural conditions will last too long time. Therefore

external supply is introduced to the filling procedure (ht=0 = 0) for acceleration

(see figure 5.13). The corresponding differential equation is:

Adh

dt= VZustr

159

Page 48: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

Transfer this differential equation by means of the Laplace transform in the

image domain and solve this equation.

Figure 5.13: filling procedure of a remainder hole

6. Given the following ODE:dh

dt+ k · h = g

ht=0 = 0, g = 0� 015m · s−1 and k = 0� 01s−1

Solve this ODE with the Laplace transform.

160

Page 49: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.4 Methods for Numerical Integration

5.4.1 Integration

The numerical integration always yields the result of a certain integral between an upper

and a lower limit. In a variable is inserted at the upper limit of the integral, the certain

integral changes into a function, which is determined by the lower limit and the variable

at upper border. The integral of a function, which can be also displayed as the area

between the upper and lower limit and the abscissa, can be approximated by a simplified

area computation. The numerical integration procedures differ with each other in the

method of area computation. In most procedures it is assumed that total area between

the upper and lower limit is divided into individual sub-area and the summation of

these sub-areas yields the integral. The accuracy strongly depends on the method of

sub-area creation and the quantization width of the abscissa. The approximation by

summation of sub-areas will be worst with rectangle method and will be best with

Predictor Corrector procedure or with higher order Runge Kutta procedure with

the same quantization increment. The advantage of the trivial procedures exists in

the simple, fast and stable computation of the sub-areas also in complicated, e.g.

discontinuous function.

5.4.1.1 Rectangle rule

The rectangle rule as the simplest method assumes the creation of rectangles as sub-

area (see figure 5.14). The area of the rectangles results from the multiplication of the

function value (yn) on the left supporting place (xn) with the quantization increment

Δx = |xn − xn+1|.

A substantial advantage of the rectangle method is no equidistant quantization neces-

sary for the abscissa:

Fleft =

b�

a

y(x)dx ≈m−1�

n=0

(|xn+1 − xn|)yn (for m supintervals) (5.72)

We can use the function value on the right side instead of on the left.

Then the area is computed by:

Fright =

b�

a

y(x)dx ≈m−1�

n=0

(|xn+1 − xn|)yn+1 (5.73)

Peter­Wolfgang Graber Systems Analysis in Water Management

Page 50: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

Figure 5.14: creation from rectangles to the numerical integration

The correct value of the integral has to be in between Fleft and Fright.

Examples for application of rectangle rule:

1. We calculate the integral

� 2

1

1

xdx according to the table by using the rectangle

rule (left and right) and compare the result with the analytical result:

� 2

1

1

xdx = ln 2 = 0� 693

x 1,0 1,2 1,4 1,6 1,8 2,0

1

x1,000 0,833 0,714 0,625 0,556 0,500

The increment is regarded as constant, h = Δx = 0� 2.

Flinks = 0� 2 (1� 000 + 0� 833 + 0� 714 + 0� 625 + 0� 556) = 0� 746

Frechts = 0� 2 (0� 833 + 0� 714 + 0� 625 + 0� 556 + 0� 500) = 0� 646

f (x) =1

xis a monotonically increasing function, so Flinks > Fanal > Frechts. The

162

Page 51: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.4. Methods for Numerical Integration

average of the two results is:

Faverage =0� 746 + 0� 646

2= 0� 696

Fanalytic = 0� 693

This value approaches to the actual analytical value.

Remark:

The increment plays an important role for exact determination of the integral.

The smaller it is, the more approaches the numerical value to the analytical, i.e.

the numerical value converges. This is not only valid for rectangle rule, but for

all numerical methods.

2. We calculate the integral

� 2

1

1

xdx with an increment h = 0.1 and the values in

table and compare the results with example 1.

x 1

xFleft Fright

1� 0 1� 000 1� 000

1� 1 0� 909 0� 909 0� 909

1� 2 0� 833 0� 833 0� 833

1� 3 0� 769 0� 769 0� 769

1� 4 0� 714 0� 714 0� 714

1� 5 0� 667 0� 667 0� 667

1� 6 0� 625 0� 625 0� 625

1� 7 0� 588 0� 588 0� 588

1� 8 0� 556 0� 556 0� 556

1� 9 0� 526 0� 526 0� 526

2� 0 0� 500 0� 500

sum 7� 187 6� 669

163

Page 52: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

Flinks = 0� 1 · (7� 187) = 0� 719

Frechts = 0� 1 · (6� 669) = 0� 667

Fmittel = 0� 694

It is clear to notice that all the three values, which are calculated with increment

0.1 , lie closer to the analytical value Fanalytic = 0.693 than in example 1 with an

increment of 0.2 .

5.4.1.2 Trapezoidal rule

The approximation by polynomials plays an important role in a multitude of proce-

dures. The basic idea is that, if p(x) is an approximation for y(x), then� bap(x)dx ≈

� bay(x)dx.

Different situations are dependent on the selected approximation.

With the trapezoidal rule the function between the supporting places xn and xn+1 is

linear interpolated (see figure 5.15). Thus the wanted area is divided into trapezoid

areas, which are calculated geometrically:

I = ha+ b

2oder I = |xn − xn−1|

yn + yn−1

2(5.74)

By summation of the sub-areas:

F =

b�

a

y (x) dx ≈m�

n=0

(|xn − xn+1|)

�yn + yn+1

2

(for m subintervals)

(5.75)

In the case of equidistant division the computation of Δx can be simplified:

F =

b�

a

y (x) dx ≈m�

n=0

Fn = Δx ·m−1�

n=0

(yn+1) +Δx

2(yo + ym) (5.76)

In the trapezoidal rule we have another simple possibility to take in account irregular

increment, i.e. not equidistant quantization.

164

Page 53: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.4. Methods for Numerical Integration

Figure 5.15: Numerical integration by means of trapezoidal rule

5.4.1.3 Simpson’ rule

The Simpson’ rule is:

F =

x2k�

x0

f(x)dx =h

3(y0 + 4y1 + 2y2 + 4y3 + . . .+ 2y2k−2 + 4y2k−1 + y2k) (5.77)

It is likewise a compound formula as parabolic arcs are used instead of y(x).

Remark:

• the supporting places must be equidistant (constant increment h).

• the number of supporting places xn must be odd (n = 0 . . . 2k).

5.4.1.4 Newton formula

In this method the Newton interpolation function (also see 3.1.3, page 81) will be

integrated with following results:

165

Page 54: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

Equation

number of

supporting

points

interpolation

method

� x1

x0p (x) dx =

h

2(y0 + y1) 2 linear

� x2

x0p (x) dx =

h

3(y0 + 4y1 + y2) 3 quadratic

� x3

x0p (x) dx =

3h

8(y0 + 3y1 + 3y2 + y3) 4 cubic

5.4.1.5 Examples for application of numerical integration

We use trapezoidal rule and Simpson rule in order to determine the integral� π/2

0sin x ·

dx from the following table. Compare the results with the analytical value Ianalytic = 1.

x 0π

12

12

12

12

12

π

2

sin x 0 0� 259 0� 500 0� 707 0� 866 0� 966 1� 000

Trapezoidal rule

Itr =π

12(0 + 0� 259 + 0� 5 + 0� 707 + 0� 866 + 0� 966 + 0� 5) = 0� 994

Simpson rule

Is =π

3 · 12(0 + 4 · 0� 259 + 2 · 0� 5 + 4 · 0� 707 + 2 · 0� 866 + 4 · 0� 966 + 1) = 1� 000

Obviously the adjustment of quadratic polynomials yields one up to three decimal

places exact result.

166

Page 55: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.4. Methods for Numerical Integration

Newton interpolation function

1. linear

INl =π

2 · 12

(0 + 0� 259)+

(0� 259 + 0� 500)+

(0� 500 + 0� 707)+

(0� 707 + 0� 866)+

(0� 866 + 0� 966)+

(0� 966 + 1� 000)

= 0� 994

2. quadratic

INq =π

3 · 12

(0 + 4 ∗ 0� 259 + 0� 500)+

(0� 500 + 4 ∗ 0� 707 + 0� 866)+

(0� 866 + 4 ∗ 0� 966 + 1� 000)

= 1� 00003

3. cubic

INk =3 · π

8 · 12

(0 + 3 ∗ 0� 259 + 3 ∗ 0� 500 + 0� 707)+

(0� 707 + 3 ∗ 0� 866 + 3 ∗ 0� 966 + 1� 000)

= 1� 00006

Apparently the adjustment of quadratic polynomials yields one up to three decimal

places exact result.

Remark:

The accuracy of numerical methods must be always relating to the significant number

of computed and represented places. If we solve e.g. the same problem with seven

167

Page 56: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

digits of significant number, then the Simpson’s rule yields I = 1.000003 , which does

not match the analytical value of Ianalytic = 1 .

168

Page 57: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.4. Methods for Numerical Integration

5.4.1.6 Exercises for the application of the numerical

integration

Exercises to 5.4.1:

1. Compute the given integral by using the trapezoidal rule with increment h = 0.1

and h = 0.01.

I =

1�

0

dx

1 + x

2. Calculate the following integrals. Use at least two numerical methods and two

different increments and then compare the results:

a)

1�

−1

e(−x)2dx b)

2�

1

ex

xdx

3. Calculate the integral

I =

1�3�

1

√xdx

with the rectangular rule, trapezoidal rule and the three Newton formulae and

compare the results.

4. Calculate the integral

I =

10�

1

1

xdx

by approximation.

Choose h = 1. Use the Simpson’s rule for the interval [1� 9] and the trapezoidal

rule for the interval [9� 10].

5. A measurement series of the specific heat c of Al2O3 depending on the tempera-

ture T is listed in the table.

Determine the amount of heat

Q =

1000�

−200

c(T) dT

which must be supplied to a gram Al2O3 , in order to warm it up from −200oC

to 1000oC.

The integration is to be accomplished numerically according to

169

Page 58: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

a) trapezoidal rule

b) Simpson’s rule

with the increment h = 200oC.

T [oC] −260 −200 −100 0 100 200 300 400 600 800 1000

c[ cg∙�

] 0 0� 04 0� 012 0� 18 0� 22 0� 24 0� 25 0� 26 0� 27 0� 275 0� 28

6. In a pumping test the groundwater level were measured (see figure 5.16).

Calculate the water deficit (volume) of the sinking funnel, if the aquifer is of

following characteristic values:

hn = 16m, M = 10m, k = 0� 001m · s−1, S0 = 0� 0001m−1, n0 = 0� 20

Use the methods of numerical integration.

Figure 5.16: groundwater level as a function of the radius

170

Page 59: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.4. Methods for Numerical Integration

5.4.2 Numerical Solutions of Differential Equations

While the solutions of definite integrals were in the foreground in the former sections,

the Euler’s method, the Runge Kutta method and the Predictor Corrector

method are used now to solve ordinary differential equations. In contrast to analytical

methods numerical methods always assumes boundary conditions, i.e. the initial and

boundary conditions. Particularly in 1st. order differential equation the initial values

are supposed, which leads to the concept of initial value problems.

The 1 st. order differential equation

dy

dx= f(x� y) (5.78)

with the initial condition at the point x = a and the function value y(x=a) = ya leads

by integration in the range x = a bis x = b to:

b�

a

dy

dxdx =

b�

a

f(x� y)dx (5.79)

[y]ba =

b�

a

f(x� y)dx

yb = ya +

b�

a

f(x� y)dx

Thus we obtain the wanted function value yb in the place x = b from the function value

at the beginning point plus the definite integral of function y (see figure 5.17). The

problem now is the function y is unknown. For this reason approximation solutions

must be again used for the integral as described in the former section. The following

methods differ from the application of approximation methods.

These methods can be improved if this approximation is only applied in sections and

then iteratively expanded to the whole integration interval (see figure 5.18).

171

Page 60: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

Figure 5.17: Computation of the function value y(b) from the initial value y(a)

y1 ≈ ya +

xn�

a

f(x� y)dx (5.80)

yn+1 ≈ yn +

xn+1�

xn

f(x� y)dx (5.81)

yb ≈ ym +

b�

xm

f(x� y)dx (5.82)

We recognize that the writing ways of integration limits could be synonymous: lower

limit: x = a or x = xnupper limit: x = b or x = xn+1

The subscript is usually used for the intermediate intervals and the advantage is that

it can be easily converted into programming language.

5.4.2.1 Euler method

The Euler method is the simplest method and actually the integral is approximately

determined by means of the rectangle formula. The greater the distance between a

and b, i.e. the increment h or Δx, the worse the approximation is.

172

Page 61: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.4. Methods for Numerical Integration

Figure 5.18: iterative solution of the differential equation

h = b− a

Δxn = xn+1 − xn

Thus we get the following solution

yb = ya +

b�

a

f(x� y)dx ≈ ya + f(a� ya) · (b− a) (5.83)

≈ ya + f(a� ya) · h (5.84)

yn+1 = yn +

xn+1�

xn

f(x� y)dx ≈ yn + f(xn� yn) · (xn+1 − xn) (5.85)

≈ yn + f(xn� yn) ·Δxn (5.86)

In this method it is possible to work with different increments, i.e. with a not equidis-

tant division. It is also suitable for an automatic increment control, because the error,

which results from the approximation, is dependent on the slope of the function y and

173

Page 62: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

on the increment (b− a) = Δx. Inserting it into equation above, we get:

yb = ya +

b�

a

f(x� y)dx ≈ ya +

����dy

dx

����x=a

· (b− a) (5.87)

Example for application of the Euler’s method �also see figure 5.19):

An approximation solution for the differential equation y� = xy1/3 with y(1) = 1 is

looked for.

The Euler formula can be also written in the form:

yn+1 = yn + h · y�n

yn+1 = yn + Δxn · xn · y1/3n

yn+1 = yn + (xn+1 − xn) · xn · y1/3n

The stop error O(h2), which is produced in the interval xn to xn+1, is rather larger

in the Euler method (i.e. proportinal to h2), so that for a high accuracy very small

increments h are necessary. E.g. for h = 0� 01:

y1 ≈ 1 + (0� 01) 1 = 1� 0100

y2 ≈ 1� 0100 + (0� 01) (1� 01) (1� 0033) ≈ 1� 0201

y3 ≈ 1� 0201 + (0� 01) (1� 02) (1� 0067) ≈ 1� 0304

The stop error in each interval is about 0.00007. The fourth decimal place should

be considered with caution. If we want a higher accuracy, a smaller increment h is

necessary.

The analytical values are

y1 = 1� 01007

y2 = 1� 02027

y3 = 1� 03060

174

Page 63: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.4. Methods for Numerical Integration

Figure 5.19: result development with the Euler method

5.4.2.2 Runge Kutta method

The Runge Kutta method assumes the same approach, the approximation of the

integral by area calculation, as Euler method. The difference lies in the degree of

the approximation function for area calculation, which is linear in the Euler method.

Here with the Runge Kutta method a higher order polynomial is used according to

Taylor series expansion.

yb = ya + y�

a · h+ y��

a ·h2

2�+ y

���

a ·h3

3�+ y

����

a ·h4

4�+ . . . (5.88)

with h = |b− a|

Depending upon degrees of the considered derivative in the Taylor series we distin-

guish Runge Kutta method in different n-th orders.

In the following subscript way of writing is used, as the entire integration interval (a to

b) is mostly decomposed into subintervals and additionally this way will be converted

in programming technique in practice.

yn+1 = yn + kn (5.89)

175

Page 64: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

TheRunge Kuttamethods differ in the way of kn determination. In this classification

the Euler method can be arranged:

kn = Δxn · f (xn� yn)

Δxn = |xn+1 − xn|

The simplest procedure, which differs from Euler method in respect of accuracy, is

the 2nd order Runge Kutta method:

yn+1 = yn + k2 (5.90)

with k1 = Δxn · f (xn� yn) (5.91)

k2 = Δxn · f

xn +1

2h� yn +

1

2k1

(5.92)

Δxn = |xn+1 − xn|

The error of this method grows proportionally with h power 3 (0(h3)) and is one power

better than Euler method (0(h2)).

The 4th order Runge Kutta method is frequently used, which is a good compromise

between accuracy and numerical expenditure.

For the general form:

yb = ya + k (5.93)

we write:

k =1

6· (k1 + 2 k2 + 2 k3 + k4) (5.94)

k1 = h · f (a� ya)

k2 = h · f

a+h

2� ya +

k1

2

k3 = h · f

a+h

2� ya +

k2

2

k4 = h · f (a+ h� ya + k3)

mit h = |b− a|

176

Page 65: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.4. Methods for Numerical Integration

The error of this procedure is of 5th order (0(h5)). Here also for improvement of the

accuracy we can divide the total interval of a to b into subintervals xn with yn and

iteratively solve yb. Since we cannot change the increment within the subintervals, it

is possible to control increment as a function of gradients:

y2 = ya +1

6(k1�1 + 2k2�1 + 2k3�1 + k4�1) (5.95)

...

yn+1 = yn +1

6(k1�n + 2k2�n + 2k3�n + k4�n)

...

yb = yb−Δxn+

1

6(k1�b−Δxn

+ 2k2�b−Δxn+ 2k3�b−Δxn

+ k4�b−Δxn)

If n = 1, it yields

Δxn = |xn+1 − xn|

k1�n = Δxn · f (xn� yn) (5.96)

k2�n = Δxn · f

xn +Δxn2

� yn +k1

2

k3�n = Δxn · f

xn +Δxn2

� yn +k2

2

k4�n = Δxn · f (xn + Δxn� yn + k3)

Example for application of the Runge Kutta method:

An approximation solution for the differential equation y� = xy1/3 with y (1) = 1 is

looked for. With x0 = 1 and h = 0� 1 we get a 4th order Runge Kutta formula (see

equation 5.96):

k1 = 0� 1 · f (1� 1) = 0� 1

k2 = 0� 1 · f (1� 05; 1� 05) = 0� 10672

k3 = 0� 1 · f (1� 05; 1� 05336) = 0� 10684

k4 = 0� 1 · f (1� 1; 1� 10684) = 0� 11378

177

Page 66: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

We calculate:

y1 = 1 +1

6(0� 1 + 0� 21344 + 0� 21368 + 0� 11378) = 1� 10682

The analytical value is y = 1� 10326. The corresponding value with the Euler mehtod

is y = 1� 01, i.e. the Runge Kutta method yields better results. However the

increment must be likewise smaller selected if a higher accuracy is demanded.

5.4.2.3 Predictor Corrector Method

The Predictor Corrector method is a two-step procedure. In the first step an auxiliary

value y∗b is computed and then yb. Thus an increased numerical expenditure develops,

but the accuracy rises substantially compared to one-step method. Besides Runge

Kuttamethod Predictor Corrector method represents the most substantial integration

procedure. The predictor step in the simplest form, like in the Euler method, a

rectangle formula for the computation of the integral is used:

y∗b = ya +

b�

a

f(x� y)dx ≈ ya + f(a� ya) · (b− a) (5.97)

We can also write:

y∗b = ya +

b�

a

f(x� y)dx ≈ ya +dy

dx

����x=a

· (b− a) = ya + y�

a(b− a) (5.98)

The difference is that in the predictor step the wanted value yb will not be computed,

but as a first approximation of the value y∗b is regarded. As the second step, the

corrector step, the integral will be calculated by the trapezoid formula, while the value

y∗b is used as upper value in the trapezoid formula:

yb = ya +(b− a)

2· (f(a� ya) + f(b� y∗b )) (5.99)

Similar to the predictor step here the basis of output differential equation can be

formulated:

yb = ya +(b− a)

2·�y�

a + y∗�

b

�(5.100)

178

Page 67: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.4. Methods for Numerical Integration

Also this procedure can be expanded to n subintervals of the range a to b and computed

iteratively. Then the predictor and the corrector step for the n+ 1th interval is:

y∗n+1 = yn + Δx · (f(xn� yn)) = yn + Δx · y�

n

yn+1 = yn +Δx

2·�f(xn� yn) + f(xn+1� y

∗n+1)

�= yn +

Δx

2·�y�

n + y∗�

n+1

�(5.101)

with Δx = |xn+1 − xn|

A series of procedures were developed. The above procedure possesses the disadvan-

tage that there is a relative large residue, i.e. a residual value error, which grows

proportionally with Δx2 (O(Δx2)). The advantage lies in a relatively simple incre-

ment control, only the value f(xn+1; y∗n+1) or the derivative of yn+1 is to be computed.

A very widespread Predictor Corrector method is the Adam Bashforth Moulton

scheme. This method is very stable. In contrast to the simple Predictor Corrector

method several supporting places of integration steps are needed here. Thus the ap-

proximation area will not be made a rectangle any longer, but poly-line is used for

boundary. The frequently used 3rd order Adam Bashforth:

For the predictor step:

y∗�

n+1 = yn +Δx

12(5 f(xn−2� yn−2)− 16f(xn−1� yn−1) + 23 f(xn� yn)) (5.102)

= yn +Δx

12

�5y

n−2 − 16y�

n−1 + 23y�

n

Then the corrector step is:

yn+1 = yn +Δx

12

�−f(xn−1� yn−1) + 8f(xn� yn) + 5f(xn+1� y

∗�

n+1)�

(5.103)

= yn +Δx

12

�−y

n−1 + 8 y�

n + 5y∗�

n+1

This method yields a residue, grows proportionally with 4th power of Δx (∼ Δx4), i.e.

O(Δx4). The disadvantage is that the intervals n−1 and n−2 must be calculated again

if changing increment for the interval n. So it is necessary to calculate the intervals n,

n− 1 and n− 2 with the same increment Δx. This can lead to an increased numerical

expenditure when strong gradient oscillation.

179

Page 68: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

Example for application of the Predictor Corrector method: An approxima-

tion solution for the differential equation y� = xy13 with y(1) = 1 is looked for. The

accuracy ε ≤ 10−5. For each forward step the simple Euler formula is used as a

predictor. It presupposes a first estimation of yn+1. Here x0 = 1 and h = 0.05.

y (1� 05) ≈ 1 + 0� 05 · 1 = 1� 05

Then the differential equation is:

y� (1� 05) = 1� 05 · 1� 0513 = 1� 0661

The Euler formula will be modified for Corrector (according to trapezoidal rule):

yn+1 = yn +1

2h�y�n + y�n+1

It yields:

y (1� 05) ≈ 1 + 0� 025 (1 + 1� 0661) = 1� 05165

With this new value of the differential equation y�(1.05) will be corrected to 1.0678;

afterwards the corrector is used again and yields the result:

y (1� 05) ≈ 1 + 0� 025 (1 + 1� 0678) = 1� 0517

Further calculations confirm these four decimal places, so that the desired accuracy is

reached. It is noticed that the same accuracy can be achieved with increment h = 0.01

in simple Euler formula.

Generally we iterate until it converges if it exists. Afterwards we can continue with

the next interval in order to start again with a simple predictor formula.

180

Page 69: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

5.4. Methods for Numerical Integration

5.4.2.4 Exercises to numerical solutions of ODE

Exercises to 5.4.2:

1. Solve the following differential equation with numerical methods by using few

intervals to x = 1, i.e. 0� 5; 0� 2 and 0� 1.

y� = −xy2 mit y(0) = 2

a) Use the simple Euler method. Converge the results to the analytical value

y(1) = 1?

b) Use the Runge Kutta method of 4th order and a predictor corrector

method and compare the results

2. Solve the differential equation

dx

dt+ t2x = 0 mit x(0) = 3

at the time t = 3 with the Euler method. Use the increments Δt = 0� 1; 0� 05

and 0� 01.

3. Solve the differential equation

tdx

dt− x = t2 cos t mit x(

π

2) = π

for the time t = 2π by the Euler method. Use the increments Δt = 0� 1π and

Δt = 0� 05π.

4. The following differential equation applies to the concentration C [mg] in sorption

of pollutants at the soil matrix:

T1C+C = K

T1 is a time constant and K a constant. T1 = 1d−1, K = 100

The concentration at t = 0 is C(0) = 0.

a) Solve the ODE with the Euler method (h = 0� 1d) and calculate the con-

centration for the time t = 1d.

b) Outline the time process of concentration change.

181

Page 70: Ordinary differential equations - TU Dresden · The water level in the container is described by a homogeneous ordinary differ-ential equation of first order. To solve such equations

CHAPTER 5. ORDINARY DIFFERENTIAL EQUATIONS

5. The padding to the remainder holes of the former brown coal open pit caused by

the rise of groundwater under natural conditions will last too long time. Therefore

external supply is introduced to the filling procedure (ht=0 = 0) for acceleration

(see figure 5.20).

Set up the differential equation for the filling up procedure h(t), without consid-

eration of the aquifer and contingent groundwater formation rate. Describe the

solution by means of numerical methods.

Figure 5.20: filling procedure of a remainder hole

6. Following ODE is given:dh

dt+ k · h = g

with ht=0 = 0, g = 0� 015m · s−1 und k = 0� 01s−1

Solve the ODE with numerical methods.

182