• 沒有找到結果。

IVP of ODE

N/A
N/A
Protected

Academic year: 2022

Share "IVP of ODE"

Copied!
83
0
0

加載中.... (立即查看全文)

全文

(1)

IVP of ODE

1

Initial-Value Problems for Ordinary Differential Equations

NTNU

Tsung-Min Hwang December 8, 2003

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(2)

IVP of ODE

2

1 – Existence and Uniqueness of Solutions . . . . 4

2 – Euler’s Method . . . . 6

3 – Runge-Kutta Methods . . . . 9

4 – Multistep Methods . . . 15

5 – Systems and Higher-Order Ordinary Differential Equations . . . 25

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(3)

IVP of ODE

3

In this chapter, we discuss numerical methods for solving ordinary differential equations of initial-value problems (IVP) of the form

y0 = f (x, y), x ∈ [a, b]

y(x0) = y0, (1)

where y is a function of x, f is a function of y and x, x0 is called the initial point, and y0 the

initial value. The numerical values of y(x) on an interval containing x0 are to be

determined.

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(4)

IVP of ODE

4

1 – Existence and Uniqueness of Solutions

Theorem 1 If f (x, y) is continuous in a region, where

Ω = {(x, y); |x − x0| ≤ α, |y − y0| ≤ β} (2)

then the IVP (1) has a solution y(x) for |x − x0| ≤ min{α, β

M }, where M = max

(x,y)∈Ω |f (x, y)|.

Theorem 2 If f and ∂f∂x are continuous in, then the IVP (1) has a unique solution in the interval |x − x0| ≤ min{α, Mβ }.

Theorem 3 If f is continuous in a ≤ x ≤ b, −∞ < y < ∞ and

|f (x, y1) − f (x, y2)| ≤ L|y1 − y2|

for some positive constant L, (that is, f is Lipschitz continuous in y), then IVP (1) has a unique solution in the interval [a, b].

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(5)

IVP of ODE

4

1 – Existence and Uniqueness of Solutions

Theorem 1 If f (x, y) is continuous in a region, where

Ω = {(x, y); |x − x0| ≤ α, |y − y0| ≤ β} (2)

then the IVP (1) has a solution y(x) for |x − x0| ≤ min{α, β

M }, where M = max

(x,y)∈Ω |f (x, y)|.

Theorem 2 If f and ∂f∂x are continuous in, then the IVP (1) has a unique solution in the interval |x − x0| ≤ min{α, Mβ }.

Theorem 3 If f is continuous in a ≤ x ≤ b, −∞ < y < ∞ and

|f (x, y1) − f (x, y2)| ≤ L|y1 − y2|

for some positive constant L, (that is, f is Lipschitz continuous in y), then IVP (1) has a unique solution in the interval [a, b].

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(6)

IVP of ODE

4

1 – Existence and Uniqueness of Solutions

Theorem 1 If f (x, y) is continuous in a region, where

Ω = {(x, y); |x − x0| ≤ α, |y − y0| ≤ β} (2)

then the IVP (1) has a solution y(x) for |x − x0| ≤ min{α, β

M }, where M = max

(x,y)∈Ω |f (x, y)|.

Theorem 2 If f and ∂f∂x are continuous in, then the IVP (1) has a unique solution in the interval |x − x0| ≤ min{α, Mβ }.

Theorem 3 If f is continuous in a ≤ x ≤ b, −∞ < y < ∞ and

|f (x, y1) − f (x, y2)| ≤ L|y1 − y2|

for some positive constant L, (that is, f is Lipschitz continuous in y), then IVP (1) has a unique solution in the interval [a, b].

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(7)

IVP of ODE

5

Numerical integration of ODEs : Given

dy

dx = f (x, y), y(x0) = y0.

Find approximate solution at discrete values of x xj = x0 + jh

where h is the “stepsize”.

Graphical interpretation

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(8)

IVP of ODE

6

2 – Euler’s Method

On of the simplest methods for solving the IVP (1) is the Euler’s method.

Subdivide [a, b] into n subintervals of equal length h with mesh points {x0, x1, . . . , xn}

