Text(Lec7_txt file

advertisement

2001/02: Lecture 7. Computational methods for solution of differential equations:

Initial value problem:

Euler method,

Runge-Kutta method;

Two-point boundary value problem:

 “Shooting method”,

Finite difference method.

Laplas Transform

Fourier Series and Fourier Transforms x

  f ( t , x ), x

R n

, f ( t , x )

R n

Non-autonomous system of n first ordinary differential equation (right hand side explicitly depends of time). We will consider autonomous system (adding one more variable, we can transform non-autonomous system to autonomous one): x

  f ( x ), x

R n

, f ( x )

R n

We will write formulas for numerical solutions in one-dimensional case ( n =1) but the formulas are the same for general case.

Initial value problem: x

  f ( x ), x

R n

, f ( x )

R n x ( 0 )

 u

Euler’s method

is a small time step.

Taylor series: x (

)

 x ( 0 )

 x

   x

2 !



 2  x

3 !



 3 

...

Using this formula for only the first two terms x ( 0 )

 x

0

 u ; x (

)

 x

1

 x

0

 f ( x

0

)

; x ( 2

)

 x

2

 x

1

 f ( x

1

)

;

...

x ( k

)

 x k

 x k

1

 f ( x k

1

)

;

Error for each step is about

 2

.

1

Using more terms in the Taylor series: x

( t )

 f ( x ( t ))

( x

( t ))'

 f

( x )

 x

  x

  x (

)

 x ( 0 )

 f ( x ( 0 ))

  f

( x ( o )) f ( x ( 0 ))

2

2 x ( 0 )

 x

0

 u ; x (

)

 x ( 2

)

 x

1 x

2

 x

0 x

1

 f f

( x

0

)

( x

1

)

 f f

( x

0

)

( x

1

) f f

( x

0

)

2

2

( x

1

)

2

2

;

;

...

f

( x ) f ( x ) x ( k

)

 x k

 x k

1

 f ( x k

1

)

  f

( x k

1

) f ( x k

1

)

2

2

;

Error for each step is about

3

.

Improved Euler’s method

At first consider one-half step x (

/ 2 )

 x

1 / 2

 x

0

 f ( x

0

)

2

.

/ 2 according to the Euler’s formula:

Let start again from x , go the full step

0

forward but use the slope at x (

)

 x

1

 x

0

 f ( x

1 / 2

)

.

Let estimate the difference between exact solution x (

) x :

1 / 2

and the numerical solution x :

1 f ( x

1 / 2

) x

1

 x

0

 f f ( x

0

( x

1 / 2

)

 f

( x

0

)

  x

0 x

0

/ 2 )

 f ( x

0

)

 f

( x

0

)

[ f ( x

0

)

 

/ 2 ]

 f ( x

0

)

 x

( 0 )

 f

( x

0

) f ( x

0

)

2

2

 x



( 0 )

2

2

O (

3

)

O (

3

)

O (

2 ) .

The last formula shows that three terms of the numerical solution coincide with three terms of Taylor series for the exact solution. Hence, the difference (error) between the exact solution and the numerical solution is about

 3 . The improved Euler’s method needs two calculations of the function f ( x ) per each step: x k

 1

2

 x k

 f ( x k

)

, x k

1

 x k

 f x

  k

 1

2

, x k

 x (

 k ), k

0 , 1 , 2 ,...

2

Runge-Kutta methods

There are many variants of the Runge-Kutta method for numerical solving of initial value problem. The most widely used one is the following: g

1

 f ( x k

), g

2

 f ( x k

 g

1

 

/ 2 ), g

3 g

4

 f f

( x k

( x k

 g

2 g

3

 

),

/ 2 ), x k

1

 x k

6

 g

1

2 g

2

2 g

3

 g

4

.

This process may be described in geometric terms.

At point x k

we compute the slope g

1

and

 using it, we go one-half step forward and examine the slope there ( g

2

).

Using this new slope g

2

, we again start at x k

, go one-half step forward, and again sample the slope ( g

3

).

Using this latest slope g

3

, we again start at x , but this time we go a full step k forward where we examine the slope g

4

.

The four slopes are averaged, using the weights 1/6, 2/6, 2/6, 1/6, and using this averaged slope, we make the final step from x k

to x k

1

.

The method has an error proportional to

 5

and needs four calculations of right hand side per step.

Two-point boundary value problem

Example: Conduction of heat

A long rod of uniform material conducts heat along its axial direction. We assume that the temperature in the rod u ( x ) , does not change in time (0< x < a , where a is length of the rod). A heat balance applied to a slice of the rod between x and x

  x shows that the heat flow rate q , measured in units of heat per unit time per unit area, obeys the equation q ( x )

A

 r ( x ) A

 x

 q ( x

  x )

A (1) in which A is the cross-sectional area and r is the rate at which heat enters the slice by means other than conduction through the two faces.

For instance, if heat is generated in the slice by an electric current I , we might have r ( x ) A

  x

 

I

2

R

 x

3

where R is resistant of the rod per unit length, and

is the factor of conversion from units of electrical energy to units of heat. If heat is lost through the cylindrical surface of the rod by convection to a surrounding medium at temperature T , then r ( x ) would be given by the “Newton’s law of cooling” r ( x ) A

 x

  h ( u ( x )

T ) C

 x where C is the circumference of the rod and h is the heat transfer coefficient. q ( x

Equation (1) may be re-written

 x

 x

)

 q ( x )

 r ( x ) and using limiting process dq

 r ( x ) . (2) dx

Fourier’s law says that the heat-flow rate through a unit area of material is directly proportional to the temperature difference and inversely proportional to the thickness. q

  k du dx and minus sign express the fact that heat moves from hotter toward cooler regions.

Using (2)

 k dx

2 d

2 u d

2 u dx

2

 r ( x ) or

1 k r ( x ) here k is constant and 0< x < a , a is length of the rod.

Boundary conditions:

If the two ends of the rod were held at constant temperature, the boundary conditions on u would be u ( 0 )

T

0

, u ( a )

T

1

.

If heat were supplied at x =0 (by heating), the boundary condition there would be

 kA du dx

( 0 )

H , where H is measured in units of heat per unit time.

“Shooting” method:

Consider two-point boundary value problem u

  f ( u , x ), u ( 0 )

0 , u ( 1 )

0 , u ( x )

?, 0

 x

We start “shooting” with u

  f ( u , x ), u ( 0 )

0 , u

( 0 )

 

1 .

and try to find a pair of

values

1

,

2

such that, say, for

1 for

2

:

: u ( 1 ) u ( 1 )

0 and

0 .

Thus we can use process of bisecting the known range [

1

,

2

] at each trial.

4

Finite difference method.

First-order difference du ( dx x )

 u ( x

  x )

2

 x u ( x

  x )

.

Second-order difference d

2 u ( dx

2 x )

 u ( x

  x )

2 u ( x )

(

 x )

2

 u ( x

  x )

.

Suppose that we have u

  f ( x ) u

 g ( x ), u ( 0 )

A , u ( 1 )

B .

We divide interval (0,1) into N sub-intervals of size x k

 kh , u k

 u ( kh ), k

0 , 1 , 2 , 3 ..., N

1 . h

1 / N .

Thus we have u k

1

2 u k

 u k

1 u

0

A , h

2 u

N

B .

 f ( x k

) u k

 g ( x k

)

So, we have a system of linear algebraic equations with unknown variables

U

( u

1

, u

2

,..., u

N

1

) .

AU = G

The matrix A ( N -1)x( N -1) is

1 h 2 u k

1

Where

G

(

 h

2

2

(

 g ( f ( x

1

), x k g

)) u

( x

2 k

),...,

1 h 2 g u

( x k

1

N

1

,

)) k

.

1 , 2 ,...

N

1 .

This system may be solved in many ways, for example, using the MATLAB.

Laplas Transform

Function of time : f ( t )

Laplas transform is function F ( s )

L [ f ( t )]

F ( s )

 

0

 f ( t ) e

 st dt

Example : of complex variable s : f ( t )

At

L [ At ]

F ( s )

A s

2

Laplas transform is linear!

Differentiation theorem:

( check by integratio n by part )

5

L

 d dt

L

 d

2 dt

2 f ( t

)  f ( t

)

 sF ( s )

 s

2

F ( s ) f

( 0 ) sf ( 0 )

 f

( 0 )

Let consider the linear differential equation: a  x   b x   cx

 f ( t ) x ( 0 )

 u , x  ( 0 )

 v .

We can apply the Laplas transform to this equation a ( s

2

X

 su

 v )

 b ( sX

 u )

 cX

F ( s )

X ( as

2  bs

 c )

F ( s )

( as

 b ) u

 av x ( t ) .

X ( s )

 as

2

F ( s )

 bs

 c

( as as

2

 b ) u bs

 av

 v

To find x ( t ) we apply the inverse Laplas transform:

L

1

[ X ( s )]

See table of Laplas transforms at Appendix 1

Fourier series and Fourier transform

Let consider periodic functions f ( t ) on the interval [

 

,

] .

Consider sequence of functions

{ 1 / 2 , sin t , cos t , sin 2 t cos 2 t , sin 3 t cos 3 t , ...} .

This sequence is infinite orthonormal system:

 

 sin( mt ) cos( nt ) dt

0

 

 sin( mt ) sin( nt ) dt

0 ( n

 m )

 

 cos( mt ) cos( nt ) dt

 

 sin

2

( mt ) dt

 

0 ( n

 m )

 

 cos

2

( mt ) dt

 

Fourier series: f ( t )

 a

0

2

 n

1

[ a n cos nt

 b n sin nt ] , here a n b n

1

1

 

 

 f ( t ) sin ntdt , f ( t ) cos ntdt , n

0 , 1 , 2 ,...

n

1 , 2 ,...

6

If function is continuous periodic function, then the Fourier series of this function converges uniformly.

Fourier transform

Let f ( t ) be a function defined for all real valuse of argument with complex values.

The Fourier transfor is a mapping F

F (

)



  f ( t ) e

 i

 t dt

: R

C defined by

Inverse Fourier transform f ( t )

1

2



 

F (

) e i

 t dt

See properties of Fourier transform at Appendix 2.

7

Download