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)
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.
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
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
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.
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.
@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.