Skip to content

Error in High Level Example from GitHub front page #327

@TorkelE

Description

@TorkelE

Hello,
I try to run this, simply the code copied from the GitHub front page:

using ModelingToolkit, OrdinaryDiffEq

@parameters t σ ρ β
@variables x(t) y(t) z(t)
@derivatives D'~t

eqs = [D(D(x)) ~ σ*(y-x),
       D(y) ~ x*-z)-y,
       D(z) ~ x*y - β*z]

sys = ODESystem(eqs)
sys = ode_order_lowering(sys)

u0 = [D(x) => 2.0,
      x => 1.0,
      y => 0.0,
      z => 0.0]

p  ==> 28.0,
      ρ => 10.0,
      β => 8/3]

tspan = (0.0,100.0)
prob = ODEProblem(sys,u0,tspan,p,jac=true)
sol = solve(prob,Tsit5())
using Plots; plot(sol,vars=(x,y))

everything works well, until the line prob = ODEProblem(sys,u0,tspan,p,jac=true) which generates an error:


MethodError: no method matching ODEFunction{true,F,TMM,Ta,Tt,TJ,JVP,VJP,JP,TW,TWt,TPJ,S,TCV} where TCV where S where TPJ where TWt where TW where JP where VJP where JVP where TJ where Tt where Ta where TMM where F(::ODESystem, ::Array{Variable,1}, ::Array{Variable,1}; analytic=nothing, tgrad=Base.RefValue{Array{Expression,1}}(Expression[]), jac=Base.RefValue{Array{Expression,2}}(Array{Expression}(undef,0,0)), jvp=nothing, vjp=nothing, Wfact=Base.RefValue{Array{Expression,2}}(Array{Expression}(undef,0,0)), Wfact_t=Base.RefValue{Array{Expression,2}}(Array{Expression}(undef,0,0)), paramjac=nothing, syms=nothing, colorvec=nothing)
Closest candidates are:
  ODEFunction{true,F,TMM,Ta,Tt,TJ,JVP,VJP,JP,TW,TWt,TPJ,S,TCV} where TCV where S where TPJ where TWt where TW where JP where VJP where JVP where TJ where Tt where Ta where TMM where F(::ModelingToolkit.AbstractODESystem, ::Any, ::Any; version, tgrad, jac, Wfact) where iip at /home/torkelloman/.julia/packages/ModelingToolkit/N4mo2/src/systems/diffeqs/abstractodesystem.jl:125 got unsupported keyword arguments "analytic", "jvp", "vjp", "Wfact_t", "paramjac", "syms", "colorvec"
  ODEFunction{true,F,TMM,Ta,Tt,TJ,JVP,VJP,JP,TW,TWt,TPJ,S,TCV} where TCV where S where TPJ where TWt where TW where JP where VJP where JVP where TJ where Tt where Ta where TMM where F(::ModelingToolkit.AbstractODESystem, ::Any) where iip at /home/torkelloman/.julia/packages/ModelingToolkit/N4mo2/src/systems/diffeqs/abstractodesystem.jl:125 got unsupported keyword arguments "analytic", "tgrad", "jac", "jvp", "vjp", "Wfact", "Wfact_t", "paramjac", "syms", "colorvec"
  ODEFunction{true,F,TMM,Ta,Tt,TJ,JVP,VJP,JP,TW,TWt,TPJ,S,TCV} where TCV where S where TPJ where TWt where TW where JP where VJP where JVP where TJ where Tt where Ta where TMM where F(::ModelingToolkit.AbstractODESystem) where iip at /home/torkelloman/.julia/packages/ModelingToolkit/N4mo2/src/systems/diffeqs/abstractodesystem.jl:125 got unsupported keyword arguments "analytic", "tgrad", "jac", "jvp", "vjp", "Wfact", "Wfact_t", "paramjac", "syms", "colorvec"
  ...
in top-level scope at test.jl:24
in  at DiffEqBase/jMOwn/src/problems/ode_problems.jl:76
in #ODEProblem#214 at DiffEqBase/jMOwn/src/problems/ode_problems.jl:76
in convert at DiffEqBase/jMOwn/src/diffeqfunction.jl:989
in  at ModelingToolkit/N4mo2/src/systems/diffeqs/abstractodesystem.jl:111
in #ODEFunction#79 at ModelingToolkit/N4mo2/src/systems/diffeqs/abstractodesystem.jl:111 
in  at ModelingToolkit/N4mo2/src/systems/diffeqs/abstractodesystem.jl:125
in  at ModelingToolkit/N4mo2/src/systems/diffeqs/abstractodesystem.jl:125
in kwerr at base/error.jl:157

Next, I try the second example:

using ModelingToolkit, OrdinaryDiffEq

@parameters t σ ρ β
@variables x(t) y(t) z(t)
@derivatives D'~t

eqs = [D(x) ~ σ*(y-x),
       D(y) ~ x*-z)-y,
       D(z) ~ x*y - β*z]

lorenz1 = ODESystem(eqs,name=:lorenz1)
lorenz2 = ODESystem(eqs,name=:lorenz2)

