We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If a de.ODEProblem is setup via MTK's ODESystem interface, it produces a MethodError (MethodError: no method matching one(::Tuple{Operation,Float64}))
de.ODEProblem
ODESystem
MethodError: no method matching one(::Tuple{Operation,Float64})
from julia import Main, ModelingToolkit from diffeqpy import de Main.eval(""" using ModelingToolkit, DifferentialEquations """) Main.eval( """ begin # v -> x1 @variables t, x1(t) @derivatives D'~t eqs = [ D(x1) ~ -2 * x1, ] sys = ODESystem(eqs, t) u0 = [ x1 => 1.0, ] end """ )
Main.eval( """ begin prob = ODEProblem(sys, u0, (0.0,10.0)) sol = solve(prob) end """ )
Main.eval("prob = ODEProblem(sys, u0, (0.0,10.0))") de.solve(Main.prob)
prob = de.ODEProblem(Main.sys, Main.u0, (0.0, 10.0)) de.solve(prob)
or
Main.prob_de = de.ODEProblem(Main.sys, Main.u0, (0.0, 10.0)) Main.eval("solve(prob_de)")
Both fail with
RuntimeError: Julia exception: MethodError: no method matching one(::Tuple{Operation,Float64}) Closest candidates are: one(!Matched::Type{Missing}) at missing.jl:103 one(!Matched::Type{ModelingToolkit.TermCombination}) at /Users/vsulzer/.julia/packages/ModelingToolkit/4JKjD/src/linearity.jl:57 one(!Matched::Missing) at missing.jl:100 ... Stacktrace: [1] oneunit(::Tuple{Operation,Float64}) at ./number.jl:299 [2] _broadcast_getindex_evalf at ./broadcast.jl:648 [inlined] [3] _broadcast_getindex at ./broadcast.jl:621 [inlined] [4] _getindex at ./broadcast.jl:644 [inlined] [5] _broadcast_getindex at ./broadcast.jl:620 [inlined] [6] _getindex at ./broadcast.jl:645 [inlined] [7] _broadcast_getindex at ./broadcast.jl:620 [inlined] [8] getindex at ./broadcast.jl:575 [inlined] [9] copy at ./broadcast.jl:876 [inlined] [10] materialize at ./broadcast.jl:837 [inlined] [11] __init(::ODEProblem{Array{Tuple{Operation,Float64},1},Tuple{Float64,Float64},true,DiffEqBase.NullParameters,ODEFunction{true,DiffEqBase.EvalFunc{ModelingToolkit.var"#f#168"{ModelingToolkit.var"#474#475",ModelingToolkit.var"#476#477"}},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Array{Symbol,1},Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem}, ::CompositeAlgorithm{Tuple{Vern9,Rodas5{0,false,DefaultLinSolve,DataType}},AutoSwitch{Vern9,Rodas5{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}}, ::Tuple{}, ::Tuple{}, ::Tuple{}, ::Type{Val{true}}; saveat::Tuple{}, tstops::Tuple{}, d_discontinuities::Tuple{}, save_idxs::Nothing, save_everystep::Bool, save_on::Bool, save_start::Bool, save_end::Bool, callback::Nothing, dense::Bool, calck::Bool, dt::Float64, dtmin::Nothing, dtmax::Float64, force_dtmin::Bool, adaptive::Bool, gamma::Rational{Int64}, abstol::Nothing, reltol::Nothing, qmin::Rational{Int64}, qmax::Int64, qsteady_min::Int64, qsteady_max::Int64, qoldinit::Rational{Int64}, fullnormalize::Bool, failfactor::Int64, beta1::Nothing, beta2::Nothing, maxiters::Int64, internalnorm::typeof(DiffEqBase.ODE_DEFAULT_NORM), internalopnorm::typeof(LinearAlgebra.opnorm), isoutofdomain::typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), unstable_check::typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), verbose::Bool, timeseries_errors::Bool, dense_errors::Bool, advance_to_tstop::Bool, stop_at_next_tstop::Bool, initialize_save::Bool, progress::Bool, progress_steps::Int64, progress_name::String, progress_message::typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), userdata::Nothing, allow_extrapolation::Bool, initialize_integrator::Bool, alias_u0::Bool, alias_du0::Bool, initializealg::OrdinaryDiffEq.DefaultInit, kwargs::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol,Symbol},NamedTuple{(:default_set, :second_time),Tuple{Bool,Bool}}}) at /Users/vsulzer/.julia/packages/OrdinaryDiffEq/VPJBD/src/solve.jl:144 [12] __solve(::ODEProblem{Array{Tuple{Operation,Float64},1},Tuple{Float64,Float64},true,DiffEqBase.NullParameters,ODEFunction{true,DiffEqBase.EvalFunc{ModelingToolkit.var"#f#168"{ModelingToolkit.var"#474#475",ModelingToolkit.var"#476#477"}},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Array{Symbol,1},Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem}, ::CompositeAlgorithm{Tuple{Vern9,Rodas5{0,false,DefaultLinSolve,DataType}},AutoSwitch{Vern9,Rodas5{0,false,DefaultLinSolve,DataType},Rational{Int64},Int64}}; kwargs::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol,Symbol},NamedTuple{(:default_set, :second_time),Tuple{Bool,Bool}}}) at /Users/vsulzer/.julia/packages/OrdinaryDiffEq/VPJBD/src/solve.jl:4 [13] __solve(::ODEProblem{Array{Tuple{Operation,Float64},1},Tuple{Float64,Float64},true,DiffEqBase.NullParameters,ODEFunction{true,DiffEqBase.EvalFunc{ModelingToolkit.var"#f#168"{ModelingToolkit.var"#474#475",ModelingToolkit.var"#476#477"}},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Array{Symbol,1},Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem}, ::Nothing; default_set::Bool, kwargs::Base.Iterators.Pairs{Symbol,Bool,Tuple{Symbol},NamedTuple{(:second_time,),Tuple{Bool}}}) at /Users/vsulzer/.julia/packages/DifferentialEquations/fpohE/src/default_solve.jl:7 [14] #__solve#471 at /Users/vsulzer/.julia/packages/DiffEqBase/T5smF/src/solve.jl:258 [inlined] [15] __solve(::ODEProblem{Array{Tuple{Operation,Float64},1},Tuple{Float64,Float64},true,DiffEqBase.NullParameters,ODEFunction{true,DiffEqBase.EvalFunc{ModelingToolkit.var"#f#168"{ModelingToolkit.var"#474#475",ModelingToolkit.var"#476#477"}},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Array{Symbol,1},Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem}) at /Users/vsulzer/.julia/packages/DiffEqBase/T5smF/src/solve.jl:245 [16] #invokelatest#1 at ./essentials.jl:710 [inlined] [17] invokelatest at ./essentials.jl:709 [inlined] [18] solve_call(::ODEProblem{Array{Tuple{Operation,Float64},1},Tuple{Float64,Float64},true,DiffEqBase.NullParameters,ODEFunction{true,DiffEqBase.EvalFunc{ModelingToolkit.var"#f#168"{ModelingToolkit.var"#474#475",ModelingToolkit.var"#476#477"}},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Array{Symbol,1},Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem}; merge_callbacks::Bool, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /Users/vsulzer/.julia/packages/DiffEqBase/T5smF/src/solve.jl:90 [19] solve_call at /Users/vsulzer/.julia/packages/DiffEqBase/T5smF/src/solve.jl:65 [inlined] [20] #solve_up#461 at /Users/vsulzer/.julia/packages/DiffEqBase/T5smF/src/solve.jl:117 [inlined] [21] solve_up at /Users/vsulzer/.julia/packages/DiffEqBase/T5smF/src/solve.jl:107 [inlined] [22] #solve#460 at /Users/vsulzer/.julia/packages/DiffEqBase/T5smF/src/solve.jl:102 [inlined] [23] solve at /Users/vsulzer/.julia/packages/DiffEqBase/T5smF/src/solve.jl:100 [inlined] [24] (::PyCall.var"#65#71"{PyCall.var"#65#66#72"{typeof(solve)}})(::ODEProblem{Array{Tuple{Operation,Float64},1},Tuple{Float64,Float64},true,DiffEqBase.NullParameters,ODEFunction{true,DiffEqBase.EvalFunc{ModelingToolkit.var"#f#168"{ModelingToolkit.var"#474#475",ModelingToolkit.var"#476#477"}},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Array{Symbol,1},Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem}; kws::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /Users/vsulzer/.julia/packages/PyCall/zqDXB/src/callback.jl:103 [25] #65 at /Users/vsulzer/.julia/packages/PyCall/zqDXB/src/callback.jl:103 [inlined] [26] #_#60 at /Users/vsulzer/.julia/packages/PyCall/zqDXB/src/callback.jl:61 [inlined] [27] (::PyCall.FuncWrapper{Tuple{Vararg{PyAny,N} where N},PyCall.var"#65#71"{PyCall.var"#65#66#72"{typeof(solve)}}})(::ODEProblem{Array{Tuple{Operation,Float64},1},Tuple{Float64,Float64},true,DiffEqBase.NullParameters,ODEFunction{true,DiffEqBase.EvalFunc{ModelingToolkit.var"#f#168"{ModelingToolkit.var"#474#475",ModelingToolkit.var"#476#477"}},LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Array{Symbol,1},Nothing},Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}},DiffEqBase.StandardODEProblem}) at /Users/vsulzer/.julia/packages/PyCall/zqDXB/src/callback.jl:61 [28] #invokelatest#1 at ./essentials.jl:710 [inlined] [29] invokelatest(::Any, ::Any) at ./essentials.jl:709 [30] _pyjlwrap_call(::PyCall.FuncWrapper{Tuple{Vararg{PyAny,N} where N},PyCall.var"#65#71"{PyCall.var"#65#66#72"{typeof(solve)}}}, ::Ptr{PyCall.PyObject_struct}, ::Ptr{PyCall.PyObject_struct}) at /Users/vsulzer/.julia/packages/PyCall/zqDXB/src/callback.jl:28 [31] pyjlwrap_call(::Ptr{PyCall.PyObject_struct}, ::Ptr{PyCall.PyObject_struct}, ::Ptr{PyCall.PyObject_struct}) at /Users/vsulzer/.julia/packages/PyCall/zqDXB/src/callback.jl:49
The text was updated successfully, but these errors were encountered:
I think I'll need @tkf's help on this one.
Sorry, something went wrong.
@tkf bump: can we look into this?
ModelingToolkit now works.
No branches or pull requests
If a
de.ODEProblem
is setup via MTK'sODESystem
interface, it produces a MethodError (MethodError: no method matching one(::Tuple{Operation,Float64})
)Setup
Approach 1: solve using Main.eval (works)
Approach 2: define ODEProblem using Main.eval then solve using diffeqpy (works)
Approach 3: define ODEProblem using diffeqpy (fails)
or
Both fail with
The text was updated successfully, but these errors were encountered: