165
Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis) Table of Contents 1 Ordinary differential equations..................................10 1.1 Euler method..................................................10 1.1.1 Introduction.............................................. 10 1.1.2 Example ...................................14 1.1.3 Calculate two iterations of the Euler's method for ..................................................16 1.1.4 Calculate two iterations of the Euler's method for .............................................. 18 1.1.5 Calculate two iterations of the Euler's method for ............................................18 1.2 Euler method – numerical stability............................20 1.2.1 Introduction.............................................. 20 1.2.2 Check numerical stability of the Euler’s method for the following differential equation where .............21 1.2.3 Check if the Euler’s method for is numerically stable...............................................23 1

Ordinary differential equations · Web view1.9Finite difference method for two point boundary value problem86 1.9.1Introduction86 1.9.2Solve the following two point boundary value

  • Upload
    lethien

  • View
    214

  • Download
    0

Embed Size (px)

Citation preview

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

Table of Contents

1 Ordinary differential equations.........................................................................................................10

1.1 Euler method.............................................................................................................................10

1.1.1 Introduction.......................................................................................................................10

1.1.2 Example .........................................................................................14

1.1.3 Calculate two iterations of the Euler's method for ........................16

1.1.4 Calculate two iterations of the Euler's method for ................18

1.1.5 Calculate two iterations of the Euler's method for .........18

1.2 Euler method – numerical stability............................................................................................20

1.2.1 Introduction.......................................................................................................................20

1.2.2 Check numerical stability of the Euler’s method for the following differential equation

where ...............................................................................................................21

1.2.3 Check if the Euler’s method for is numerically stable.................23

1.2.4 Check if the Euler’s method for is numerically stable.........23

1.3 Euler's method for systems of equations...................................................................................25

1.3.1 Introduction.......................................................................................................................25

1

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.3.2 Example , ......................................................................27

1.3.3 Calculate two iterations of the Euler's method for .......................28

1.3.4 Example ..................................................................................................29

1.3.5 Find two iterations of the Euler's method for ...................30

1.3.6 Find two iterations of the Euler's method for ...............34

1.3.7 Find two iterations of the Euler's method for35

1.4 Euler method – numerical stability............................................................................................37

1.4.1 Introduction.......................................................................................................................37

2

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.4.2 Check if the Euler’s method for is numerically stable.............................................................................................................................38

1.4.3 Check if the Euler’s method for is numerically stable by using the matrix norm.....................................................................................40

1.4.4 Check if the Euler’s method for is numerically stable by using a spectral radious..................................................................................43

1.5 Backward Euler's method..........................................................................................................45

1.5.1 Introduction.......................................................................................................................45

1.5.2 Calculate two iterations of backward Euler's method ...................47

1.5.3 Calculate two iterations of backward Euler's method ...50

1.5.4 Calculate two iterations of backward Euler's method ...52

1.5.5 Calculate two iterations of backward Euler's method . . .53

1.5.6 Calculate two iterations of the backward Euler's method for

.........................................................................................................54

1.6 Backward Euler method with the predictor formula.................................................................56

1.6.1 Introduction.......................................................................................................................56

3

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.6.2 Calculate two iterations of the backward Euler method with the predictor formula for

............................................................................................................58

1.6.3 Calculate two iterations of the backward Euler method with the predictor formula for

................................................................................................59

1.7 Trapezoidal method...................................................................................................................60

1.7.1 Introduction.......................................................................................................................60

1.7.2 Example .........................................................................................62

1.7.3 Calculate two iterations by using the Trapezoidal Method for 64

1.7.4 Calculate two iterations by using the Trapezoidal Method for 65

1.7.5 Calculate two iterations by using the Trapezoidal Method for

.....................................................................................................66

1.7.6 Calculate two iterations by using the Trapezoidal Method for

..........................................................................................................68

1.7.7 Calculate two iterations by using the Trapezoidal Method for

...................................................................................................69

4

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.8 The trapezoidal method method with the predictor formula....................................................71

1.8.1 Introduction.......................................................................................................................71

1.8.2 Calculate two iterations of the trapezoidal method with the predictor formula for

............................................................................................................73

1.9 Finite difference method for two point boundary value problem.............................................86

1.9.1 Introduction.......................................................................................................................86

1.9.2 Solve the following two point boundary value problem for n=4, h=0.25 92

