MATH 317: Numerical Analysis
Assignment 3 : Due 19 November, 2019
Important: Submit a complete hard copy of all your solutions either in class or to the Math
Dept Office opposite the elevators on 10th floor of Burnside before 4pm on the due date; this must
include Course number, name and id number (or it will get lost). Solutions should be complete and
include hardcopy of all electronic output, and code, together with explanations. Work not submitted
on paper will not be graded. Submit all relevant program files and documentation to explain them.
1. For a point moving on a circle at constant angular velocity, ω, the x and y coordinates are given
by
dx
dt
= −ωy, dy
dt
= ωx, ω =
2pi
T
.
Solve the above equations using a) the forward Euler scheme and b) the centred-difference scheme with
a forward Euler first step. Use the following parameters: T = 72h, ∆t = 0.5h, xo = x(t = 0) = 600km,
yo = 0. Integrate for 144 h and plot the x, y coordinates on a polar plot. Comment on your results.
2. The nonlinear pendulum is governed by the equations
dv
dt
= −g sin θ dθ
dt
=
v
L
.
Solve using a) forward Euler and b) backward Euler for L = 9m, ∆t = 0.1s, vo = 0.6m s
−1 and θo = 0.
Integrate for 25s and plot v as a function of t. Comment on your results. Note that if a scheme is
implicit, you may have to iterate to convergence at each time step. Use your own judgement on how
best to do this.
3. Integrate the following set of ODE’s on the computer:
dx
dt
= σ(y − x), dy
dt
= x(ρ− z)− y, dz
dt
= xy − βz
using the Improved Euler Method. The initial conditions are x(0) = 1, y(0) = −1 and z(0) = 30
and the parameters take on the values σ = 10, β = 8/3 and ρ = 28. Use a step size of h = 0.005
and run it until t = 100, implying that you take 100/0.005 = 20, 000 steps. (It’s about time we
saw what computers can do!). Display your output by plotting z(t) on the y-axis and x(t) on the
x-axis. Does the result look familiar? This is the Lorenz attractor that started the study of chaos.
See http://mathworld.wolfram.com/LorenzAttractor.html
4. Consider the ODE y′′ + 2y′ + 9y = 0 with the initial conditions y(0) = 0 and y′(0) = 1. First,
solve it analytically. Next rewite it as a coupled set of first-order ODE’s. Now, write a computer code
to integrate it using the backward Euler scheme, i.e. for each equation dA/dt = RHS, the scheme is
written An −An−1 = h RHSn, where h is the uniform step size. Write the resulting set of equations
in matrix form and write a code to solve it. Finally, plot out the analytical and numerical solution
over the range [0, pi]. Try a few values of h and see what happens.  Email:51zuoyejun

@gmail.com