You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to define a symbolic vector using for loop with Symbolics.jl?
For example, x=[x1, x2, x3, x4, …, x100], where xi are all variables defined using @variables.
It can be easily done using sympy.jl as
julia> N=100, x = [symbols(“x$i”) for i in 1:N].
For short vector, x = @variables x1, x2, x3 work. However for, 100 or even 1000 long vectors, a for loop would be useful.
Please note that I must use Symbolics.jl for the sake of speed and complicated matrix manipulation.
I am aware of the symbolic arrays introduced at Symbolic arrays · Symbolics.jl 1,
but it does not work for my purpose.
The text was updated successfully, but these errors were encountered:
Thank you. x = Symbolics.variables(:x, 1:N) works well. Any chance these functions can be added in the manual https://symbolics.juliasymbolics.org/dev/ or Symbolics wiki so that they can be easily searchable?
How to define a symbolic vector using for loop with Symbolics.jl?
For example, x=[x1, x2, x3, x4, …, x100], where xi are all variables defined using @variables.
It can be easily done using sympy.jl as
julia> N=100, x = [symbols(“x$i”) for i in 1:N].
For short vector, x = @variables x1, x2, x3 work. However for, 100 or even 1000 long vectors, a for loop would be useful.
Please note that I must use Symbolics.jl for the sake of speed and complicated matrix manipulation.
I am aware of the symbolic arrays introduced at Symbolic arrays · Symbolics.jl 1,
but it does not work for my purpose.
The text was updated successfully, but these errors were encountered: