DifferentialEquations.jl - solve not defined


#1

Hi,

I am relatively new to Julia, have been trying to solve a system of differential equations using Julia, but it always returns the error ‘
LoadError: UndefVarError: solve not defined’. I am not able to figure out why. Could anyone please help me. I have included a simple example code here.

using DifferentialEquations
U₀ₙₑₔ = 0.1635
dₚ = 100e-6
a = 315*(dₚ^0.64/U₀ₙₑₔ)
f(z,c) = a*c
cₛ₀ = 0.5
tspan = (0.6,1.2)
prob = ODEProblem(f,cₛ₀,tspan)
sol = solve(prob,Tsit5(),reltol=1e-8,abstol=1e-8)


#2

What does Pkg.status("DifferentialEquations"); Pkg.status("OrdinaryDiffEq") say?


#3

Pkg.status(“DifferentialEquations”)

  • DifferentialEquations 3.0.2

Pkg.status(“OrdinaryDiffEq”)

  • OrdinaryDiffEq 2.26.0

#4

Initially, when I first tried this in the older version of julia, I got the same error, so I tried updating to latest version, but still I get the same error everytime.


#5

Weird. You’re on the latest versions of the packages. Did it not say anything during precompile or build stages? No error messages at all?

Replace using DifferentialEquations with using OrdinaryDiffEq and see if it works.


#6

It gives me the same error, with OrdinaryDiffEq

LoadError: UndefVarError: solve not defined
while loading untitled-217b70b82c9a0ba6d911c4b161998771, in expression starting on line 9
include_string(::String, ::String) at loading.jl:522
include_string(::Module, ::String, ::String) at Compat.jl:174
(::Atom.##57#60{String,String})() at eval.jl:74
withpath(::Atom.##57#60{String,String}, ::Void) at utils.jl:30
withpath(::Function, ::String) at eval.jl:38
macro expansion at eval.jl:72 [inlined]
(::Atom.##56#59{Dict{String,Any}})() at task.jl:80


#7

And there are no other errors or warnings? If so, bizarre. Try prefacing it with the package name:

sol = OrdinaryDiffEq.solve(prob,Tsit5(),reltol=1e-8,abstol=1e-8)

What does Pkg.status("DiffEqBase") say?


#8
  • DiffEqBase 2.6.1
    There are no other errors or warnings, just that solve is not defined

#9

And, it worked, when prefaced with the package name.
sol = OrdinaryDiffEq.solve(prob,Tsit5(),reltol=1e-8,abstol=1e-8)


#10

Thank you so much.

But what could be the issue, why didn’t it work with the usual procedure? I’m wondering because I frequently update the packages and have no idea what could have possibly gone wrong


#11

You have some other package exporting solve, and it will throw a warning when using DifferentialEquations or using OrdinaryDiffEq is done. That warning will tell you what other package is using without extending solve.


#12

Okay, Thank you.

But, I didn’t get any warning, just the error


#13

Is this a standard Julia installation?


#14

Yes, of course!


#15

Well then I’m baffled as to why you don’t get a warning that tells you what other package is exporting solve, but at least I could identify the issue :slight_smile:


#16

Please try to simplify what you’re doing as much as possible and post everything from the REPL in a gist (gist.github.com). It seems very weird that you’re not getting a warning as Chris mentions.


#17

Maybe he got the warning way back when he started the session, and all of this is done in a “old” session?


#18

Indeed. Maybe I should have emphasized that I meant “everything!!!” when I said “everything” :slight_smile: Let’s see the splash screen! :slight_smile:


#19

Sorry, it was my mistake.

@yakir12 was right. To check that, I restarted Julia and solved one of my files using solve and then when I came back and tried to solve this again, it gave me a warning:

WARNING: using JuMP.solve in module Main conflicts with an existing identifier.

I guess, it might have displayed the warning way back and I kept running different modules, didn’t notice the warning in the old session.

@ChrisRackauckas Thank you :slight_smile:


#20

You can mark the answer as a solution, that way this topic will be marked as solved :slight_smile: