using Plots; plotly(size=(200,200)); plot(Plots.fakedata(5,10)); # fully load plots
; # hide output
# Define the ODE for a simulation of Hooke's law.
k = 0.5
s = [0; 1.0]
f = (t,y) -> [0 1.0; -k 0.0]*y
# Do the simulation!
h = 0.01
Tmax = 100
tsteps = collect(0:h:Tmax)
nsteps = length(tsteps)
y = s
yhist = zeros(nsteps,2)
yhist[1,:] = s
for i=2:nsteps
t = tsteps[i]
y = y + h*f(t,y)
yhist[i,:] = y
end
plot(tsteps,yhist[:,1])
# How should we debug?
Pkg.add("ODE")
using ODE
tout,yout = ode45(f,s,[0.,Tmax])
yhist = hcat(yout...)' # convert to matrix
plot(tout,yhist[:,1])