# Create an array of independent variables of variable size, all dependent upon the same dependent variable

I have an array of variables that I've constructed, that all depend on time s

ntestarr = Array[n$#[s] &, NCap] {n$ 1[s], n$2[s], n$ 3[s], n$4[s], n$ 5[s], n$6[s], n$ 7[s],
n$8[s], n$ 9[s], n$10[s], n$ 11[s], n$12[s], n$ 13[s], n$14[s], n$ 15[s], n$16[s], n$ 17[s], n$18[s], n$ 19[s], n$20[s]}  However I would like to additionally create an array of the derivatives of these variables, that is something like ndtestarr=D[ntestarr]  However this does not work. Also, note that that there is a space between "n$" and "#", that I would like to get rid of in every term.

• The idiomatic way to create indexed variables in MMA is to use square brackets e.g. ntestarr=Table[n[i,s],{i,20}]. This saves you from turning strings into symbols etc. You can find the derivatives just as Henrik showed. But if you are going to use this for calculations, it's probably easier to have n[s_]=Table[n[i,s],{i,20}] and the derivative is n'[s]. – N.J.Evans Nov 15 '17 at 17:35
• This works perfectly thank you – Danny Weiss Nov 30 '17 at 23:05

ntestarr = Array[Symbol["n\$" <> ToString[#]][s] &, NCap]