Derivation of the Coefficients for a Second-Order Runge-Kutta Method, Assignments of Mathematical Methods for Numerical Analysis and Optimization

A solution to the problem of deriving the coefficients α, β1, and β2 for a second-order runge-kutta method. The document uses the quadrature formula and the taylor expansion to derive the equations for the coefficients. The document also includes a proof of convergence for the 'θ method'.

Typology: Assignments

Pre 2010

Uploaded on 08/26/2009

koofers-user-no0
koofers-user-no0 🇺🇸

10 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Jeffrey Hellrung
Friday, October 21, 2005
Math 269A, Assignment 03
Theory Work
1. Consider the two stage Runge-Kutta method
y=yn+αdtf(yn),
yn+1 =yn+dt (β1f(yn) + β2f(y)) .
Derive the equations for α,β1, and β2that give a second order method.
Solution
We use the quadrature formula
y(t+h) = y(t) + Zt+h
t
y(x)dx =y(t) + Zt+h
t
f(y(x))dx.
Now if we set
P1(x) = f(y(t)) = y(t),
then Pagrees with fat t, and further, for x[t, t +h],
y(x) = f(y(x)) = P1(x) + y′′(α1)(xt)
for some α1[t, t +h], hence
|f(x)P1(x)| |y′′(α1)|hM0M1h,
since y′′ = (fy)·(fy), where
M0= sup
[t,t+h]
fy,
M1= sup
[t,t+h]
fy.
Thus ¯
¯
¯
¯
¯Zt+h
t
f(x)dx Zt+h
t
P1(x)dx¯
¯
¯
¯
¯
M0M1h2,
and
Zt+h
t
P1(x)dx =f(y(t))h.
If we denote
y=y(t) + f(y(t))h,
it follows that
|y(t+h)y| M0M1h2.
Now if we set
P2(x) = x(t+h)
t(t+h)f(y(t)) + xt
(t+h)tf(y(t+h)),
then P2agrees with fat tand t+h, and further, for x[t, t +h],
f(x) = P2(x) + y′′′(α2)
2! (xt)(x(t+h))
1
pf3
pf4
pf5

Partial preview of the text

Download Derivation of the Coefficients for a Second-Order Runge-Kutta Method and more Assignments Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

Jeffrey Hellrung

Friday, October 21, 2005

Math 269A, Assignment 03

Theory Work

  1. Consider the two stage Runge-Kutta method

y

∗ = yn + αdtf (yn),

yn+1 = yn + dt (β 1 f (yn) + β 2 f (y

∗ )).

Derive the equations for α, β 1 , and β 2 that give a second order method.

Solution

We use the quadrature formula

y(t + h) = y(t) +

t+h

t

y

′ (x)dx = y(t) +

t+h

t

f (y(x))dx.

Now if we set

P 1 (x) = f (y(t)) = y

′ (t),

then P agrees with f at t, and further, for x ∈ [t, t + h],

y

′ (x) = f (y(x)) = P 1 (x) + y

′′ (α 1 )(x − t)

for some α 1 ∈ [t, t + h], hence

|f (x) − P 1 (x)| ≤ |y

′′ (α 1 )| h ≤ M 0 M 1 h,

since y

′′ = (f

′ ◦ y) · (f ◦ y), where

M 0 = sup [t,t+h]

f ◦ y,

M 1 = sup [t,t+h]

f

′ ◦ y.

Thus (^) ∣ ∣ ∣ ∣ ∣

∫ (^) t+h

t

f (x)dx −

∫ (^) t+h

t

P 1 (x)dx

≤ M 0 M 1 h

2 ,

and ∫ (^) t+h

t

P 1 (x)dx = f (y(t))h.

If we denote

y

∗ = y(t) + f (y(t))h,

it follows that

|y(t + h) − y

∗ | ≤ M 0 M 1 h

2 .

Now if we set

P 2 (x) =

x − (t + h)

t − (t + h)

f (y(t)) +

x − t

(t + h) − t

f (y(t + h)),

then P 2 agrees with f at t and t + h, and further, for x ∈ [t, t + h],

f (x) = P 2 (x) +

y

′′′ (α 2 )

(x − t)(x − (t + h))