where

xi = a + ih, ∀ i = 0, 1, 2, . . . , n.

Recall the Taylor’s Theorem

y(xi+1) = y(xi) + (xi+1 − xi)y0(xi) + (xi+1 − xi)2

2 y00i)

= y(xi) + hy0(xi) + h2

2 y00i) (3)

= y(xi) + hf (xi, y(xi)) + h2

2 y00i)

for some ξi ∈ [xi, xi+1].

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(9)

IVP of ODE

6

2 – Euler’s Method

On of the simplest methods for solving the IVP (1) is the Euler’s method.

Subdivide [a, b] into n subintervals of equal length h with mesh points {x0, x1, . . . , xn}

where

xi = a + ih, ∀ i = 0, 1, 2, . . . , n.

Recall the Taylor’s Theorem

y(xi+1) = y(xi) + (xi+1 − xi)y0(xi) + (xi+1 − xi)2

2 y00i)

= y(xi) + hy0(xi) + h2

2 y00i) (3)

= y(xi) + hf (xi, y(xi)) + h2

2 y00i)

for some ξi ∈ [xi, xi+1].

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(10)

IVP of ODE

6

2 – Euler’s Method

On of the simplest methods for solving the IVP (1) is the Euler’s method.

Subdivide [a, b] into n subintervals of equal length h with mesh points {x0, x1, . . . , xn}

where

xi = a + ih, ∀ i = 0, 1, 2, . . . , n.

Recall the Taylor’s Theorem

y(xi+1) = y(xi) + (xi+1 − xi)y0(xi) + (xi+1 − xi)2

2 y00i)

= y(xi) + hy0(xi) + h2

2 y00i) (3)

= y(xi) + hf (xi, y(xi)) + h2

2 y00i)

for some ξi ∈ [xi, xi+1].

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(11)

IVP of ODE

7

We have the formulation of Euler’s mehtod

xk+1 = xk + h = x0 + (k + 1)h yk+1 = yk + hf (xk, yk)

On the other hand, from (3),

f (xi, y(xi)) = y0(xi) = y(xi+1) − y(xi)

h + h

2y00i)

It implies that Euler’s method is a first-order (O(h)) method.

The Improved Euler’s method

xk+1 = xk + h = x0 + (k + 1)h

yk+1 = yk + hf (xk, yk) (4)

yk+1 = yk + h

2 f(xk, yk) + f (xk+1, yk+1)

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(12)

IVP of ODE

7

We have the formulation of Euler’s mehtod

xk+1 = xk + h = x0 + (k + 1)h yk+1 = yk + hf (xk, yk)

On the other hand, from (3),

f (xi, y(xi)) = y0(xi) = y(xi+1) − y(xi)

h + h

2y00i)

It implies that Euler’s method is a first-order (O(h)) method.

The Improved Euler’s method

xk+1 = xk + h = x0 + (k + 1)h

yk+1 = yk + hf (xk, yk) (4)

yk+1 = yk + h

2 f(xk, yk) + f (xk+1, yk+1)

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(13)

IVP of ODE

7

We have the formulation of Euler’s mehtod

xk+1 = xk + h = x0 + (k + 1)h yk+1 = yk + hf (xk, yk)

On the other hand, from (3),

f (xi, y(xi)) = y0(xi) = y(xi+1) − y(xi)

h + h

2y00i)

It implies that Euler’s method is a first-order (O(h)) method.

The Improved Euler’s method

xk+1 = xk + h = x0 + (k + 1)h

yk+1 = yk + hf (xk, yk) (4)

yk+1 = yk + h

2 f(xk, yk) + f (xk+1, yk+1)

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(14)

IVP of ODE

7

We have the formulation of Euler’s mehtod

xk+1 = xk + h = x0 + (k + 1)h yk+1 = yk + hf (xk, yk)

On the other hand, from (3),

f (xi, y(xi)) = y0(xi) = y(xi+1) − y(xi)

h + h

2y00i)

It implies that Euler’s method is a first-order (O(h)) method.

The Improved Euler’s method

xk+1 = xk + h = x0 + (k + 1)h

