IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of...

83
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

Transcript of IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of...

Page 1: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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

Page 2: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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

Page 3: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 3

In this chapter, we discuss numerical methods for solving ordinary differential equations of

initial-value problems (IVP) of the form

y′ = 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

Page 4: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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

Page 5: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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

Page 6: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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

Page 7: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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

Page 8: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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)y′(xi) +

(xi+1 − xi)2

2y′′(ξi)

= y(xi) + hy′(xi) +h2

2y′′(ξi) (3)

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

2y′′(ξi)

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

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

Page 9: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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)y′(xi) +

(xi+1 − xi)2

2y′′(ξi)

= y(xi) + hy′(xi) +h2

2y′′(ξi) (3)

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

2y′′(ξi)

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

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

Page 10: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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)y′(xi) +

(xi+1 − xi)2

2y′′(ξi)

= y(xi) + hy′(xi) +h2

2y′′(ξi) (3)

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

2y′′(ξi)

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

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

Page 11: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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)) = y′(xi) =y(xi+1) − y(xi)

h+

h

2y′′(ξi)

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

y∗

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

yk+1 = yk +h

2

[

f(xk, yk) + f(xk+1, y∗

k+1)]

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

Page 12: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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)) = y′(xi) =y(xi+1) − y(xi)

h+

h

2y′′(ξi)

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

y∗

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

yk+1 = yk +h

2

[

f(xk, yk) + f(xk+1, y∗

k+1)]

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

Page 13: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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)) = y′(xi) =y(xi+1) − y(xi)

h+

h

2y′′(ξi)

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

y∗

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

yk+1 = yk +h

2

[

f(xk, yk) + f(xk+1, y∗

k+1)]

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

Page 14: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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)) = y′(xi) =y(xi+1) − y(xi)

h+

h

2y′′(ξi)

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

y∗

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

yk+1 = yk +h

2

[

f(xk, yk) + f(xk+1, y∗

k+1)]

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

Page 15: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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 + 5e−2x]

.

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 20.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

Page 16: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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 + 5e−2x]

.

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 20.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

Page 17: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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 + 5e−2x]

.

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 20.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

Page 18: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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) + hy′(x) +h2

2y′′ +

h3

2y′′′ + . . .

= y(x) + hy′(x) +h2

2y′′ + O(h3)

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

Page 19: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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) + hy′(x) +h2

2y′′ +

h3

2y′′′ + . . .

= y(x) + hy′(x) +h2

2y′′ + O(h3)

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

Page 20: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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) + hy′(x) +h2

2y′′ +

h3

2y′′′ + . . .

= y(x) + hy′(x) +h2

2y′′ + O(h3)

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

Page 21: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 10

By differentiating y(x), we have

y′ = f(x, y) ≡ f

y′′ =d

dxf = fx + fyy′ = fx + fyf

y′′′ = fxx + fxyf + fd

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

Page 22: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 10

By differentiating y(x), we have

y′ = f(x, y) ≡ f

y′′ =d

dxf = fx + fyy′ = fx + fyf

y′′′ = fxx + fxyf + fd

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

Page 23: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 10

By differentiating y(x), we have

y′ = f(x, y) ≡ f

y′′ =d

dxf = fx + fyy′ = fx + fyf

y′′′ = fxx + fxyf + fd

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

Page 24: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 10

By differentiating y(x), we have

y′ = f(x, y) ≡ f

y′′ =d

dxf = fx + fyy′ = fx + fyf

y′′′ = fxx + fxyf + fd

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

Page 25: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 10

By differentiating y(x), we have

y′ = f(x, y) ≡ f

y′′ =d

dxf = fx + fyy′ = fx + fyf

y′′′ = fxx + fxyf + fd

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

Page 26: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 11

Then

y(x + h) = y + hy′ +h2

2y′′ + 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 + hffy + O(h2)

⇒ f + hfx + hffy ≈ 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

Page 27: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 11

Then

y(x + h) = y + hy′ +h2

2y′′ + 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 + hffy + O(h2)

⇒ f + hfx + hffy ≈ 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

Page 28: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 11

Then

y(x + h) = y + hy′ +h2

2y′′ + 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 + hffy + O(h2)

⇒ f + hfx + hffy ≈ 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

Page 29: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 11

Then

y(x + h) = y + hy′ +h2

2y′′ + 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 + hffy + O(h2)

⇒ f + hfx + hffy ≈ 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

Page 30: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 11

Then

y(x + h) = y + hy′ +h2

2y′′ + 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 + hffy + O(h2)

⇒ f + hfx + hffy ≈ 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

Page 31: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 11

Then

y(x + h) = y + hy′ +h2

2y′′ + 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 + hffy + O(h2)

⇒ f + hfx + hffy ≈ 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

Page 32: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 11

Then

y(x + h) = y + hy′ +h2

2y′′ + 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 + hffy + O(h2)

⇒ f + hfx + hffy ≈ 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

Page 33: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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

Page 34: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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

Page 35: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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

Page 36: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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

Page 37: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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

Page 38: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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 + 1

2F1)

F3 = hf(x + 12h, y + 1

2F2)

F4 = hf(x + h, y + F3)

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

Page 39: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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 + 1

2F1)

F3 = hf(x + 12h, y + 1

2F2)

F4 = hf(x + h, y + F3)

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

Page 40: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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 + 1

2F1)

F3 = hf(x + 12h, y + 1

2F2)

F4 = hf(x + h, y + F3)

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

Page 41: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 14

Algorithm 2 Algorithm for fourth-order Runge-Kutta mehtod :

For k = 0, 1, 2, . . .

xk+ 12

= xk + 12h

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

F1 = hf(xk, yk)

F2 = hf(xk+ 12, yk + 1

2F1)

F3 = hf(xk+ 12, yk + 1

2F2)

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

Page 42: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 15

4 – Multistep Methods

Example 2 (Stiff problem, van der Pol equation)

y′

1 = y2,

y′

2 = µ(1 − y21)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.5Solution of van der Pol Equation, µ = 1000

time t

solu

tion

y 1

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

Page 43: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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

solu

tion

y 1

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

Page 44: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 17

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

y′ = 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

Page 45: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 17

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

y′ = 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

Page 46: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 17

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

y′ = 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

Page 47: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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

Page 48: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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

Page 49: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 19

Derivation of the multistep methods:

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

∫ xi+1

xi

y′(x)dx =

∫ xi+1

xi

f(x, y(x))dx

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

∫ 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 +

∫ 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

Page 50: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 19

Derivation of the multistep methods:

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

∫ xi+1

xi

y′(x)dx =

∫ xi+1

xi

f(x, y(x))dx

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

∫ 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 +

∫ 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

Page 51: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 19

Derivation of the multistep methods:

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

∫ xi+1

xi

y′(x)dx =

∫ xi+1

xi

f(x, y(x))dx

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

∫ 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 +

∫ 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

Page 52: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 19

Derivation of the multistep methods:

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

∫ xi+1

xi

y′(x)dx =

∫ xi+1

xi

f(x, y(x))dx

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

∫ 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 +

∫ 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

Page 53: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 19

Derivation of the multistep methods:

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

∫ xi+1

xi

y′(x)dx =

∫ xi+1

xi

f(x, y(x))dx

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

∫ 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 +

∫ 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

Page 54: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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∑

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

Page 55: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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∑

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

Page 56: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

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∑

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

Page 57: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 21

f(x, y(x)) = Pm−1(x) +f (m)(ξi, y(ξi))

m!(x − xi)(x − xi−1) · · · (x − xi+1−m)

=Pm−1(x) +hmf (m)(ξi, y(ξi))

m!s(s + 1) · · · (s + m − 1)

for some ξi ∈ (xi+1−m, xi). Hence

∫ xi+1

xi

f(x, y(x))dx =

∫ xi+1

xi

m−1∑

k=0

(−1)k

−s

k

∇kf(xi, y(xi))dx

+

∫ xi+1

xi

hmf (m)(ξi, y(ξi))

m!s(s + 1) · · · (s + m − 1)dx

=m−1∑

k=0

∇kf(xi, y(xi))h(−1)k

