0% found this document useful (0 votes)
29 views3 pages

Homework Set No. 9: 1. Scalar ODE

The document describes several homework problems involving numerical methods for solving ordinary differential equations (ODEs). Problem 1 involves implementing Euler's method, Heun's method, and Runge-Kutta methods to solve a scalar ODE, as well as implementing Adams-Bashforth-Moulton multi-step methods. Problem 2 rewrites a second order ODE as a system of first order equations and solves it using various numerical methods. Problem 3 sets up a system of 4 first order ODEs modeling the motion of objects in space, and solves it using MATLAB's ode45 solver as well as Euler's and Runge-Kutta methods, comparing the results.

Uploaded by

kelbmuts
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views3 pages

Homework Set No. 9: 1. Scalar ODE

The document describes several homework problems involving numerical methods for solving ordinary differential equations (ODEs). Problem 1 involves implementing Euler's method, Heun's method, and Runge-Kutta methods to solve a scalar ODE, as well as implementing Adams-Bashforth-Moulton multi-step methods. Problem 2 rewrites a second order ODE as a system of first order equations and solves it using various numerical methods. Problem 3 sets up a system of 4 first order ODEs modeling the motion of objects in space, and solves it using MATLAB's ode45 solver as well as Euler's and Runge-Kutta methods, comparing the results.

Uploaded by

kelbmuts
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Homework Set No.

9
1. Scalar ODE

Consider the following ordinary differential equation:

x′ = 2x2 + x − 1, x(1) = 1.

(a) Write out the Euler’s method for this ODE. Compute the value x(1.2) by Euler’s
method, with h = 0.1.

(b) Write out the Heun’s method for this ODE. Compute the value x(1.2) by Heun’s
method, with h = 0.1.

(c) Write out the classic 4th order Runge-Kutta method for this ODE. Compute the
value x(1.2) by 4th order Runge-Kutta’s method, with h = 0.1.

d) (*Bonus) Write out the 2nd order Adams-Bashforth-Moulton method for this
ODE. Note that this is a multi-step method. It needs 2 initial values, i.e., x0
and x1 , to initiate the iterations. For the 2nd initial value x1 , you could use the
result you obtained in part (b) with Heun’s method. Please compute the values
x(1.2) and x(1.3) by ABM method.

NB! Do not use Matlab for these computation.

2. System and higher order ODEs

Given the equation:


x′′ − tx = 0, x(0) = 1, x′ (0) = 1
Rewrite it into the form of a system of 1st order equations.
Compute x1 = x(0.1) and x2 = x(0.2) with 2 time steps using h = 0.1, with the following
methods:

a) Euler’s method,

b) A 2nd order Runge-Kutta method,

c) A 4th order Runge-Kutta method,

d) (*Bonus) The 2nd order Adams-Bashforth-Moulton method. Note that this is a


multi-step method. For the 2nd initial value x1 , you can use the solution x1 from
b). For this method, please compute x(0.2) and x(0.3).

NB! Do not use Matlab for these computation.

1
3. Matlab solvers: a case study in astronomy

The following problem is taken from astronomy. Suppose we have two space objects
with mass 1 − µ and µ in circular rotation in the space. We can think of these two
space objects as the earth and the moon, where the moon moves around the earth with
distance 1. (This is a normalized distance.) A third object, which is relatively much
smaller than the first two, such that it would not make any change in the orbits of the
first two, is also moving in the space. You can think of this as a space-ship.
The equations below describes the movement of the third object, i.e. the spaceship. We
consider a two space dimensional case. Let the position of the earth be the origin of our
coordinate. The solution (y1 (t), y2 (t)) would give the position of the third object.
The equations are given as:

y1 + µ y1 − ν
y1′′ = y1 + 2y2′ − ν −µ
D1 D2
y2 y2
y2′′ ′
= y2 − 2y1 − ν −µ
D1 D2
2 2 3/2
D1 = ((y1 + µ) + y2 )
D2 = ((y1 − ν)2 + y22 )3/2
µ = 0.012277471,
ν = 1 − µ.

With the initial conditions


y1 (0) = 0.994,
y1′ (0) = 0,
y2 (0) = 0,
y2′ (0) = −2.0015851063790825.

It is known that the solutions would become periodic, i.e., the object will following a
certain orbit. When t = 17.065211656 it would complete one full round of its orbit.

You need to do the following:

(a) Rewrite the system into a system of 4 first order ODEs.

(b) Use Matlab function ‘ode45’ to solve the system of ODEs over one period. Draw
the orbit.

(c) Write a program that would solve the system one more time with Euler’s method,
using 24000 uniform time steps.

(d) Write a program that would solve the system with the classical 4th order Runge-
Kutta method, but reduce the step number to 6000.

2
(e) The total computation amounts in (c) and (d) are the about the same. Compare
these two solutions. Do you think any of them is acceptable? Give your arguments
here.

(f ) Also find out how many steps ‘ode45’ used for computing the solution over one
period. Can you explain why ’ode45’ uses much fewer steps but still get a much
better solution than the other two methods?

(g) Even though the exact solution is periodic, a small error (for example, some per-
turbation in initial condition) could throw the object out of its orbit. This means
that the numerical error, which in other cases might be invisible, could have big
consequences in this case. In order to see this effect, you could try to solve the
system with ‘ode45’ over 3 periods. What accuracy (error tolerance) you must
require to get a acceptable result? (In this case, “acceptable” means that the plot
of the solution looks reasonable to you.)

Hand in whatever you think is relevant. Have fun!

You might also like