yk+1 = yk + hf (xk, yk) (4)

yk+1 = yk + h

2 f(xk, yk) + f (xk+1, yk+1)

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(15)

IVP of ODE

8

Example 1 Use Euler’s method to integrate

dy

dx = x − 2y, y(0) = 1.

The exact solution is

y = 1

4 2x − 1 + 5e2x .

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

x

y

Example 1 for Euler method

Exact h = 0.2 h = 0.1 h = 0.05

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(16)

IVP of ODE

8

Example 1 Use Euler’s method to integrate

dy

dx = x − 2y, y(0) = 1.

The exact solution is

y = 1

4 2x − 1 + 5e2x .

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

x

y

Example 1 for Euler method

Exact h = 0.2 h = 0.1 h = 0.05

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(17)

IVP of ODE

8

Example 1 Use Euler’s method to integrate

dy

dx = x − 2y, y(0) = 1.

The exact solution is

y = 1

4 2x − 1 + 5e2x .

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

x

y

Example 1 for Euler method

Exact h = 0.2 h = 0.1 h = 0.05

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(18)

IVP of ODE

9

3 – Runge-Kutta Methods

One of the most important methods for solving the IVP (1) is the Runge-Kutta method.

Recall the Taylor’s Theorem

y(x + h) = y(x) + hy0(x) + h2

2 y00 + h3

2 y000 + . . .

= y(x) + hy0(x) + h2

2 y00 + O(h3)

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(19)

IVP of ODE

9

3 – Runge-Kutta Methods

One of the most important methods for solving the IVP (1) is the Runge-Kutta method.

Recall the Taylor’s Theorem

y(x + h) = y(x) + hy0(x) + h2

2 y00 + h3

2 y000 + . . .

= y(x) + hy0(x) + h2

2 y00 + O(h3)

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(20)

IVP of ODE

9

3 – Runge-Kutta Methods

One of the most important methods for solving the IVP (1) is the Runge-Kutta method.

Recall the Taylor’s Theorem

y(x + h) = y(x) + hy0(x) + h2

2 y00 + h3

2 y000 + . . .

= y(x) + hy0(x) + h2

2 y00 + O(h3)

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(21)

IVP of ODE

10

By differentiating y(x), we have

y0 = f (x, y) ≡ f

y00 = d

dxf = fx + fyy0 = fx + fyf y000 = fxx + fxyf + f d

dxfy + fy

d dxf

= fxx + fxyf + f (fy dy

dy

dx + fyx) + fy(fx + fyf )

= fxx + fxyf + f (fyx + fyyf ) + fy(fx + fyf )

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(22)

IVP of ODE

10

By differentiating y(x), we have

y0 = f (x, y) ≡ f y00 = d

dxf = fx + fyy0 = fx + fyf

y000 = fxx + fxyf + f d

dxfy + fy

d dxf

= fxx + fxyf + f (fy dy

dy

dx + fyx) + fy(fx + fyf )

= fxx + fxyf + f (fyx + fyyf ) + fy(fx + fyf )

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(23)

IVP of ODE

10

By differentiating y(x), we have

y0 = f (x, y) ≡ f y00 = d

dxf = fx + fyy0 = fx + fyf y000 = fxx + fxyf + f d

dxfy + fy

d dxf

= fxx + fxyf + f (fy dy

dy

dx + fyx) + fy(fx + fyf )

= fxx + fxyf + f (fyx + fyyf ) + fy(fx + fyf )

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(24)

IVP of ODE

10

By differentiating y(x), we have

y0 = f (x, y) ≡ f y00 = d

dxf = fx + fyy0 = fx + fyf y000 = fxx + fxyf + f d

dxfy + fy

d dxf

= fxx + fxyf + f (fy dy

dy

dx + fyx) + fy(fx + fyf )

= fxx + fxyf + f (fyx + fyyf ) + fy(fx + fyf )

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(25)

IVP of ODE

10

By differentiating y(x), we have

y0 = f (x, y) ≡ f y00 = d

dxf = fx + fyy0 = fx + fyf y000 = fxx + fxyf + f d

dxfy + fy

