I'm trying to get a list of all the variables in a symbolic expression. Some are named with Symbols, some are named with Subscript-ed symbols.
I can get a list of the Subscript-ed symbols with:
DeleteDuplicates@Cases[expr, Subscript[_Symbol, _Symbol], Infinity] I can get a list of Symbols with:
DeleteDuplicates@Cases[expr, _Symbol, Infinity] The problem with that second Cases statement is that it returns subscripted symbols in two parts-- the "base" and the "subscript". That is, Subscript[a,b] will return two symbols: {a,b}.
How do I construct a pattern such that I get back a list of all the symbolic variables of an expression, whether or not they're represented as subscripted? For example:
DeleteDuplicates@Cases[a+Subscript[b,c]*Subscript[d,e]^f,pattern,Infinity] returns {a,Subscript[b,c],Subscript[d,e],f}?
Subscript[f[t + t1], e + k]? $\endgroup$Subscriptheads is when it's a subscripted variable such asSubscript[r,bat]whererandbatare unassigned symbols. $\endgroup$