∫ 1

0

−s

k

ds

+hm+1

m!

∫ 1

0

s(s + 1) · · · (s + m − 1)f (m)(ξi, y(ξi))ds

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

Page 58: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 21

f(x, y(x)) = Pm−1(x) +f (m)(ξi, y(ξi))

m!(x − xi)(x − xi−1) · · · (x − xi+1−m)

=Pm−1(x) +hmf (m)(ξi, y(ξi))

m!s(s + 1) · · · (s + m − 1)

for some ξi ∈ (xi+1−m, xi). Hence

∫ xi+1

xi

f(x, y(x))dx =

∫ xi+1

xi

m−1∑

k=0

(−1)k

−s

k

∇kf(xi, y(xi))dx

+

∫ xi+1

xi

hmf (m)(ξi, y(ξi))

m!s(s + 1) · · · (s + m − 1)dx

=m−1∑

k=0

∇kf(xi, y(xi))h(−1)k

∫ 1

0

−s

k

ds

+hm+1

m!

∫ 1

0

s(s + 1) · · · (s + m − 1)f (m)(ξi, y(ξi))ds

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

Page 59: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 21

f(x, y(x)) = Pm−1(x) +f (m)(ξi, y(ξi))

m!(x − xi)(x − xi−1) · · · (x − xi+1−m)

=Pm−1(x) +hmf (m)(ξi, y(ξi))

m!s(s + 1) · · · (s + m − 1)

for some ξi ∈ (xi+1−m, xi). Hence

∫ xi+1

xi

f(x, y(x))dx =

∫ xi+1

xi

m−1∑

k=0

(−1)k

−s

k

∇kf(xi, y(xi))dx

+

∫ xi+1

xi

hmf (m)(ξi, y(ξi))

m!s(s + 1) · · · (s + m − 1)dx

=m−1∑

k=0

∇kf(xi, y(xi))h(−1)k

∫ 1

0

−s

k

ds

+hm+1

m!

∫ 1

0

s(s + 1) · · · (s + m − 1)f (m)(ξi, y(ξi))ds

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

Page 60: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 21

f(x, y(x)) = Pm−1(x) +f (m)(ξi, y(ξi))

m!(x − xi)(x − xi−1) · · · (x − xi+1−m)

=Pm−1(x) +hmf (m)(ξi, y(ξi))

m!s(s + 1) · · · (s + m − 1)

for some ξi ∈ (xi+1−m, xi). Hence

∫ xi+1

xi

f(x, y(x))dx =

∫ xi+1

xi

m−1∑

k=0

(−1)k

−s

k

∇kf(xi, y(xi))dx

+

∫ xi+1

xi

hmf (m)(ξi, y(ξi))

m!s(s + 1) · · · (s + m − 1)dx

=m−1∑

k=0

∇kf(xi, y(xi))h(−1)k

∫ 1

0

−s

k

ds

+hm+1

m!

∫ 1

0

s(s + 1) · · · (s + m − 1)f (m)(ξi, y(ξi))ds

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

Page 61: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 22

k 0 1 2 3 4 5

(−1)k∫ 1

0

−s

k

ds 1 12

512

38

251720

95288

Since s(s + 1) · · · (s + m − 1) does not change sign on [0, 1], by the Weighted Mean

Value Theorem for Integrals, ∃ µi ∈ (xi, xi+1) such that

hm+1

m!

∫ 1

0

s(s + 1) · · · (s + m − 1)f (m)(ξi, y(ξi))ds

=hm+1f (m)(µi, y(µi))

m!

∫ 1

0

s(s + 1) · · · (s + m − 1)ds

= hm+1f (m)(µi, y(µi))(−1)m

∫ 1

0

−s

m

ds

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

Page 62: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 22

k 0 1 2 3 4 5

(−1)k∫ 1

0

−s

k

ds 1 12

512

38

251720

95288

Since s(s + 1) · · · (s + m − 1) does not change sign on [0, 1], by the Weighted Mean

Value Theorem for Integrals, ∃ µi ∈ (xi, xi+1) such that

hm+1

m!

∫ 1

