Sale!

MACM 316 – Assignment 8

$30.00

Rate this product

MACM 316 – Assignment 8
A. Computing Assignment – Numerical Solution of Kepler’s problem
One of science’s great achievements was the discovery of Kepler’s laws for planetary motion; in
particular, that the planets follow closed elliptical orbits around the sun. In this assignment you
will compare different numerical methods for solving Kepler’s problem for the motion of a simple
solar system consisting of two planets (the two-body problem).
For a system of two planets, we may assume one is fixed at the origin with the motion of the other
planet being in a 2D plane. Let
q(t) = 
q1(t)
q2(t)

, p(t) = 
p1(t)
p2(t)

,
be the position and momentum vectors of the moving planet, respectively. Kepler’s laws give the
following ordinary differential equation for q(t) and p(t):
q

(t) = p(t), p

(t) = −
1
(q1(t)
2 + q2(t)
2)
3/2
q(t). (1)
1. Write a code that implements Euler’s method for this problem for time 0 ≤ t ≤ T = 200 and
stepsize h = 0.0005. Use the initial conditions
q1(0) = 1 − e, q2(0) = 0, p1(0) = 0, p2(0) = r
1 + e
1 − e
, e = 0.6.
Plot your output in the q1-q2 plane, i.e. plot the approximate position of the moving planet at
time tn for n = 0, 1, . . . , N, where N = ⌈T /h⌉. Briefly describe the qualitative behaviour of the
numerical solution.
2. The ODE (1) has several conserved quantities, including the angular momentum A(t) and
Hamiltonian H(t), defined by
A(t) = q1(t)p2(t) − q2(t)p1(t), H(t) = 1
2
(p1(t)
2 + p2(t)
2
) −
1
p
q1(t)
2 + q2(t)
2
.
1
Compute these quantities for your numerical solution. Does your numerical solution also conserve
the angular momentum and Hamiltonian? If not, briefly comment on their behaviour for large t.
3. For systems such as (1), an alternative to the standard Euler’s method is the so-called symplectic
Euler method
qn+1 = qn + hpn, pn+1 = pn −
h
(q
2
n+1,1 + q
2
n+1,2
)
3/2
qn+1.
Here qn+1,1 and qn+1,2 are the components of the vector qn+1. Implement this method and compare
it with the standard Euler’s method. Describe the behaviour of the numerical solution, and also
the angular momentum and Hamiltonian.
2

Scroll to Top