Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
Mathematical Programming MATH20014: Group projects
Outline of the group projects
The group projects for MATH20014 will be organised as follows. From the set of potential
projects detailed below, each of you will choose a favourite project and backup projects in
decreasing order of preference, according to their interest to you. The projects are all of a
similar level of difficulty, but focus on different areas of mathematics, including mechanics,
statistical mechanics, combinatorics, cryptography, number theory and knot theory.
Each group will then consist of four students who have shown interest in the same project;
the groups will be assembled by the team of lecturers.
Format of the group projects
We expect the group project to take the form of a jupyter notebook, similar to the lectures and
tutorials. Your jupyter notebook will contain the different pieces of code, and the same jupyter
notebook will also need to contain explanations, formulas, graphs, context and references for
your project.
As you have seen in the lectures and tutorials, the notebooks understand latex, so typesetting
equations is straightforward. On the other hand, it is difficult to include external images into
them (as opposed to plots generated from your code, which are fine). Note that html image
links break as soon as you move from your own machine, even when they shouldn’t. Therefore,
in addition to the core jupyter notebook, we may also create and submit other forms of content,
including the following.
• Python code (.py) files with, for example, modules or classes that you have created, or
scripts (for example scripts that carry out the time-consuming calculations or animations
required by some projects).
• High-resolution images and movies obtained as output from your program.
• Additional notes with graphs and images, as well as explanations or discussions, as a
compiled latex file (i.e. a pdf), or even as a Word file.
Assessment criteria
The projects here contain a core part (marked [core] or (core) below) which you need to
satisfactorily complete to obtain a passing mark. The other parts are pick-and-choose, and open
ended. A brief overview of the grading criteria is given below. (A more complete summary will
be provided before the Easter break.)
• Correctness of the code, and its ability to perform the computations required in the core
parts of the project.
• Quality of your code, including structure, number and usefulness of comments, and use of
functions, arrays, libraries and other elements introduced in the course.
1
• Scope of your project, i.e. how far the topic has been developed beyond the core parts.
• Quality of the surrounding explanations and analysis, and quality of the typesetting and
English language.
There will also be a peer assessment of your group where you rate the commitment and
performance or your group members. This will take a similar form to the group projects in
Mathematical Investigations in year 1. The projects and peer assessments are due on
Monday, May 9 (i.e. the first day of revision week).
How to collaborate on a computing project
The first step is to make sure to have a shared drive that is accessible to all members of your
team, for example by creating a shared folder, for example on Onedrive or Dropbox. Then create
your Jupyter notebook for the project, and edit it. A key issue is version control, i.e. that
there is only one current version of the project (and not, say, four different branches that four
different people are working on). At the same time, you will want to keep the previous versions
of the notebook, so that potentially important pieces are not overwritten or lost and you can
always undo changes that were a mistake.
The simplest (though not the most efficient) form of version control is to save a copy of the
Jupyter notebook with the current date and your name each time you make an edit, and to
always, always start from the most recently modified file.
If you are keen to explore more formal options for working on a coding project as a team,
please consider using the git software, and optionally the github online code sharing platform.
A second very important point: the projects generally start from a basic idea and then
develop this through several stages. It is crucial that you do the beginning pieces first. It is
also crucial that you work on one version of it together. For example, to figure out energy
conservation in planetary motion, you need to have a working integrator of the four ODEs first,
etc. Please do not try to develop pieces of the project individually and then merge, as this is
almost impossible to do due people’s different choices for the structure of the code. You should
begin by having an online four-person meeting where you work through the project and set up
the code structure, followed by regular meetings.
2
1 Planetary motion
We want to investigate how planets move around the sun, and how moons move around the
planets. Everything starts with the Newtonian equations of motion for the positions of each
object (sun, planet, moon) i:
mir¨i = G
∑
j
mimj
rj − ri
|rj − ri|3 , (1)
where themj are the masses of the other objects, rj are their positions andG = 6.6734810−11 m
3
kgs2
is the universal gravitational constant.
Gravitation is a conservative force; that means that the total energy of the system, E = T+V
does not vary in time
E =
1
2
∑
i
mi|r˙i|2 −G
∑
i
∑
j
mimj
|rj − ri| . (2)
It is theoretically not trivial to find a numerical integration scheme that is consistent with
energy conservation, or what is called Hamiltonian dynamics in classical mechanics. If we find
it, such an algorithm is called a symplectic integrator. The standard algorithms that we have
discussed, like the Euler method or the Runge-Kutta algorithm, are not symplectic integrators.
Instead, we are going to use the velocity Verlet algorithm, which is accurate to second order.
Suppose that our equations of motion can be written as standard Newton equations with a force
F(r) which depends on positions only:
r˙ = v (3)
v˙ = F(r)/m = a (4)
Then in the velocity Verlet algorithm, we include the acceleration in our calculations. As in
the Runge-Kutta, we need to compute positions, velocities and accelerations in a precise order:
rk+1 = rk + vkdt+
1
2
ak dt
2 (5)
ak+1 =
F(rk+1)
m
(6)
vk+1 = vk +
1
2
(ak + ak+1) dt (7)
Simulate the motion of at least one planet with the velocity Verlet algorithm. In the points
below, the non-core numbers 4-7 are pick and choose, and you can develop the point as far as
you would like to.
1. [core] While the equations above are written in three dimensions, conservation of angular
momentum makes the orbits of planets planar. All in all, for a single planet, you will be
left with only two degrees of freedom, i.e. two coupled second order ODEs, corresponding
to four coupled first-order ODEs. First simulate only the motion of an earth-like planet
around the sun. The mass of the sun is 1.989 1030kg, and the radius of the earth is on
average 149.59787 million kilometers (i.e. R = 149.59787 109m). Assume that the sun is
fixed and that only the earth moves (a pretty good approximation in practice).
2. [core] Verify that you find a closed orbit for a planet with the earth’s initial position
r0 = (R, 0) and tangential initial velocity v0 = (0, 29.8km/s). Check that the total en-
ergy (kinetic plus potential) remains constant. Analytically derive that this value of v0
is the only one compatible with a (near) circular orbit. You will find the Kepler prob-
lem homework from Mechanics 2 very useful here. Hint: Consider the energy in polar
coordinates.
3
3. [core] Now vary the total energy of the orbit by changing the value, but not the direction,
of v0, between 0 and a maximum value to be determined below. Plot the now elliptical
and hyperbolic trajectories, and the positions of the aphelion/perihelion. For the elliptical
trajectories, calculate the orbital eccentricity (defined as the ratio of the minor to the major
axis). Construct a criterion to distinguish elliptical and hyperbolic trajectories. Determine
the escape speed of an earth-like planet from the sun’s gravitational well. Determine the
corresponding energy, and compare it to the theoretical result, which you can derive from
(T + V )|initial = (T + V )|r=∞.
4. For the elliptical trajectories, test Kepler’s second law, which states that “A line joining
a planet and the Sun sweeps out equal areas during equal intervals of time”. In other
words, if A is the area enclosed between the sun at the centre and the planetary position
at (r, θ) in polar coordinates, the rate of change of area dAdt =
r2
2
dθ
dt is constant. This
result is a consequence of the conservation of the out-of-plane angular momentum in the
equations of motion: rederive Kepler’s second law analytically as well.
5. Investigate the three-body problem where three objects interact with each other gravi-
tationally. For example, consider three sun-like stars with different but not too dissimilar
masses. The three-body problem does not have an analytical solution and almost always
leads to chaotic trajectories (that is, when it doesn’t eject one of the three suns).
6. Simulate the solar system including multiple or all planets (and yes, planets interact with
each other). This is harder than it looks, since the periods of the outer planets are much
longer than the inner planets. We therefore obtain numerically stiff differential equations,
where we need a small time step because of the inner planets, but also a long simulation
time for the outer planets. Several compromises are possible, e.g. only simulating inner or
outer planets, and not simulating long enough to find closed trajectories for outer planets.
7. Simulate the trajectory of a large (at least Jupiter sized) exoplanet in a star system, with
the planet close to the star. Drop the assumption that the star itself is not moving, and
compute the “wobble” of the star’s trajectory itself around the common centre of gravity.
Make an estimate at what distance this wobble would be observable from earth: this is
one of the methods for detecting exoplanets.