0

s(s + 1) · · · (s + m − 1)f (m)(ξi, y(ξi))ds

=hm+1f (m)(µi, y(µi))

m!

∫ 1

0

s(s + 1) · · · (s + m − 1)ds

= hm+1f (m)(µi, y(µi))(−1)m

∫ 1

0

−s

m

ds

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

Page 63: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 23

Therefore,

y(xi+1) = y(xi) + h

[

f(xi, y(xi)) +1

2∇f(xi, y(xi))

+5

12∇2f(xi, y(xi)) + · · ·

]

+hm+1f (m)(µi, y(µi))(−1)m

∫ 1

0

−s

m

ds

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

Page 64: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 24

Predictor-Corrector Method:

Using explicit method as a predictor:

w(0)i+1 = am−1wi + am−2wi−1 + · · · + a0wi+1−m

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

Using implicit method as a corrector:

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

+h[

bmf(xi+1, w(0)i+1) + bm−1f(xi, wi)

+ · · · + b0f(xi+1−m, wi+1−m)]

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

Page 65: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 24

Predictor-Corrector Method:

Using explicit method as a predictor:

w(0)i+1 = am−1wi + am−2wi−1 + · · · + a0wi+1−m

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

Using implicit method as a corrector:

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

+h[

bmf(xi+1, w(0)i+1) + bm−1f(xi, wi)

+ · · · + b0f(xi+1−m, wi+1−m)]

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

Page 66: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 24

Predictor-Corrector Method:

Using explicit method as a predictor:

w(0)i+1 = am−1wi + am−2wi−1 + · · · + a0wi+1−m

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

Using implicit method as a corrector:

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

+h[

bmf(xi+1, w(0)i+1) + bm−1f(xi, wi)

+ · · · + b0f(xi+1−m, wi+1−m)]

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

Page 67: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 25

5 – Systems and Higher-Order Ordinary Differential Equations

Consider a system of first-order ODE’s.

y′

1 = f1(x, y1, y2, . . . , yn)

y′

2 = f2(x, y1, y2, . . . , yn)...

y′

n = fn(x, y1, y2, . . . , yn)

with initial conditions

y1(x0) = y01

y2(x0) = y02

...

yn(x0) = y0n

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

Page 68: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 26

Define

Y =

y1

y2

...

yn

, F =

f1

f2

...

fn

, Y0 =

y01

y02

...

y0n

and transform the system into vector form

Y′

= F (x, Y )

Y (x0) = Y0

The Runge-Kutta methods can be easily extended to vector form.

An higher order ODE can be converted into a system of first-order

equations, hence higher-order ODEs can be solved in vector form.

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

Page 69: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 26

Define

Y =

y1

y2

...

yn

, F =

f1

f2

...

fn

, Y0 =

y01

y02

...

y0n

and transform the system into vector form

Y′

= F (x, Y )

Y (x0) = Y0

The Runge-Kutta methods can be easily extended to vector form.

An higher order ODE can be converted into a system of first-order

equations, hence higher-order ODEs can be solved in vector form.

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

Page 70: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 26

Define

Y =

y1

y2

...

yn

, F =

f1

f2

...

fn

, Y0 =

y01

y02

...

y0n

and transform the system into vector form

Y′

= F (x, Y )

Y (x0) = Y0

The Runge-Kutta methods can be easily extended to vector form.

An higher order ODE can be converted into a system of first-order

equations, hence higher-order ODEs can be solved in vector form.

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

Page 71: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 27

Example 4

(sin x)y′′′ + cos(xy) + sin(x2 + y′′) + (y′)3 = log x

y(2) = 7, y′(2) = 3, y′′(2) = −4

Solution: Let u1 = y, u2 = y′, and u3 = y′′

(sinx)y′′′ + cos(xy) + sin(x2 + y′′) + (y′)3 = log x

⇒ (sinx)u′

3 + cos(xu1) + sin(x2 + u3) + (u2)3 = log x

⇒ u′

3 =[

log x − cos(xu1) − sin(x2 + u3) − (u2)3]

/ sinx

Therefore,

u′

1 = u2

