Midterm 2
(20 marks)

Name:
Student #:

1 (6 marks)

Below is a set of data representing the height of a projectile (under constant acceleration) in metres as a function of time in seconds.
Use the following finite difference approximation to the first derivative of a function 
f'(x)≈((-f(x+2h)+8f(x+h)-8f(x-h)+f(x-2h))/(12 h)) 
to calculate the vertical velocity of the projectile as a function of time (for all points permitted by the method).  Plot your velocity as a function of time.

Remove["Global`*"]
height={{0,3.2767},{0.25,13.3697},{0.5,22.6187},{0.75,31.358},{1.,39.3426},{1.25,46.8565},{1.5,53.9362},{1.75,60.2468},{2.,65.9965},{2.25,70.7827},{2.5,75.2345},{2.75,79.1658},{3.,82.1645},{3.25,84.974},{3.5,86.9451},{3.75,88.4018},{4.,88.948},{4.25,89.0976},{4.5,88.4959},{4.75,87.7711},{5.,85.7661},{5.25,83.7047},{5.5,80.4947},{5.75,77.1416},{6.,72.7794},{6.25,68.121},{6.5,62.9447},{6.75,56.7221},{7.,50.0318},{7.25,42.9029},{7.5,35.0772},{7.75,26.7613},{8.,17.5252},{8.25,7.80118},{8.5,-2.09854},{8.75,-13.3812},{9.,-24.8643},{9.25,-36.8594},{9.5,-49.6049},{9.75,-63.032},{10.,-76.7623}};

2 (7 marks)

Consider the following set of coupled ODE's
x'(t) = z(t) y(t) -(x^2)(t)+4sin(t)
y'(t)= -0.2 x(t)+0.1 z(t)
z'(t)=10 sin( x(t) + y(t) )
x(0)=1
y(0)=0
z(0)=0
Write your own Midpoint scheme (2nd order Runge-Kutta) ODE solver to solve this system numerically, using a time step of 0.02  Plot x(t) from t=0 to t=10.

3 (7 marks)

An oscillator, initially at rest at equilibrium is governed by the nonlinear equation
x''(t)+13 (x^3)(t)+1.7 x'(t)=sin(2 t),
where x is the displacement from equilibrium in metres.  Solve for x(t) with NDSolve and plot your solution until the system reaches a steady state.  Assuming the mass is 1kg, estimate the average kinetic energy of the oscillator in the steady state by integrating over several oscillations.