I have a Module which has $n$ local variables, say $a_i$. Now I want to write my Module in such a way that I do not need to change the code for varying $n$.
My approach is
localVar=Table[Subscript[a, i], {i, 0, n}];
MyModule[arguments_] := Module[localVar,...
However, Mathematica interprets localVar as a local Variable, rather than the list which I have defined before.
Is there a way to tell it to take the localVar inside Module as the thing I defined before?
Module[Evaluate[localVar], ...]
. And like you noticed: you can't haveSubscript
or anything like that as local variables. It has to be a list of symbols. $\endgroup$