u′

2 = u3

u′

3 = [log x − cos(xu1) − sin(x2 + u3) − u32]/ sinx

with u1(2) = 7, u2(2) = 3 and u3(2) = −4.

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

Page 72: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 27

Example 4

(sin x)y′′′ + cos(xy) + sin(x2 + y′′) + (y′)3 = log x

y(2) = 7, y′(2) = 3, y′′(2) = −4

Solution: Let u1 = y, u2 = y′, and u3 = y′′

(sinx)y′′′ + cos(xy) + sin(x2 + y′′) + (y′)3 = log x

⇒ (sinx)u′

3 + cos(xu1) + sin(x2 + u3) + (u2)3 = log x

⇒ u′

3 =[

log x − cos(xu1) − sin(x2 + u3) − (u2)3]

/ sinx

Therefore,

u′

1 = u2

u′

2 = u3

u′

3 = [log x − cos(xu1) − sin(x2 + u3) − u32]/ sinx

with u1(2) = 7, u2(2) = 3 and u3(2) = −4.

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

Page 73: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 27

Example 4

(sin x)y′′′ + cos(xy) + sin(x2 + y′′) + (y′)3 = log x

y(2) = 7, y′(2) = 3, y′′(2) = −4

Solution: Let u1 = y, u2 = y′, and u3 = y′′

(sinx)y′′′ + cos(xy) + sin(x2 + y′′) + (y′)3 = log x

⇒ (sinx)u′

3 + cos(xu1) + sin(x2 + u3) + (u2)3 = log x

⇒ u′

3 =[

log x − cos(xu1) − sin(x2 + u3) − (u2)3]

/ sinx

Therefore,

u′

1 = u2

u′

2 = u3

u′

3 = [log x − cos(xu1) − sin(x2 + u3) − u32]/ sinx

with u1(2) = 7, u2(2) = 3 and u3(2) = −4.

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

Page 74: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 27

Example 4

(sin x)y′′′ + cos(xy) + sin(x2 + y′′) + (y′)3 = log x

y(2) = 7, y′(2) = 3, y′′(2) = −4

Solution: Let u1 = y, u2 = y′, and u3 = y′′

(sinx)y′′′ + cos(xy) + sin(x2 + y′′) + (y′)3 = log x

⇒ (sinx)u′

3 + cos(xu1) + sin(x2 + u3) + (u2)3 = log x

⇒ u′

3 =[

log x − cos(xu1) − sin(x2 + u3) − (u2)3]

/ sinx

Therefore,

u′

1 = u2

u′

2 = u3

u′

3 = [log x − cos(xu1) − sin(x2 + u3) − u32]/ sinx

with u1(2) = 7, u2(2) = 3 and u3(2) = −4.

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

Page 75: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 27

Example 4

(sin x)y′′′ + cos(xy) + sin(x2 + y′′) + (y′)3 = log x

y(2) = 7, y′(2) = 3, y′′(2) = −4

Solution: Let u1 = y, u2 = y′, and u3 = y′′

(sinx)y′′′ + cos(xy) + sin(x2 + y′′) + (y′)3 = log x

⇒ (sinx)u′

3 + cos(xu1) + sin(x2 + u3) + (u2)3 = log x

⇒ u′

3 =[

log x − cos(xu1) − sin(x2 + u3) − (u2)3]

/ sinx

Therefore,

u′

1 = u2

u′

2 = u3

u′

3 = [log x − cos(xu1) − sin(x2 + u3) − u32]/ sinx

with u1(2) = 7, u2(2) = 3 and u3(2) = −4.

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

Page 76: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 28

Let

U =

u1

u2

u3

, F =

u2

u3[

log x − cos(xu1) − sin(x2 + u3) − u32

]

/ sinx

,

and U0 =[

7 3 −4]T

, x0 = 2.

Then the higher-order ODE

becomes

U ′ = F (x, U)

U(x0) = U0

and can be solved by Runge-Kutta methods.

Truncate Taylor series:

yi(x + h) = yi(x) + hy′

i(x) +h2

2!y′′

i (x) + · · · +hn

n!y(n)i (x)

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