d dxf

= fxx + fxyf + f (fy dy

dy

dx + fyx) + fy(fx + fyf )

= fxx + fxyf + f (fyx + fyyf ) + fy(fx + fyf )

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(26)

IVP of ODE

11

Then

y(x + h) = y + hy0 + h2

2 y00 + O(h3)

= y + hf + h2

2 (fx + fyf ) + O(h3)

= y + h

2f + h

2f + h2

2 (fx + fyf ) + O(h3)

= y + h

2f + h

2(f + hfx + hfyf ) + O(h3)

Apply Taylor’s Theorem on f

f (x + h, y + hf ) = f (x, y) + hfx + hf fy + O(h2)

⇒ f + hfx + hf fy ≈ f (x + h, y + hf )

⇒ y(x + h) = y + 1

2hf + h

2f (x + h, y + hf ) + O(h3)

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(27)

IVP of ODE

11

Then

y(x + h) = y + hy0 + h2

2 y00 + O(h3)

= y + hf + h2

2 (fx + fyf ) + O(h3)

= y + h

2f + h

2f + h2

2 (fx + fyf ) + O(h3)

= y + h

2f + h

2(f + hfx + hfyf ) + O(h3)

Apply Taylor’s Theorem on f

f (x + h, y + hf ) = f (x, y) + hfx + hf fy + O(h2)

⇒ f + hfx + hf fy ≈ f (x + h, y + hf )

⇒ y(x + h) = y + 1

2hf + h

2f (x + h, y + hf ) + O(h3)

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(28)

IVP of ODE

11

Then

y(x + h) = y + hy0 + h2

2 y00 + O(h3)

= y + hf + h2

2 (fx + fyf ) + O(h3)

= y + h

2f + h

2f + h2

2 (fx + fyf ) + O(h3)

= y + h

2f + h

2(f + hfx + hfyf ) + O(h3)

Apply Taylor’s Theorem on f

f (x + h, y + hf ) = f (x, y) + hfx + hf fy + O(h2)

⇒ f + hfx + hf fy ≈ f (x + h, y + hf )

⇒ y(x + h) = y + 1

2hf + h

2f (x + h, y + hf ) + O(h3)

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(29)

IVP of ODE

11

Then

y(x + h) = y + hy0 + h2

2 y00 + O(h3)

= y + hf + h2

2 (fx + fyf ) + O(h3)

= y + h

2f + h

2f + h2

2 (fx + fyf ) + O(h3)

= y + h

2f + h

2(f + hfx + hfyf ) + O(h3)

Apply Taylor’s Theorem on f

f (x + h, y + hf ) = f (x, y) + hfx + hf fy + O(h2)

⇒ f + hfx + hf fy ≈ f (x + h, y + hf )

⇒ y(x + h) = y + 1

2hf + h

2f (x + h, y + hf ) + O(h3)

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(30)

IVP of ODE

11

Then

y(x + h) = y + hy0 + h2

2 y00 + O(h3)

= y + hf + h2

2 (fx + fyf ) + O(h3)

= y + h

2f + h

2f + h2

2 (fx + fyf ) + O(h3)

= y + h

2f + h

2(f + hfx + hfyf ) + O(h3)

Apply Taylor’s Theorem on f

f (x + h, y + hf ) = f (x, y) + hfx + hf fy + O(h2)

⇒ f + hfx + hf fy ≈ f (x + h, y + hf )

⇒ y(x + h) = y + 1

2hf + h

2f (x + h, y + hf ) + O(h3)

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(31)

IVP of ODE

11

Then

y(x + h) = y + hy0 + h2

2 y00 + O(h3)

= y + hf + h2

2 (fx + fyf ) + O(h3)

= y + h

2f + h

2f + h2

2 (fx + fyf ) + O(h3)

= y + h

2f + h

2(f + hfx + hfyf ) + O(h3)

Apply Taylor’s Theorem on f

f (x + h, y + hf ) = f (x, y) + hfx + hf fy + O(h2)

⇒ f + hfx + hf fy ≈ f (x + h, y + hf )

⇒ y(x + h) = y + 1

