import Pkg; Pkg.add("DifferentialEquations")
import Pkg; Pkg.add("Plots")
corresponding docs: http://docs.juliadiffeq.org/latest/tutorials/ode_example.html
have IVP:
where
specifically:
using DifferentialEquations
f(u,p,t) = 0.98u
u0 = 1.0
tspan = (0.0,1.0)
prob = ODEProblem(f,u0,tspan)
to solve:
sol = solve(prob)
solution has `t`, `u`, but also interpolation and return code.
plot it:
using Plots; gr()
plot(sol,linewidth=5,title="Solution to the linear ODE with a thick line",
xaxis="Time (t)",yaxis="u(t) (in μm)",label="My Thick Line!") # legend=false
plot!(sol.t, t->1.0*exp(0.98t),lw=3,ls=:dash,label="True Solution!")