Page 77: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 28

Let

U =

u1

u2

u3

, F =

u2

u3[

log x − cos(xu1) − sin(x2 + u3) − u32

]

/ sinx

,

and U0 =[

7 3 −4]T

, x0 = 2. Then the higher-order ODE

becomes

U ′ = F (x, U)

U(x0) = U0

and can be solved by Runge-Kutta methods.

Truncate Taylor series:

yi(x + h) = yi(x) + hy′

i(x) +h2

2!y′′

i (x) + · · · +hn

n!y(n)i (x)

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

Page 78: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 28

Let

U =

u1

u2

u3

, F =

u2

u3[

log x − cos(xu1) − sin(x2 + u3) − u32

]

/ sinx

,

and U0 =[

7 3 −4]T

, x0 = 2. Then the higher-order ODE

becomes

U ′ = F (x, U)

U(x0) = U0

and can be solved by Runge-Kutta methods.

Truncate Taylor series:

yi(x + h) = yi(x) + hy′

i(x) +h2

2!y′′

i (x) + · · · +hn

n!y(n)i (x)

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

Page 79: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 29

⇒ Y (x + h) = Y (x) + hY ′(x) +h2

2!Y ′′(x) + · · · +

hn

n!Y (n)(x)

The classical fourth-order Runge-Kunge-Kutta formula, in vector form, are

Y (x + h) = Y (x) +h

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

where

F1 = F (Y )

F2 = F (Y + 12F1)

F3 = F (Y + 12F2)

F4 = F (Y + F3)

Example 5 Compute the solution the following initial-value problem on

−2 ≤ t ≤ 1.

x′ = x + y2 − t3, x(1) = 3

y′ = y + x3 + cos t, y(1) = 1.

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

Page 80: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 29

⇒ Y (x + h) = Y (x) + hY ′(x) +h2

2!Y ′′(x) + · · · +

hn

n!Y (n)(x)

The classical fourth-order Runge-Kunge-Kutta formula, in vector form, are

Y (x + h) = Y (x) +h

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

where

F1 = F (Y )

F2 = F (Y + 12F1)

F3 = F (Y + 12F2)

F4 = F (Y + F3)

Example 5 Compute the solution the following initial-value problem on

−2 ≤ t ≤ 1.

x′ = x + y2 − t3, x(1) = 3

y′ = y + x3 + cos t, y(1) = 1.

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

Page 81: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 29

⇒ Y (x + h) = Y (x) + hY ′(x) +h2

2!Y ′′(x) + · · · +

hn

n!Y (n)(x)

The classical fourth-order Runge-Kunge-Kutta formula, in vector form, are

Y (x + h) = Y (x) +h

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

where

F1 = F (Y )

F2 = F (Y + 12F1)

F3 = F (Y + 12F2)

F4 = F (Y + F3)

Example 5 Compute the solution the following initial-value problem on

−2 ≤ t ≤ 1.

x′ = x + y2 − t3, x(1) = 3

y′ = y + x3 + cos t, y(1) = 1.

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

Page 82: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 30

Matlab program for Example 5.

format long e

clear all

TSPAN = 1:-0.01:-2;

y0(1) = 3; y0(2) = 1;

[T,Y] = ode45(’fun ex2’,TSPAN,y0);

plot(T,Y(:,1),’b-’,T,Y(:,2),’r-.’);

legend(’x-curve’,’y-curve’)

ODE function

function [DY] = fun ex2(T,Y)

DY(1,1) = Y(1) + Y(2)*Y(2) - T * T * T;

DY(2,1) = Y(2) + Y(1) * Y(1) * Y(1) + cos(T);

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

Page 83: IVP of ODE - math.ntnu.edu.twmath.ntnu.edu.tw/~min/Numerical_Analysis/2004/IVP_ode.pdf · IVP of ODE 3 In this chapter, we discuss numerical methods for solving ordinary differential

IVP of ODE 31

−2 −1.5 −1 −0.5 0 0.5 1−30

−20

−10

0

10

20

30

40

50

60x−curvey−curve

Figure 1: Solution curves for Example 5.

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