2hf + h

2f (x + h, y + hf ) + O(h3)

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(32)

IVP of ODE

11

Then

y(x + h) = y + hy0 + h2

2 y00 + O(h3)

= y + hf + h2

2 (fx + fyf ) + O(h3)

= y + h

2f + h

2f + h2

2 (fx + fyf ) + O(h3)

= y + h

2f + h

2(f + hfx + hfyf ) + O(h3)

Apply Taylor’s Theorem on f

f (x + h, y + hf ) = f (x, y) + hfx + hf fy + O(h2)

⇒ f + hfx + hf fy ≈ f (x + h, y + hf )

⇒ y(x + h) = y + 1

2hf + h

2f (x + h, y + hf ) + O(h3)

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(33)

IVP of ODE

12

Let

F1 = hf (x, y), F2 = hf (x + h, y + F1)

Then

y(x + h) = y + 1

2(F1 + F2).

This is called the second-order Runge-Kutta method. Two function evaluations are required at each step.

Algorithm 1 Algorithm for second-order Runge-Kutta mehtod : For k = 0, 1, 2, . . .

xk+1 = xk + h = x0 + (k + 1)h F1 = hf (xk, yk)

F2 = hf (xk+1, yk + F1) yk+1 = yk + 12(F1 + F2)

End for Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(34)

IVP of ODE

12

Let

F1 = hf (x, y), F2 = hf (x + h, y + F1)

Then

y(x + h) = y + 1

2(F1 + F2).

This is called the second-order Runge-Kutta method. Two function evaluations are required at each step.

Algorithm 1 Algorithm for second-order Runge-Kutta mehtod : For k = 0, 1, 2, . . .

xk+1 = xk + h = x0 + (k + 1)h F1 = hf (xk, yk)

F2 = hf (xk+1, yk + F1) yk+1 = yk + 12(F1 + F2)

End for Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(35)

IVP of ODE

12

Let

F1 = hf (x, y), F2 = hf (x + h, y + F1)

Then

y(x + h) = y + 1

2(F1 + F2).

This is called the second-order Runge-Kutta method.

Two function evaluations are required at each step.

Algorithm 1 Algorithm for second-order Runge-Kutta mehtod : For k = 0, 1, 2, . . .

xk+1 = xk + h = x0 + (k + 1)h F1 = hf (xk, yk)

F2 = hf (xk+1, yk + F1) yk+1 = yk + 12(F1 + F2)

End for Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(36)

IVP of ODE

12

Let

F1 = hf (x, y), F2 = hf (x + h, y + F1)

Then

y(x + h) = y + 1

2(F1 + F2).

This is called the second-order Runge-Kutta method. Two function evaluations are required at each step.

Algorithm 1 Algorithm for second-order Runge-Kutta mehtod : For k = 0, 1, 2, . . .

xk+1 = xk + h = x0 + (k + 1)h F1 = hf (xk, yk)

F2 = hf (xk+1, yk + F1) yk+1 = yk + 12(F1 + F2)

End for Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(37)

IVP of ODE

12

Let

F1 = hf (x, y), F2 = hf (x + h, y + F1)

Then

y(x + h) = y + 1

2(F1 + F2).

This is called the second-order Runge-Kutta method. Two function evaluations are required at each step.

Algorithm 1 Algorithm for second-order Runge-Kutta mehtod : For k = 0, 1, 2, . . .

xk+1 = xk + h = x0 + (k + 1)h F1 = hf (xk, yk)

F2 = hf (xk+1, yk + F1) yk+1 = yk + 12(F1 + F2)

End for

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(38)

IVP of ODE

13

General form of second-order Runge-Kutta method :

y(x + h) = y + ω1hf (x, y) + ω2hf (x + αh, y + βhf ) + O(h3)

where ω1, ω2, α, β are constants to be defined, and

ω1 + ω2 = 1, ω2α = 1

2, ω2β = 1 2

By letting ω1 = 0, ω2 = 1, α = β = 12 leads to the modified Euler’s mehtod. Fourth-Order Runge-kutta method

y(x + h) = y + 1

