Getting started with Differential Equations

I am trying to port a simple example from Python to Julia, but already the first example from the Tutorial fails:

using DifferentialEquations

function lorenz(t, u, du)
    du[1] = 10.0(u[2]-u[1])
    du[2] = u[1]*(28.0-u[3]) - u[2]
    du[3] = u[1]*u[2] - (8/3)*u[3]
end

u0 = [1.0; 0.0; 0.0]
tspan = (0.0, 100.0)
prob = ODEProblem(lorenz, u0, tspan)
sol = solve(prob)

Output:

julia> include("src/RadauTether.jl")
ERROR: LoadError: Parameters were indexed but the parameters are `nothing`. You likely forgot to pass in parameters to the DEProblem!
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] getindex(#unused#::SciMLBase.NullParameters, i::Int64)
    @ SciMLBase ~/.julia/packages/SciMLBase/XuLdB/src/problems/problem_utils.jl:140
...

Any idea?

To answer myself: The example was from an outdated version of the documentation.

The latest documentation (Ordinary Differential Equations · DifferentialEquations.jl) is correct:

using DifferentialEquations

function lorenz!(du,u,p,t)
    du[1] = 10.0*(u[2]-u[1])
    du[2] = u[1]*(28.0-u[3]) - u[2]
    du[3] = u[1]*u[2] - (8/3)*u[3]
end

u0 = [1.0; 0.0; 0.0]
tspan = (0.0, 100.0)
prob = ODEProblem(lorenz!, u0, tspan)
sol = solve(prob)
2 Likes

Anything we can do to make the old version of the docs less likely to show up?

The old docs at least give you a big javascript popup box saying it’s the old version.

1 Like

Well, if I google: “ordinary differential equations julia” the first hit is:
https://diffeq.sciml.ai/v2.0/

And if I go to the examples I end up here:
https://diffeq.sciml.ai/v2.0/tutorials/ode_example.html#Example-2:-Solving-Systems-of-Equations-1

And this doesn’t work. And no popup box (well, perhaps Firefox is blocking it?)

Which version is the currently stable version?

You don’t get that box?

v6.17

Actually, now I also see the box. But it is in the lower right corner and I have a widescreen monitor, so I did not see it first.

1 Like

@pfitzseb getting that comment again.

To be fair, it’s just a hack that @pfitzseb put into our docs to try and fix this problem. It’s a major issue with Documenter.jl and everyone should spam:

https://github.com/JuliaDocs/Documenter.jl/issues/1449

https://github.com/JuliaDocs/Documenter.jl/issues/539

https://github.com/JuliaLang/julia/issues/22936

It’s now been the #1 issue with Documenter.jl for four years so, hopefully someone comes up with a built in solution.

1 Like