JuliaSymbolics / Symbolics.jl

Symbolic programming for the next generation of numerical software

Home Page:https://symbolics.juliasymbolics.org/stable/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

NAThompson opened this issue · comments

commented

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