# Summations on Variables with subscripts

One of my equations uses a set of variables which ultimately for a set of certain values gives a list of 8 numbers: c=13.9506 (31 - k) following cc(sub k) = Round[Table[13.950621339931203(31 - k), {k, 1, 8, 1}]] Results in the following List {419, 405, 391, 377, 363, 349, 335, 321} which feeds another equation with summation: **My problem is that the final Variable cc with a subscript k, when its used in the bellow summation it DOES not consider each element of the list as vector Instead it leaves the element as it is!! WHAT SHOULD I DO in order when the summation sees cc subscript 1 to use the value of 419, cc(sub 2) the value of 405 (but without denote each var separately)** enter code heretc = !( *UnderoverscriptBox[([Sum]), (k = 1), (depo)]( *SuperscriptBox[((1 + wacc)), (-k)] *SubscriptBox[(cc), (k)])) Forgive my ignorance and thank y in advance.

Please consider that I need to use the subscript and not use loops of if. A similar example of my problem can be seen in the picture attached where the summation doesnot count the values of the list according to subscript

• Nobody has to use Subcript and its ilk. And nobody should. Please provide complete and syntactically correct code and certainly someone around here can show you how to perform your task more elegantly. For the moment, I can say that Part and its short form [[ ]] should be prefered for indexing into lists and arrays (and in fact, into all Mathematica expressions). Also Indexed might be a good and robust way to index into arrays. Nov 25, 2019 at 16:21
• Thanks so much Henkrik I am aware of what y mean but I need the subscripts for analytical reasons!! I just want to check numerically my formulas and noticed that subscripts within summations donot work the usual way we know in mathematical notation!! they use the symbol with sub as atomic element not connected with the actual values of a list or arrays. Best description is given in the picture attached where the Ck doens take the lists values of C1=1599,14, C2=1585,14... just leave it as atomic element A solution for this case would be a way to connect the values of the list with C1,C2... Nov 25, 2019 at 20:31

I'm not sure what you're asking and I'm aware subscripts are discouraged but I've used them with success. First clear them out with the assignment $$a_n=.$$, then assign them, then can use like any other variable. Can even use a (integer) function as the subscript like $$a_{f(n)}$$. Keep in mind when using functions as subscripts, some of the variables will either not be assigned or have previous values. In the case below using myIntegerF[n] as the subscript, $$a_1$$ through $$a_5$$ have not been assigned or if not cleared out first will have the old values. Need to pay attention to this. Also, when I typed in this code in Mathematica I used the [ctrl] underscore key to input a formatted subscripted variable so don't have to use the function Subscript[a,n] below (it was not converted when I cut and pasted it).

Quiet@Table[Subscript[a, n] =., {n, 1, 100}];
Table[Subscript[a, n] = n, {n, 1, 100}]
Sum[Subscript[a, n], {n, 1, 100}]
Quiet@Table[Subscript[a, n] =., {n, 1, 100}];
myIntegerF[n_] := 2 n + 4;
Table[Subscript[a, myIntegerF[n]] = n, {n, 1, 10}]
Table[Subscript[a, n], {n, 1, 24}]

• Dear Dominic Please allow me to restate in a simple example: in previous steps mathematica found var(i)={20, 22, 27} than when in next step I use the Σi from 1 to 3 [var(i)*3] I want to have var1*3+var2*3+var3*3= 20(3)+22(3)+27(3) by using subscript notation instead of any other way (for analytical purposes). Nov 26, 2019 at 10:44

Regarding your last comment, how about assigning each subscripted variable a list like $$v_1=\{2,3,4\}$$, then $$(v_1)^3=\{4,9,16\}$$. So we could code:

Table[Subscript[v, i] =., {i, 1, 100}]
Table[Subscript[v,
i] = {RandomInteger[{1, 10}], RandomInteger[{1, 10}],
RandomInteger[{1, 10}]}, {i, 1, 10}]
Plus@@Sum[Subscript[v, i]^3, {i, 1, 10}]
`
• In[3]:= Table[Subscript[v, i] =., {i, 1, 100}] During evaluation of In[3]:= Unset::norep: Assignment on Subscript for Subscript[v, 1] not found. >> During evaluation of In[3]:= Unset::norep: Assignment on Subscript for Subscript[v, 2] not found. >> During evaluation of In[3]:= Unset::norep: Assignment on Subscript for Subscript[v, 3] not found. >> During evaluation of In[3]:= General::stop: Further output of Unset::norep will be suppressed during this calculation. >> Out[3]= {$Failed,$Failed, $Failed,$Failed, $Failed,$Failed, \ Nov 26, 2019 at 15:14
• Thanks so much Dominic but I donot understand the solution and its not working any way my issue is within the summation to calculate each value of v1 separately Nov 26, 2019 at 15:18