1.9.3 Solve the following two point boundary value problem for

......................................................................................97

1.9.4 Solve the following two point boundary value problem for

................................................................................99

1.9.5 Solve the following two point boundary value problem for

...................................................................101

5

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.9.6 Solve the following two point boundary value problem for

.......................................................................103

1.9.7 olve the following boundary value problem

(**).................................................................109

1.10 Taylor method.........................................................................................................................110

1.10.1 Introduction.....................................................................................................................110

1.10.2 Example ..........................................................................................................113

1.10.3 Solve the following differential equation by using Taylor's method.. . .115

1.10.4 Example ........................................................................................117

1.10.5 Example ..........................................................................................................119

1.10.6 Example ..........................................................................................................120

1.10.7 Example .........................................................................................................122

6

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.10.8 Example ......................................................................................124

1.10.9 Find approximation of the solution of the following differential equation

by using second order Taylor polynomial.....................................................126

1.10.10 Find approximation of the solution of the following differential equation by using second order Taylor polynomial........................................................................................127

1.10.11 Find approximation of the solution of the following differential equation by using second order Taylor polynomial........................................................................................128

1.10.12 Find approximation of the solution of the following differential equation

by using second order Taylor polynomial for n=2.........................................129

1.10.13 Find approximation of the solution of the following differential equation

by using second order Taylor polynomial for n=2.....................131

1.10.14 Solve the following system of differential equations by using Taylor's method

(*).............................................................................................................................133

1.11 Runge-Kutta method................................................................................................................134

1.11.1 Introduction.....................................................................................................................134

7

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.11.2 (**) Second order method - derivation............................................................................135

1.11.3 Find two iteration of the Runge-Kutta method for where

...................................................................139

1.11.4 Example .....................................................................................141

1.11.5 Calculate two iterations of the second order Runge-Kutta method for

...................................................................................................................142

1.11.6 Find two iteration of the Runge-Kutta method for where

...................................................................143

1.11.7 Find two iteration of the Runge-Kutta method for where

...................................................................144

1.11.8 Find two iteration of the Runge-Kutta method for where

...................................................................145

1.11.9 (**) Forth order Runge-Kutta Method.............................................................................147

8

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.11.10 Solve the following differential equation by using forth order Runge-Kutta method.......................................................................................................................148

1.12 (*) Multistep methods.............................................................................................................149

1.13 Review.....................................................................................................................................151

1.13.1 Summer 2015...................................................................................................................151

1.13.2 Summer 2014...................................................................................................................152

9

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1 Ordinary differential equations

1.1 Euler method

1.1.1 Introduction

10

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

Author

John C. Polking

Department of Mathematics

Rice University

http://math.rice.edu/~dfield/

12

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

http://math.rice.edu/~dfield/matlab8/dfield8.m

13

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

14

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.1.2 Example for n=2

15

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

Matlab code

n=100;y=zeros(n+1);ye=zeros(n+1);y(1)=1;ye(1)=1;dx=0.01;x0=0;for i=1:n x=x0+(i+1)*dx; ye(i+1)=exp(2*x); y(i+1)=y(i)+2*y(i)*dx;endplot(y)holdplot(ye)

0 20 40 60 80 100 1200

1

2

3

4

5

6

7

8

16

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.1.3 Calculate two iterations of the Euler's method for .

17

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