for some α 2 ∈ [t, t + h]. Hence, as above

|f (x) − P 2 (x)| ≤

|y

′′′ (α 2 )|

h

M 2 M

2 0

+ M

2 1

M 0

h

2 = C 1 h

2 ,

where M 0 , M 1 are as above and

M 2 = sup [t,t+h]

f

′′ ◦ y.

Thus (^) ∣ ∣ ∣ ∣ ∣

t+h

t

f (x)dx −

t+h

t

P 2 (x)dx

≤ C 1 h

3 ,

and ∫ t+h

t

P 2 (x)dx =

h

(f (y(t)) + f (y(t + h))).

Note that the polynomial

Q 2 (x) =

x − (t + h)

t − (t + h)

f (y(t)) +

x − t

(t + h) − t

f (y

∗ )

differs from P 2 on [t, t + h] by no more than

|P 2 (x) − Q 2 (x)| ≤ |f (y(t)) − f (y

∗ )| ≤ M 1 |y(t) − y

∗ | ≤ M 0 M

2 1 h

2 = C 2 h

2 ,

hence (^) ∣ ∣ ∣ ∣ ∣

t+h

t

P 2 (x) −

t+h

t

Q 2 (x)

≤ C 2 h

3

and ∫ t+h

t

Q 2 (x)dx =

h

(f (y(t)) + f (y

∗ )).

By the triangle inequality, then

∣ ∣ ∣ ∣ y(t + h) −

y(t) +

h

(f (y(t)) + f (y

∗ ))

≤ (C 1 + C 2 )h

3 .

Thus, we set

α = 1, β 1 =

, β 2 =

For a general condition, we know that, by a Taylor expansion,

y(t + h) = y(t) + y

′ (t)h +

1 2 y

′′ (t)h

2

  • O(h

3 )

= y(t) + f (y(t))h +

1 2 f

′ (y(t))f (y(t))h

2

  • O(h

3 )

We can Taylor expand f (y

∗ ) to obtain

f (y ∗ ) = f (y(t) + αf (y(t))h)

= f (y(t)) + αf ′ (y(t))f (y(t))h + O(h 2 )

hence

y(t) + h (β 1 f (y(t)) + β 2 f (y

∗ )) = y(t) + (β 1 + β 2 ) f (y(t))h + αβ 2 f

′ (y(t))f (y(t))h

2

  • O(h

3 ),

so, by matching up the coefficients on corresponding powers of h in the expansion of y(t + h), we get

a second-order method when

β 1 + β 2 = 1, αβ 2 =

  1. Test your Runge-Kutta implementation by using it to compute an approximate solution to the equation

in problem 2. of Assignment 02,

dy/dt = − 2 y

2 ,

y(0) = 1

for t ∈ [0, T ].

(a) Compute the solution to time t = 2.0 and report the error in the solution that is obtained with

timesteps of size 0.1, 0.05, and 0.025.

(b) Give an estimate for the rate of convergence derived from your error data.

Solution

(a)

h (yN − y(2.0))/|y(2.0)|

  1. 1 − 0. 00357319

  2. 05 − 0. 000847975

  3. 025 − 0. 000206015

(b) The ratio of the magnitudes of successive relative errors is close to 4 = 2 2 , suggesting convergence

in h 2 :

  1. 00357319
  1. Test your Runge-Kutta implementation by using it to compute an approximate solution to the equation

in problem 4. of Assignment 02,

dy

dt

y, y(0) =

(a) Give the error in the numerical solution at t = 10.0 using timesteps dt = 1. 0 , 0. 1 , 0. 05 , 0 .025.

(b) Give an estimate of the rate of convergence based on your error data.

(c) Give the computed solution values at t = 10.0 for the harmonic oscillator problem when a = 0. 1

and b = 1.0 using a timesteps of 0.1, 0.05, and 0.025.

(d) Give an estimate of the rate of convergence based on your solution values.

Solution

(a)

h (yN − y(10.0))/|y(10.0)|

(b) The ratio of the magnitudes of successive relative errors is close to 4 = 2 2 for the last 3 errors,

suggesting convergence in h 2 :

(c)

h yN

(d) We compute the ratio of the differences in successive approximations to obtain

which suggests convergence in h 2 .