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

kwarg appears to be a syntax error for derivative of interpolant #486

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

NAThompson
Copy link

@NAThompson NAThompson commented Jul 24, 2021

When using the doc-recommended syntax for the derivative of the interpolation I obtain a syntax error:

julia> sol(0.0,deriv=Val{1})
ERROR: MethodError: no method matching (::ODESolution{Float64, 1, Vector{Float64}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Float64}}, ODEProblem{Float64, Tuple{Float64, Float64}, false, SciMLBase.NullParameters, ODEFunction{false, typeof(f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Tsit5, OrdinaryDiffEq.InterpolationData{ODEFunction{false, typeof(f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Float64}, Vector{Float64}, Vector{Vector{Float64}}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}}, DiffEqBase.DEStats})(::Float64, ::Type{Val{0}}; deriv=Val{1})
Use square brackets [] for indexing an Array.
Closest candidates are:
  (::ODESolution)(::Any, ::Any, ::Type; idxs, continuity) at /Users/nathompson7/.julia/packages/SciMLBase/cU5k7/src/solutions/ode_solutions.jl:19 got unsupported keyword argument "deriv"
  (::ODESolution)(::Real, ::Any, ::AbstractVector{<:Integer}, ::Any) at /Users/nathompson7/.julia/packages/SciMLBase/cU5k7/src/solutions/ode_solutions.jl:32 got unsupported keyword argument "deriv"
  (::ODESolution)(::Real, ::Any, ::AbstractVector, ::Any) at /Users/nathompson7/.julia/packages/SciMLBase/cU5k7/src/solutions/ode_solutions.jl:55 got unsupported keyword argument "deriv"
  ...
Stacktrace:
 [1] kwerr(::NamedTuple{(:deriv,), Tuple{DataType}}, ::ODESolution{Float64, 1, Vector{Float64}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Float64}}, ODEProblem{Float64, Tuple{Float64, Float64}, false, SciMLBase.NullParameters, ODEFunction{false, typeof(f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Tsit5, OrdinaryDiffEq.InterpolationData{ODEFunction{false, typeof(f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Float64}, Vector{Float64}, Vector{Vector{Float64}}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}}, DiffEqBase.DEStats}, ::Float64, ::Type)
   @ Base ./error.jl:163
 [2] top-level scope
   @ REPL[20]:1

Removing the kwarg fixes the issue:

julia> sol(0.0,Val{1})
0.505

Extra information:

julia> VERSION
v"1.8.0-DEV.231"

When using the doc-recommended syntax for the derivative of the interpolation I obtain a syntax error:

```
julia> sol(0.0,deriv=Val{1})
ERROR: MethodError: no method matching (::ODESolution{Float64, 1, Vector{Float64}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Float64}}, ODEProblem{Float64, Tuple{Float64, Float64}, false, SciMLBase.NullParameters, ODEFunction{false, typeof(f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Tsit5, OrdinaryDiffEq.InterpolationData{ODEFunction{false, typeof(f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Float64}, Vector{Float64}, Vector{Vector{Float64}}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}}, DiffEqBase.DEStats})(::Float64, ::Type{Val{0}}; deriv=Val{1})
Use square brackets [] for indexing an Array.
Closest candidates are:
  (::ODESolution)(::Any, ::Any, ::Type; idxs, continuity) at /Users/nathompson7/.julia/packages/SciMLBase/cU5k7/src/solutions/ode_solutions.jl:19 got unsupported keyword argument "deriv"
  (::ODESolution)(::Real, ::Any, ::AbstractVector{<:Integer}, ::Any) at /Users/nathompson7/.julia/packages/SciMLBase/cU5k7/src/solutions/ode_solutions.jl:32 got unsupported keyword argument "deriv"
  (::ODESolution)(::Real, ::Any, ::AbstractVector, ::Any) at /Users/nathompson7/.julia/packages/SciMLBase/cU5k7/src/solutions/ode_solutions.jl:55 got unsupported keyword argument "deriv"
  ...
Stacktrace:
 [1] kwerr(::NamedTuple{(:deriv,), Tuple{DataType}}, ::ODESolution{Float64, 1, Vector{Float64}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Float64}}, ODEProblem{Float64, Tuple{Float64, Float64}, false, SciMLBase.NullParameters, ODEFunction{false, typeof(f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, Tsit5, OrdinaryDiffEq.InterpolationData{ODEFunction{false, typeof(f), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing}, Vector{Float64}, Vector{Float64}, Vector{Vector{Float64}}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}}, DiffEqBase.DEStats}, ::Float64, ::Type)
   @ Base ./error.jl:163
 [2] top-level scope
   @ REPL[20]:1
```

Removing the `kwarg` fixes the issue:

```
julia> sol(0.0,Val{1})
0.505
```
@NAThompson NAThompson changed the title kwarg appears to be a syntax error for derivative of interplant kwarg appears to be a syntax error for derivative of interpolant Jul 24, 2021
@@ -90,7 +90,7 @@ sol(t)
Note that the interpolating function allows for `t` to be a vector and uses this to speed up the interpolation calculations. The full API for the interpolations is

```julia
sol(t,deriv=Val{0};idxs=nothing,continuity=:left)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's not a kwarg: it's before the ;. That's an optional argument.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. However, does the syntax work for you?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, sol(t,Val{0}) works

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 this pull request may close these issues.

None yet

2 participants