Skip to content
New issue

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

ERROR: MethodError: no method matching (ODEProblem{false, SciMLBase.FullSpecialize})(::ODEFunction{false, SciMLBase.FullSpecialize, var"#9#10", ...}, ::Vector{Float64}, ::Tuple{Float64, Float64}, ::Vector{Float64}, ::Tsit5{...}) #482

Open
prbzrg opened this issue Aug 22, 2023 · 7 comments

Comments

@prbzrg
Copy link
Member

prbzrg commented Aug 22, 2023

I think it must work, Am I missing something?

julia> fode = ODEFunction((u,p,t) -> identity(u))
(::ODEFunction{false, SciMLBase.FullSpecialize, var"#9#10", LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}) (generic function with 1 method)

julia> ODEProblem{false, SciMLBase.FullSpecialize}(fode, ones(1), (0.0, 1.0), ones(1), Tsit5())
ERROR: MethodError: no method matching (ODEProblem{false, SciMLBase.FullSpecialize})(::ODEFunction{false, SciMLBase.FullSpecialize, var"#9#10", LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, ::Vector{Float64}, ::Tuple{Float64, Float64}, ::Vector{Float64}, ::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False})

Closest candidates are:
  (ODEProblem{iip, recompile})(::Any, ::Any, ::Any, ::Any; kwargs...) where {iip, recompile}
   @ SciMLBase C:\Users\Hossein Pourbozorg\.julia\packages\SciMLBase\kTUaf\src\problems\ode_problems.jl:141
  (ODEProblem{iip, recompile})(::Any, ::Any, ::Any) where {iip, recompile}
   @ SciMLBase C:\Users\Hossein Pourbozorg\.julia\packages\SciMLBase\kTUaf\src\problems\ode_problems.jl:141

Stacktrace:
 [1] top-level scope
   @ REPL[42]:1
@ErikQQY
Copy link
Member

ErikQQY commented Aug 22, 2023

To construct an ODEProblem, we use prob = ODEProblem(fun::ODEFunction, u0, tspan, p), the ODE solver Tsit5() should be called when we want to solve this ODEProblem.

For detailed usage, please refer to https://docs.sciml.ai/DiffEqDocs/stable/getting_started/

@prbzrg
Copy link
Member Author

prbzrg commented Aug 22, 2023

but

ODEProblem{false}(fode, ones(1), (0.0, 1.0), ones(1), Tsit5())

and

ODEProblem(fode, ones(1), (0.0, 1.0), ones(1), Tsit5())

both work.

@ErikQQY
Copy link
Member

ErikQQY commented Aug 22, 2023

but

ODEProblem{false}(fode, ones(1), (0.0, 1.0), ones(1), Tsit5())

and

ODEProblem(fode, ones(1), (0.0, 1.0), ones(1), Tsit5())

Yeah, but I think both of them are incorrect usages, you can use this:

julia> ODEProblem{false, SciMLBase.FullSpecialize}(fode, ones(1), (0.0, 1.0), ones(1))
ODEProblem with uType Vector{Float64} and tType Float64. In-place: false
timespan: (0.0, 1.0)
u0: 1-element Vector{Float64}:
 1.0

@prbzrg
Copy link
Member Author

prbzrg commented Aug 22, 2023

Alright, should we add a warning to them? So it would be clear that solver should be given to solve function, not the problem definition.

@ChrisRackauckas
Copy link
Member

I mean, if you want to add it sure. I would be surprised if anyone attempts this: this has never been the documented syntax.

@prbzrg
Copy link
Member Author

prbzrg commented Aug 22, 2023

Oh, it's a bug:

julia> pb = ODEProblem(fode, ones(1), (0.0, 1.0), ones(1), Tsit5())
ODEProblem with uType Vector{Float64} and tType Float64. In-place: false
timespan: (0.0, 1.0)
u0: 1-element Vector{Float64}:
 1.0

julia> pb.problem_type
Tsit5(; stage_limiter! = trivial_limiter!, step_limiter! = trivial_limiter!, thread = static(false),)

julia> pb2 = ODEProblem{false}(fode, ones(1), (0.0, 1.0), ones(1), Tsit5())
ODEProblem with uType Vector{Float64} and tType Float64. In-place: false
timespan: (0.0, 1.0)
u0: 1-element Vector{Float64}:
 1.0

julia> pb2.problem_type
Tsit5(; stage_limiter! = trivial_limiter!, step_limiter! = trivial_limiter!, thread = static(false),)

@prbzrg
Copy link
Member Author

prbzrg commented Nov 30, 2023

Accepting solver as problem type is definitely a bug that must be fixed. How can I help?

@prbzrg prbzrg mentioned this issue Nov 30, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants