We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
BoundsError
expand_derivatives
y
x
MWE (Julia Version 1.10.2, Symbolics v5.28.0, SymbolicUtils v1.5.1):
using Symbolics expr_gen = (var, fun) -> Differential(var)(Differential(var)(((-Differential(var)(Differential(var)(fun))) / g(var)))) @syms y f(y) g(y) h(y) expr = expr_gen(y, f(y)) expand_derivatives(expr) expr = expr_gen(y, g(y)) expand_derivatives(expr) # Error expr = expr_gen(y, h(y)) expand_derivatives(expr) # Error
The error message:
> show(err) 1-element ExceptionStack: BoundsError: attempt to access 1-element Vector{Any} at index [2] Stacktrace: [1] getindex(A::Vector{Any}, i1::Int64) @ Base ./essentials.jl:13 [2] expand_derivatives(O::SymbolicUtils.BasicSymbolic{Number}, simplify::Bool; occurrences::SymbolicUtils.BasicSymbolic{Real}) (repeats 2 times) @ Symbolics ~/.julia/packages/Symbolics/Eas9m/src/diff.jl:245 [3] expand_derivatives(O::SymbolicUtils.BasicSymbolic{Number}, simplify::Bool; occurrences::Nothing) @ Symbolics ~/.julia/packages/Symbolics/Eas9m/src/diff.jl:245 [4] expand_derivatives @ ~/.julia/packages/Symbolics/Eas9m/src/diff.jl:171 [inlined] [5] expand_derivatives(O::SymbolicUtils.BasicSymbolic{Number}) @ Symbolics ~/.julia/packages/Symbolics/Eas9m/src/diff.jl:171 [6] top-level scope @ REPL[9]:1
For some reason all of the following run successfully. The only difference is replacing y with x.
using Symbolics expr_gen = (var, fun) -> Differential(var)(Differential(var)(((-Differential(var)(Differential(var)(fun))) / g(var)))) @syms x f(x) g(x) h(x) expr = expr_gen(x, f(x)) expand_derivatives(expr) expr = expr_gen(x, g(x)) expand_derivatives(expr) expr = expr_gen(x, h(x)) expand_derivatives(expr)
The text was updated successfully, but these errors were encountered:
This is still a problem of ordering.
<ₑ
As a result, inner_args[i] and arguments(occurrences)[i] sometimes does not actually match inside expand_derivatives.
inner_args[i]
arguments(occurrences)[i]
Symbolics.jl/src/diff.jl
Lines 239 to 245 in 45de9b8
Sorry, something went wrong.
No branches or pull requests
MWE (Julia Version 1.10.2, Symbolics v5.28.0, SymbolicUtils v1.5.1):
The error message:
For some reason all of the following run successfully. The only difference is replacing
y
withx
.The text was updated successfully, but these errors were encountered: