DifferentialEquations.jl Not Working w/ Julia 1.5?

282 Views Asked by At
using DifferentialEquations
f(u,p,t) = 1.01*u
u0 = 1/2
tspan = (0.0,1.0)
prob = ODEProblem(f,u0,tspan)
sol = solve(prob, Tsit5(), reltol=1e-8, abstol=1e-8)

using Plots
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->0.5*exp(1.01t),lw=3,ls=:dash,label="True Solution!")

This is a sample code from the DifferentialEquations.jl documentation and whenever I try to run this I get that UndefVarError: plot! not defined

A similar error arrises when just executing a simpler version

using DifferentialEquations
f(u,p,t) = 1.01*u
u0 = 1/2
tspan = (0.0,1.0)
prob = ODEProblem(f,u0,tspan)
println(prob)

UndefVarError: ODEProblem not defined

I ran status and these are the current versions I am running Julia 1.5.1 (first install today) on Windows 10:

Atom v0.12.21
DifferentialEquations v6.15.0
IJulia v1.21.3
Juno v0.8.3
1

There are 1 best solutions below

0
On

Could you please share the whole error message? You should look at the first error, which is likely due to not adding the package, and follow the steps of that error message. It looks like you never added Plots.jl, so using Plots should have failed.