DifferentialEquations.jl -not working

Hi everyone,

I’m quite new to Julia and I’ve been stuck on a problem for awhile. I’m trying to learn to solve differential equations with Julia. For instance I tried to run a pre-made simple example code by Christopher Rackauckas, but I got an error.

The code can be found here. It’s the first code on that page. I’ll also write it here:

using DifferentialEquations
alpha = 0.5 #Setting alpha to 1/2
f(y,t) = alpha*y
u0 = 1.5
prob = ODEProblem(f,u0)
timespan = [0,1] # Solve from time = 0 to time = 1
sol = solve(prob,timespan) # Solves the ODE
using Plots
plot(sol) # Plots the solution using Plots.jl

And the error I’m getting says: >LoadError: MethodError: no method matching DiffEqBase.ODEProblem{uType,tType,isinplace,F,C,MM}(::#f ::Float64).

I have installed the DifferentialEquations.jl -package, even removed it and then re-installed it, but nothing changed. Other similar codes won’t work either. Anyone with more experience having suggestions what I should try to do in order to fix this?

This might be a cross-post of

As noted there, that’s because this code was pulled from an old blog post. The blog post was updated to:

using DifferentialEquations
alpha = 0.5 #Setting alpha to 1/2
f(y,t) = alpha*y
u0 = 1.5
tspan = (0.0,1.0) # Solve from time = 0 to time = 1
prob = ODEProblem(f,u0,tspan)
sol = solve(prob) # Solves the ODE
using Plots
plot(sol) # Plots the solution using Plots.jl
1 Like