# Plotting a sum as a function of its upper bound

Apologies if this is easy to find in the documentation, but is there a quick way of doing the following up to any given 'n'?

a=
Im[n^ZetaZero[1]] + Re[n^ZetaZero[1]] + Im[n^ZetaZero[2]] + Re[n^ZetaZero[2]] +
Im[n^ZetaZero[3]] + Re[n^ZetaZero[3]] + Im[n^ZetaZero[4]] + Re[n^ZetaZero[4]] +
Im[n^ZetaZero[5]] + ... ;

Plot[{If[a >= 0, (a^2)/n, -(a^2)/n]}, {n, 0, 30}]


For clarity, I include the plot for n up to 30, for ZetaZero up to 100:

-
With n you're not referring to the n you use in the plot index specification, right? Do you mean something like this Plot[Sum[Im[n^ZetaZero[i]] + Re[n^ZetaZero[i]], {i, 5}], {n, 0, 20}]? I wonder what the 2 variables of your title stand for... – Sjoerd C. de Vries Nov 19 '13 at 22:34
Yes - I would like to plot for n^Re[ZetaZero[x]] + n^Im[ZetaZero[x]] up to some x for for some range of n. – martin Nov 19 '13 at 22:41
It seems that my code suggestion above does what you want then, or not? – Sjoerd C. de Vries Nov 19 '13 at 22:44
@Sjoerd C. de Vries, yes - many thanks, though it seems to take a lot longer to computer than if written out 'longhand'. I am using the following: a = Sum[Im[n^ZetaZero[i]] + Re[n^ZetaZero[i]], {i, 100}]; Plot[{If[a >= 0, (a^2)/n, -(a^2)/n]}, {n, 0, 30}] – martin Nov 19 '13 at 22:52

a[k_, n_] := Sum[Re[n^#] + Im[n^#] &[ZetaZero[i] // N], {i, k}]