6(F1 + 2F2 + 2F3 + F4) + O(h5)

where













F1 = hf (x, y)

F2 = hf (x + 12h, y + 12F1) F3 = hf (x + 12h, y + 12F2) F4 = hf (x + h, y + F3)

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(39)

IVP of ODE

13

General form of second-order Runge-Kutta method :

y(x + h) = y + ω1hf (x, y) + ω2hf (x + αh, y + βhf ) + O(h3)

where ω1, ω2, α, β are constants to be defined, and

ω1 + ω2 = 1, ω2α = 1

2, ω2β = 1 2

By letting ω1 = 0, ω2 = 1, α = β = 12 leads to the modified Euler’s mehtod.

Fourth-Order Runge-kutta method

y(x + h) = y + 1

6(F1 + 2F2 + 2F3 + F4) + O(h5)

where













F1 = hf (x, y)

F2 = hf (x + 12h, y + 12F1) F3 = hf (x + 12h, y + 12F2) F4 = hf (x + h, y + F3)

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(40)

IVP of ODE

13

General form of second-order Runge-Kutta method :

y(x + h) = y + ω1hf (x, y) + ω2hf (x + αh, y + βhf ) + O(h3)

where ω1, ω2, α, β are constants to be defined, and

ω1 + ω2 = 1, ω2α = 1

2, ω2β = 1 2

By letting ω1 = 0, ω2 = 1, α = β = 12 leads to the modified Euler’s mehtod.

Fourth-Order Runge-kutta method

y(x + h) = y + 1

6(F1 + 2F2 + 2F3 + F4) + O(h5)

where













F1 = hf (x, y)

F2 = hf (x + 12h, y + 12F1) F3 = hf (x + 12h, y + 12F2) F4 = hf (x + h, y + F3)

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(41)

IVP of ODE

14

Algorithm 2 Algorithm for fourth-order Runge-Kutta mehtod : For k = 0, 1, 2, . . .

xk+1

2 = xk + 12h

xk+1 = xk + h = x0 + (k + 1)h F1 = hf (xk, yk)

F2 = hf (xk+1

2, yk + 12F1) F3 = hf (xk+1

2, yk + 12F2) F4 = hf (xk+1, yk + F3)

yk+1 = yk + 16(F1 + 2F2 + 2F3 + F4)

End for

The fourth Runge-Kutta method involves a local truncation error of O(h5).

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(42)

IVP of ODE

15

4 – Multistep Methods

Example 2 (Stiff problem, van der Pol equation)

y10 = y2,

y20 = µ(1 − y12)y2 − y1.

0 500 1000 1500 2000 2500 3000

−2.5

−2

−1.5

−1

−0.5 0 0.5 1 1.5 2 2.5

Solution of van der Pol Equation, µ = 1000

time t solution y 1

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(43)

IVP of ODE

16

805.715 805.72 805.725 805.73 805.735

−2

−1.5

−1

−0.5 0 0.5

Solution of van der Pol Equation, µ = 1000

time t solution y 1

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(44)

IVP of ODE

17

Definition 1 A multistep method for solving the initial-value problem

y0 = f (x, y), a ≤ x ≤ b, y(a) = α

is

wi+1 = am−1wi + am−2wi−1 + · · · + a0wi+1−m +

h [bmf (xi+1, wi+1) + bm−1f (xi, wi) + · · · + b0f (xi+1−m, wi+1−m)]

for i = m − 1, m, . . . , N − 1, where the starting values

w0 = α, w1 = α1, · · · , wm−1 = αm−1

are specified and h = (b − a)/N.

If bm = 0, the method is called explicit or open

If bm 6= 0, the method is called implicit or closed. Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(45)

IVP of ODE

17

Definition 1 A multistep method for solving the initial-value problem

y0 = f (x, y), a ≤ x ≤ b, y(a) = α

is

wi+1 = am−1wi + am−2wi−1 + · · · + a0wi+1−m +

h [bmf (xi+1, wi+1) + bm−1f (xi, wi) + · · · + b0f (xi+1−m, wi+1−m)]

for i = m − 1, m, . . . , N − 1, where the starting values

w0 = α, w1 = α1, · · · , wm−1 = αm−1

are specified and h = (b − a)/N.

If bm = 0, the method is called explicit or open

If bm 6= 0, the method is called implicit or closed. Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(46)

IVP of ODE

17

Definition 1 A multistep method for solving the initial-value problem

y0 = f (x, y), a ≤ x ≤ b, y(a) = α

is

wi+1 = am−1wi + am−2wi−1 + · · · + a0wi+1−m +

h [bmf (xi+1, wi+1) + bm−1f (xi, wi) + · · · + b0f (xi+1−m, wi+1−m)]

for i = m − 1, m, . . . , N − 1, where the starting values

w0 = α, w1 = α1, · · · , wm−1 = αm−1

are specified and h = (b − a)/N.

If bm = 0, the method is called explicit or open

If bm 6= 0, the method is called implicit or closed.

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(47)

IVP of ODE

18

Example 3

Explicit fourth-order Adams-Bashforth method:

w0 = α, w1 = α1, w2 = α2, w3 = α3, wi+1 = wi + h

24 [55f (xi, wi) − 59f (xi−1, wi−1) +37f (xi−2, wi−2) − 9f (xi−3, wi−3)]

for each i = 3, 4, . . . , N − 1.

Implicit fourth-order Adams-Moulton method:

w0 = α, w1 = α1, w2 = α2, wi+1 = wi + h

24 [9f (xi+1, wi+1) + 19f (xi, wi)

−5f (xi−1, wi−1) + f (xi−2, wi−2)]

for each i = 2, 3, . . . , N − 1.

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(48)

IVP of ODE

18

Example 3

Explicit fourth-order Adams-Bashforth method:

w0 = α, w1 = α1, w2 = α2, w3 = α3, wi+1 = wi + h

24 [55f (xi, wi) − 59f (xi−1, wi−1) +37f (xi−2, wi−2) − 9f (xi−3, wi−3)]

for each i = 3, 4, . . . , N − 1.

Implicit fourth-order Adams-Moulton method:

w0 = α, w1 = α1, w2 = α2, wi+1 = wi + h

24 [9f (xi+1, wi+1) + 19f (xi, wi)

−5f (xi−1, wi−1) + f (xi−2, wi−2)]

for each i = 2, 3, . . . , N − 1.

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(49)

IVP of ODE

19

Derivation of the multistep methods:

y(xi+1) − y(xi) =

Z xi+1 xi

y0(x)dx =

Z xi+1 xi

f (x, y(x))dx

⇒ y(xi+1) = y(xi) +

Z xi+1

xi

f (x, y(x))dx

P (x): an interpolating polynomial to f (x, y(x)) and y(xi) ≈ wi. Then y(xi+1) ≈ wi +

Z xi+1

xi

P (x)dx

Adams-Bashforth explicit m-step technique: The binomial formula is defined as

s k



= s(s − 1) · · · (s − k + 1) k!

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(50)

IVP of ODE

19

Derivation of the multistep methods:

y(xi+1) − y(xi) =

Z xi+1 xi

y0(x)dx =

Z xi+1 xi

f (x, y(x))dx

⇒ y(xi+1) = y(xi) +

Z xi+1

xi

f (x, y(x))dx

P (x): an interpolating polynomial to f (x, y(x)) and y(xi) ≈ wi.

Then

y(xi+1) ≈ wi +

Z xi+1

xi

P (x)dx

Adams-Bashforth explicit m-step technique: The binomial formula is defined as

s k



= s(s − 1) · · · (s − k + 1) k!

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(51)

IVP of ODE

19

Derivation of the multistep methods:

y(xi+1) − y(xi) =

Z xi+1 xi

y0(x)dx =

Z xi+1 xi

f (x, y(x))dx

⇒ y(xi+1) = y(xi) +

Z xi+1

xi

f (x, y(x))dx

P (x): an interpolating polynomial to f (x, y(x)) and y(xi) ≈ wi. Then y(xi+1) ≈ wi +

Z xi+1

xi

P (x)dx

Adams-Bashforth explicit m-step technique: The binomial formula is defined as

