kwarg appears to be a syntax error for derivative of interpolant#486
Open
NAThompson wants to merge 1 commit intoSciML:masterfrom
Open
kwarg appears to be a syntax error for derivative of interpolant#486NAThompson wants to merge 1 commit intoSciML:masterfrom
NAThompson wants to merge 1 commit intoSciML:masterfrom
Conversation
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
```
| 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) |
Member
There was a problem hiding this comment.
that's not a kwarg: it's before the ;. That's an optional argument.
Author
There was a problem hiding this comment.
Ok. However, does the syntax work for you?
Member
There was a problem hiding this comment.
yes, sol(t,Val{0}) works
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using the doc-recommended syntax for the derivative of the interpolation I obtain a syntax error:
Removing the
kwargfixes the issue:Extra information: