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

Zero-indexed arrays don't work, but no error until access #1132

Open
NAThompson opened this issue May 7, 2024 · 0 comments
Open

Zero-indexed arrays don't work, but no error until access #1132

NAThompson opened this issue May 7, 2024 · 0 comments

Comments

@NAThompson
Copy link
Contributor

For instance, in forming a symbolic polynomial, it's convenient to let the coefficients be zero indexed. However, though we can declare zero indexed arrays, we cannot access them at index zero:

julia> using Symbolics

julia> @variables u[0:4]
1-element Vector{Symbolics.Arr{Num, 1}}:
 u[0:4]
julia> u[0]
ERROR: BoundsError: attempt to access SymbolicUtils.Sym{Vector{Real}, Base.ImmutableDict{DataType, Any}} at index [0]
Stacktrace:
 [1] getindex(x::SymbolicUtils.Sym{Vector{Real}, Base.ImmutableDict{DataType, Any}}, idx::Int64)
   @ Symbolics ~/.julia/packages/Symbolics/HDE84/src/array-lib.jl:26
 [2] getindex(x::Symbolics.Arr{Num, 1}, idx::Int64)
   @ Symbolics ~/.julia/packages/Symbolics/HDE84/src/array-lib.jl:84
 [3] top-level scope
   @ REPL[3]:1
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

No branches or pull requests

1 participant