s k



= s(s − 1) · · · (s − k + 1) k!

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(52)

IVP of ODE

19

Derivation of the multistep methods:

y(xi+1) − y(xi) =

Z xi+1 xi

y0(x)dx =

Z xi+1 xi

f (x, y(x))dx

⇒ y(xi+1) = y(xi) +

Z xi+1

xi

f (x, y(x))dx

P (x): an interpolating polynomial to f (x, y(x)) and y(xi) ≈ wi. Then y(xi+1) ≈ wi +

Z xi+1

xi

P (x)dx

Adams-Bashforth explicit m-step technique:

The binomial formula is defined as

s k



= s(s − 1) · · · (s − k + 1) k!

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(53)

IVP of ODE

19

Derivation of the multistep methods:

y(xi+1) − y(xi) =

Z xi+1 xi

y0(x)dx =

Z xi+1 xi

f (x, y(x))dx

⇒ y(xi+1) = y(xi) +

Z xi+1

xi

f (x, y(x))dx

P (x): an interpolating polynomial to f (x, y(x)) and y(xi) ≈ wi. Then y(xi+1) ≈ wi +

Z xi+1

xi

P (x)dx

Adams-Bashforth explicit m-step technique:

The binomial formula is defined as

s k



= s(s − 1) · · · (s − k + 1) k!

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(54)

IVP of ODE

20

We introduce the backward difference notation

∇f (xi) = f (xi) − f (xi−1)

and

kf (xi) = ∇k−1f (xi) − ∇k−1f (xi−1) = ∇ ∇k−1f (xi) ,

for i = 0, 1, . . . , n − 1.

Let Pm−1(x) be the Newton backward difference polynomial through (xi, f (xi, y(xi))), (xi−1, f (xi−1, y(xi−1))), . . ., (xi+1−m, f (xi+1−m, y(xi+1−m))), i.e.,

Pm−1(x) =

m−1

X

k=0

(−1)k

−s k

∇kf (xi, y(xi))

where x = xi + sh. Then

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(55)

IVP of ODE

20

We introduce the backward difference notation

∇f (xi) = f (xi) − f (xi−1)

and

kf (xi) = ∇k−1f (xi) − ∇k−1f (xi−1) = ∇ ∇k−1f (xi) ,

for i = 0, 1, . . . , n − 1.

Let Pm−1(x) be the Newton backward difference polynomial through (xi, f (xi, y(xi))), (xi−1, f (xi−1, y(xi−1))), . . ., (xi+1−m, f (xi+1−m, y(xi+1−m))),

i.e.,

Pm−1(x) =

m−1

X

k=0

(−1)k

−s k

∇kf (xi, y(xi))

where x = xi + sh. Then

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

(56)

IVP of ODE

20

We introduce the backward difference notation

∇f (xi) = f (xi) − f (xi−1)

and

kf (xi) = ∇k−1f (xi) − ∇k−1f (xi−1) = ∇ ∇k−1f (xi) ,

for i = 0, 1, . . . , n − 1.

Let Pm−1(x) be the Newton backward difference polynomial through (xi, f (xi, y(xi))), (xi−1, f (xi−1, y(xi−1))), . . ., (xi+1−m, f (xi+1−m, y(xi+1−m))), i.e.,

Pm−1(x) =

m−1

X

k=0

(−1)k

−s k

∇kf (xi, y(xi))

where x = xi + sh. Then

Department of Mathematics – NTNU Tsung-Min Hwang December 8, 2003

參考文獻

相關文件

Department of Mathematics National Cheng Kung

Department of Mathematics National Cheng Kung

Department of Mathematics National Cheng Kung

Department of Mathematics National Cheng Kung

Department of Mathematics National Cheng Kung University.. Theorem (Change

Department of Mathematics National Cheng

Location:Penghu Maker Base (Integrated Practice Building 5F, No. 63, Minzu Rd., Magong City, Penghu County). Content:The teacher will demonstrate and teach the thick

Take a time step on current grid to update cell averages of volume fractions at next time step (b) Interface reconstruction. Find new interface location based on volume