I am writing modules that need to create symbolic vectors and matrices on the fly, with cleared entries. I noticed the following problem:
Clear[w1] or Clear ["w1"] both work as per doc
Clear[Symbol["w"<>ToString[1]]] or Clear[ "w"<>ToString[1]] do not
Actually 1 is a running index in a Table being created. For example,
symbolicVector[letter_,n_]:=Module[{i,v=Table[0,{n}]},
For [i=1,i<=n,i++, vi=Symbol[letter<>ToString[i]]; Clear[vi]; v[[i]]=vi]; Return[v]];
Here symbolicVector["w",4] should return {w1,w2,w3,w4} with all entries properly Clear'ed. In my first implementation I used only Table; the above (entered here by hand) is to make easier to insert prints inside the loop. Is there a way to make this work? Thanks.