# define variable index

im in the medal of coding and i reached the point where i have something like this,

the problem is i have up to 35 terms and all should be index in order to preform summation to count all possibilities, is there any automatic way to generate as variable index as much as i want ? also is there any way to fill all the summations automatically ?

thanks

• Are you looking for Table[Subscript[u, Unique["x"]], 35], or maybe Array[Subscript[u, x[#]] &, 35]? (Subscript could be replaced by Indexed.)
– user31159
Commented Nov 7, 2016 at 21:21
• actually i want 35 term of u[x] with variable index, so i can do summation. in the pic its only 3 terms i need 32 term extra each term will have summation with same index letters Commented Nov 7, 2016 at 21:28
• Yes, I should have written it this way: Table[Subscript[u, Unique["x"]][t], 35], and Array[Subscript[u, x[#]][t] &, 35]. For instance for the latter, the sum iterators are the x[1], ..., x[35].
– user31159
Commented Nov 7, 2016 at 21:31
• the table command did not work, what about the summation ? Commented Nov 7, 2016 at 21:38

You could use $ii[1]$, $ii[2]$, $ii[3]$ etc instead of $ii$, $kk$, $ll$:

expr = Product[Indexed[u, ii[i]][t], {i, 3}];

Sum[expr, ##] & @@ Array[{ii[#], jj} &, 3]


• what about making it start from 1? this will generate the terms what about making it start from 1? Commented Nov 7, 2016 at 21:47
• @LoveEva, it implicitly starts from 1 but if you want it explicit use {ii[#], 1, jj} in the Array Commented Nov 7, 2016 at 21:50
• final thing, im using mathematica 7 and this command is only available in advanced versions of the program is there any alternative way in 7? Commented Nov 7, 2016 at 21:54
• @LoveEva, you can use Subscript instead of Indexed. Or just make the index an argument of u, as in u[ii[3], t] Commented Nov 7, 2016 at 22:03

If you really have that simple structure, exploit it:

Clear[u]
jj = 4;
Times @@ (Total /@ Array[u, {3, jj}])