<<VectorFieldPlots`;St=StreamPlot[{2y,1},{x,-2,2},{y,-2,2}];Show[St,Frame->True]

2 1 0 1 2

2

1

0

1

2

18

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.1.4 Calculate two iterations of the Euler's method for .

1.1.5 Calculate two iterations of the Euler's method for .

19

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.1.6 Calculate two iterations of the Euler's method for and n=2.

20

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.1.7 Calculate two iterations of the Euler's method for .

21

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.2 Euler method – numerical stability

1.2.1 Introduction

Let us consider the Euler method for the autonomus diffential equation .

Euler method for presented problem can be written as

Presented equation can be viewed as the fixed point iteration .

Theorem (Contraction mapping theorem)

Assume that and are continuous for and assume that satisfies the theorem, and

Then

1) There is a unique solution of the equation (i.e. ).

2) For any initial estimate of in , the iterates will converge to .

3)

4) for close to we have .

22

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.2.2 Check numerical stability of the Euler’s method for the following differential equation

where .Answer

Euler’s method for the equation lead to the following finite difference equation.

Presented FDM equation can be related with the following fixed point equation

Fixed point iterations converge if

For

23

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

Then the method is numerically stable if

p=2, dx=0.01

24

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

dx=1, p=2

25

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.2.3 Check if the Euler’s method for is numerically stable.Answer

Because then the Euler’s method is numerically stable.

1.2.4 Check if the Euler’s method for is numerically stable.

26

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.2.5 Check if the Euler’s method for is numerically stable.

27

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.3 Euler's method for systems of equations

1.3.1 Introduction

28

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

29

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.3.2 Example ,

30

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.3.3 Calculate two iterations of the Euler's method for .

31

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.3.4 Example

32

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.3.5 Find two iterations of the Euler's method for

33

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

Matlab code

-------------------

n=100;

t=zeros(n+1);

y=zeros(n+1);

v=zeros(n+1);

ye=zeros(n+1);

y(1)=0;

v(1)=2;

t(1)=0;

dt=0.1;

for i=1:n

t(i+1)=0+(i+2)*dt;

ye(i+1)=sin(2*t(i+1));

y(i+1)=y(i)+v(i)*dt;

v(i+1)=v(i)-4*y(i)*dt;

end

plot(y)

hold

plot(ye)

-------------------

34

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

0 20 40 60 80 100 120-6

-4

-2

0

2

4

6

35

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.3.6 Example

36

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.3.7 Find two iterations of the Euler's method for

37

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.3.8 Find two iterations of the Euler's method for

38

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

39

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.4 Euler method – numerical stability

1.4.1 Introduction

Let us consider the Euler method for the autonomus diffential equation .

Euler method for presented problem can be written as

Presented equation can be viewed as the fixed point iteration .

Theorem (Contraction mapping theorem)

Let where and and

, then

the iterative process converges to the unique fixed point and .

In particular for the linear equation fixed point exist if

40

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.4.2 Check of the Euler’s method for is numerically stable.

Solution

Euler’s method for the system

Matrix of the system

Matrix norm (maximum absolute row sum of the matrix)

For presented matrix

41

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

Because the norm of the matrix is smaller than 1, then preseted finite difference scheme is numerically stable.

42

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.4.3 Check if the Euler’s method for is numerically stable by using the matrix norm.

Norm of the matrix

Then the Euler’s method is numerically stable.

43

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.4.4 Check if the Euler’s method for

is numerically stable by using the matrix norm.

44

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

45

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

46

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.4.5 (*) Check if the Euler’s method for is numerically stable by using a spectral radious.

Solution

Euler’s method for the system

Matrix of the system

Eigenvalues of the matrix

For

47

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

Spectral radious of the matrix

Because the spectral radious of the matrix is smaller than , then the matrix the finite difference scheme is numerically stable.

1.4.6 Check if the Euler’s method for

is numerically stable by using a spectral radious.

48

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.5 Backward Euler's method

1.5.1 Introduction

49

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

Forward difference

Backward difference

Central difference

Backward difference Forward difference (Euler's method)

50

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.5.2 Calculate two iterations of backward Euler's method for

51

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

% Octave script

n=150;

x=zeros(n+1);

y=zeros(n+1);

ye=zeros(n+1);

y1=zeros(n+1);

x(1)=0;

y(1)=1;

ye(1)=1;

y1(1)=1;

dx=0.01;

x0=0;

for i=1:n

xc=x0+i*dx;

x(i+1)=xc;

ye(i+1)=exp(2*xc);

y(i+1)=y(i)+2*y(i)*dx;

y1(i+1)=y1(i)/(1-2*dx);

end

plot(x,ye,"color", "b",x,y1,"color", "g",x,y,"color", "r")

52

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

53

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.5.3 Calculate two iterations of backward Euler's method

54

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

0 20 40 60 80 100 1200

1

2

3

4

5

6

7

8

Matlab code

----------------

n=100;yb=zeros(n+1);y(1)=1;ye(1)=1;yb(1)=1;dx=0.01;x0=0;for i=1:n x=x0+(i+1)*dx; yb(i+1)=yb(i)/(1-2*dx);endplot(yb)----------------

55

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.5.4 Calculate two iterations of backward Euler's method

56

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.5.5 Calculate two iterations of backward Euler's method

57

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.5.6 Calculate two iterations of backward Euler's method

58

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.5.7 Calculate two iterations of the backward Euler's method for

59

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.5.8 Calculate two iterations of backward Euler's method

60

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.6 Backward Euler method with the predictor formula

1.6.1 Introduction

Backward difference

61

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

It is not necessary to solve the equation for .

It is possible to get approximate solution by using the Euler method.

or

62

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.6.2 Calculate two iterations of the backward Euler method with the predictor formula for

Answer

63

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.6.3 Calculate two iterations of the backward Euler method with the predictor formula for

.

64

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.7 Trapezoidal method

1.7.1 Introduction

65

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

66

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.7.2 Example

Matlab code

--------------------------------

n=100;y=zeros(n+1);yt=zeros(n+1);ye=zeros(n+1);y(1)=1;

ye(1)=1;yt(1)=1;dx=0.01;x0=0;for i=1:n x=x0+(i+1)*dx; ye(i+1)=exp(2*x); yt(i+1)=(2*yt(i)+2*yt(i)*dx)/(2-2*dx);endplot(yt)hold

67

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

plot(ye)--------------------------------

0 20 40 60 80 100 1200

1

2

3

4

5

6

7

8

68

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.7.3 Calculate two iterations by using the Trapezoidal Method for

69

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.7.4 Calculate two iterations by using the Trapezoidal Method for

70

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.7.5 Calculate two iterations by using the Trapezoidal Method for

71

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

72

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.7.6 Calculate two iterations by using the Trapezoidal Method for

73

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.7.7 Calculate two iterations by using the Trapezoidal Method for

74

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.7.8 Calculate two iterations by using the Trapezoidal Method for

75

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

76

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.7.9 Calculate two iterations by using the Trapezoidal Method for

77

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.8 The trapezoidal method method with the predictor formula

1.8.1 Introduction

78

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

It is not necessary to solve the equation for .

It is possible to get approximate solution by using the Euler method.

or

79

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.8.2 Calculate two iterations of the trapezoidal method with the predictor formula for

Answer

80

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.1 (*) Multistep methods

Explicit method

Implicit method

81

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.1.1 “Adams” methods

Explicit “Adams–Bashforth” method.

Implicit “Adams-Moulton” method.

Predictor corrector method “Adams–Bashforth- Moulton”

Lagrange interpolation

Consider then

82

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

Constant interpolation (Euler’s method)

Linear interpolation (trapezoidal method)

Quadratic interpolation

Etc.

83

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.8.2.1ExampleVerify the scheme:

for the ODE .

Answer

Let’s us consider three points

And appropriate second order interpolation polynomial in a Lagrange’ form.

If then , consequently the solution of the equation is

close to the solution of the equation , in particular

84

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

Let , then

85

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.1.2 Adams–Bashforth of order 2 (two step method).

Interpolate on by using the linear interpolation

then

Local truncation error global truncation error .

Now it is possible to use sample functions and find constants A,B.

86

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

Example

First step we can find by using the modified Euler’s method.

Second step we can find by using the Adams–Bashforth method.

87

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.1.3 Adams– Moulton 3th order (2 step method)

Let’s us consider

Let us consider .

After the calculations

Example

Solve for .

88

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

Now it is possible to use sample functions and find constants A,B.

After the solution

89

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.1.4 Adams– Moulton 4th order (3 step method)

90

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.1.5 Comparison m-step Adams–Bashforth and m-1 Adams– Moulton

In the multistep methods it is necessary to use additional methods to calculate the first iterations.

The order of the methods must be the same as the original method.

Not self-storging????

(1) m-step Adams–Bashforth and m-1 Adams– Moulton

4-th order Runge Kutta – more functions evaluations

Adams–Bashforth – one function evaluation at the time (we can use previous function values).

1.1.6 Predictor corrector method Adams–Bashforth-Moulton

Forth-order Adams–Bashforth (predictor)

Adams–Moulton (corrector)

91

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.9 Finite difference method for two-point boundary value problem

1.9.1 Introduction

Explicit method

Implicit method

Example

92

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

93

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

Example

Exact solution

94

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

95

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

n=4,

96

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

-----------------------------------

97

h 0.25x

0

0.25

0.5

0.75

1

A

1

1

h2

0

0

0

0

2

h2

1

h2

0

0

0

1

h2

2

h2

1

h2

0

0

0

1

h2

2

h2

0

0

0

0

1

h2

1

b

0

0.25

0.5

0.75

0

u A 1 b u

0

0.039

0.063

0.055

0

ue x( )x3

6x6

0 0.2 0.4 0.6 0.8 10.08

0.06

0.04

0.02

0

u

x

ue x( )

0

0.039

0.063

0.055

0

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.9.2 Example

Finite difference method for two point boundary value problem.

98

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

For n=3

Matrix form

or shortyly

where

99

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.9.3 Solve the following two-point boundary value problem for n=4, h=0.25

100

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

101

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1 2 3 4 5

0.5

1.0

1.5

2.0

102

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.9.4 Solve the following two-point boundary value problem for

103

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

(*)

Matrix form of the problem

104

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.9.5 Solve the following two point boundary value problem for

105

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

Matrix form (*)

106

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.9.6 Solve the following two-point boundary value problem for

107

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.9.7 Solve the following two point boundary value problem for

X (id)

X (value) 0 0.25 0.5 0.75 1

108

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

U(id)

U(value) 1 ? ? ? 2

109

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.9.8 Solve the following two-point boundary value problem for

110

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

111

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

112

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.9.9 Solve the following two-point boundary value problem for

Difference equation

113

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

114

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

115

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.9.10 (**) Solve the following boundary value problem

116

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.10 Taylor method

1.10.1 Introduction

117

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

In general

118

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.10.2 Example

119

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.10.3 Example

120

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

121

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.10.4 Solve the following differential equation by using Taylor's method.

122

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

123

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.10.5 Example

124

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.10.6 Example

125

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.10.7 Example

126

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.10.8 Example

127

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

128

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.10.9 Example

129

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

130

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.10.10 Example

131

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

132

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.10.11 Find approximation of the solution of the following differential equation

by using second order Taylor polynomial

133

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.10.12 Find approximation of the solution of the following differential equation

by using second order Taylor polynomial

134

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.10.13 Find approximation of the solution of the following differential equation

by using second order Taylor polynomial

135

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.10.14 Find approximation of the solution of the following differential equation

by using second order Taylor polynomial for n=2.

136

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

137

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

138

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.10.15 Find approximation of the solution of the following differential equation

by using second order Taylor polynomial for n=2.

139

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

140

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.10.16 Solve the following system of differential equations by using Taylor's method

(*)

141

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.11 Runge-Kutta method

1.11.1 Introduction

Second order

Forth order

---

142

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.11.2 (**) Second order method - derivation

143

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

because

then

Now let's calculate the difference

144

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

145

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

For we have

146

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.11.3 Find two iterations of the Runge-Kutta method for where

.

147

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.11.4 Find two iterations of the Runge-Kutta method for where

.

148

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.11.5 Example

149

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.11.6 Calculate two iterations of the second order Runge-Kutta method for

150

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.11.7 Find two iterations of the Runge-Kutta method for where

.

151

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.11.8 Find two iteration of the Runge-Kutta method for where

.

152

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.11.9 Find two iteration of the Runge-Kutta method for where

.

153

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

154

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.11.10 (**) Forth order Runge-Kutta Method

Let an initial value problem be specified as follows.

Then, the RK4 method for this problem is given by the following equations:

where yn + 1 is the RK4 approximation of y(tn + 1), and

155

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.11.11 Solve the following differential equation by using forth order Runge-Kutta method.

156

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.12 (*) Multistep methods

157

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

158

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.13 Review

1.13.1 Summer 2017

Problem 1.2.4 (Numerical stability)

Problem 1.5.7 (The Backward Euler’s Method)

Problem 1.7.4 (Trapezoidal method)

Problem 1.9.8 (Finite difference method for two-point boundary value problem)

159

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

1.13.2 Summer 2014

Section 1.3

Problem 1.3.5

Problem 1.3.7

Section 1.4

Problem 1.4.2

Section 1.5

Problem 1.5.3

Problem 1.5.5

Section 1.6

Problem 1.6.2

Section 1.7

Problem 1.7.5

Problem 1.7.6

Section 1.8

Problem 1.8.2

160

Andrew Pownuk - http://www.pownuk.com- Math 4329 (Numerical Analysis)

Section 1.9

Problem 1.9.5

Problem 1.9.7

Section 1.10

Problem 1.10.5

Problem 1.10.7

Section 1.11

Problem 1.11.7

Problem 1.11.8

161