@variables a
@parameters γ
connections = [0 ~ lorenz1.x + lorenz2.y + a*γ]
connected = ODESystem(connections,t,[a],[γ],systems=[lorenz1,lorenz2])

u0 = [lorenz1.x => 1.0,
      lorenz1.y => 0.0,
      lorenz1.z => 0.0,
      lorenz2.x => 0.0,
      lorenz2.y => 1.0,
      lorenz2.z => 0.0,
      a => 2.0]

p  = [lorenz1.σ => 10.0,
      lorenz1.ρ => 28.0,
      lorenz1.β => 8/3,
      lorenz2.σ => 10.0,
      lorenz2.ρ => 28.0,
      lorenz2.β => 8/3,
      γ => 2.0]

tspan = (0.0,100.0)
prob = ODEProblem(connected,u0,tspan,p)
sol = solve(prob,Rodas5())

using Plots; plot(sol,vars=(a,lorenz1.x,lorenz2.z))

and again I run into an error on the line prob = ODEProblem(connected,u0,tspan,p):

MethodError: no method matching ODEFunction{true,F,TMM,Ta,Tt,TJ,JVP,VJP,JP,TW,TWt,TPJ,S,TCV} where TCV where S where TPJ where TWt where TW where JP where VJP where JVP where TJ where Tt where Ta where TMM where F(::ODESystem, ::Array{Variable,1}, ::Array{Variable,1}; analytic=nothing, tgrad=Base.RefValue{Array{Expression,1}}(Expression[]), jac=Base.RefValue{Array{Expression,2}}(Array{Expression}(undef,0,0)), jvp=nothing, vjp=nothing, Wfact=Base.RefValue{Array{Expression,2}}(Array{Expression}(undef,0,0)), Wfact_t=Base.RefValue{Array{Expression,2}}(Array{Expression}(undef,0,0)), paramjac=nothing, syms=nothing, colorvec=nothing)
Closest candidates are:
  ODEFunction{true,F,TMM,Ta,Tt,TJ,JVP,VJP,JP,TW,TWt,TPJ,S,TCV} where TCV where S where TPJ where TWt where TW where JP where VJP where JVP where TJ where Tt where Ta where TMM where F(::ModelingToolkit.AbstractODESystem, ::Any, ::Any; version, tgrad, jac, Wfact) where iip at /home/torkelloman/.julia/packages/ModelingToolkit/N4mo2/src/systems/diffeqs/abstractodesystem.jl:125 got unsupported keyword arguments "analytic", "jvp", "vjp", "Wfact_t", "paramjac", "syms", "colorvec"
  ODEFunction{true,F,TMM,Ta,Tt,TJ,JVP,VJP,JP,TW,TWt,TPJ,S,TCV} where TCV where S where TPJ where TWt where TW where JP where VJP where JVP where TJ where Tt where Ta where TMM where F(::ModelingToolkit.AbstractODESystem, ::Any) where iip at /home/torkelloman/.julia/packages/ModelingToolkit/N4mo2/src/systems/diffeqs/abstractodesystem.jl:125 got unsupported keyword arguments "analytic", "tgrad", "jac", "jvp", "vjp", "Wfact", "Wfact_t", "paramjac", "syms", "colorvec"
  ODEFunction{true,F,TMM,Ta,Tt,TJ,JVP,VJP,JP,TW,TWt,TPJ,S,TCV} where TCV where S where TPJ where TWt where TW where JP where VJP where JVP where TJ where Tt where Ta where TMM where F(::ModelingToolkit.AbstractODESystem) where iip at /home/torkelloman/.julia/packages/ModelingToolkit/N4mo2/src/systems/diffeqs/abstractodesystem.jl:125 got unsupported keyword arguments "analytic", "tgrad", "jac", "jvp", "vjp", "Wfact", "Wfact_t", "paramjac", "syms", "colorvec"
  ...
in top-level scope at test.jl:36
in ODEProblem at DiffEqBase/jMOwn/src/problems/ode_problems.jl:76
in #ODEProblem#214 at DiffEqBase/jMOwn/src/problems/ode_problems.jl:76
in convert at DiffEqBase/jMOwn/src/diffeqfunction.jl:989
in  at ModelingToolkit/N4mo2/src/systems/diffeqs/abstractodesystem.jl:111
in #ODEFunction#79 at ModelingToolkit/N4mo2/src/systems/diffeqs/abstractodesystem.jl:111 
in  at ModelingToolkit/N4mo2/src/systems/diffeqs/abstractodesystem.jl:125
in  at ModelingToolkit/N4mo2/src/systems/diffeqs/abstractodesystem.jl:125
in kwerr at base/error.jl:157

I am running this in atom. This is the list of package versions of possibly relevant packages:

  [c52e3926] Atom v0.12.10
  [2b5f629d] DiffEqBase v6.10.2
  [0c46a032] DifferentialEquations v6.9.0
  [e5e0dc1b] Juno v0.8.1
  [961ee093] ModelingToolkit v2.0.0
  [1dea7af3] OrdinaryDiffEq v5.26.8

Hope this is not a too embarrassing issue, that I should have caught myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions