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
I write a macro for @vars when I use symengine. It can be applied to construct multi symbol variables. It seems convenience. I donot know if there are better way to realize this feature. I just leave the code here. Feel free to use or improve it.
macro vars(x,n::Int64)
q=Expr(:block)
for i = 1:n
push!(q.args, Expr(:(=), esc(Symbol("$x$i")), Expr(:call, :(SymEngine._symbol), Expr(:quote, Symbol("$x$i")))))
end
push!(q.args, Expr(:tuple, map(esc, "$x".*map(string,1:n).|>Symbol)...))
q
end
To use it, you can call @vars x 16 @vars α 16
The outputs are
This is also available through something like: [symbols("α$i") for i in 1:30]. I would think that is sufficient. Users might get confused as to what this does: n=16; @vars x n.
I write a macro for @vars when I use symengine. It can be applied to construct multi symbol variables. It seems convenience. I donot know if there are better way to realize this feature. I just leave the code here. Feel free to use or improve it.
To use it, you can call
@vars x 16
@vars α 16
The outputs are
The text was updated successfully, but these errors were encountered: