Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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'?

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:

enter image description here

share|improve this question
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
up vote 1 down vote accepted

Here is one way to do it. I sure there are many more.

a[k_, n_] := Sum[Re[n^#] + Im[n^#] &[ZetaZero[i] // N], {i, k}]
Plot[With[{a = a[100, n]}, Sign[a] a^2/n], {n, 0, 30}]


share|improve this answer
thank you - seems a little quicker, though haven't tested the timing yet! Again - many thanks :) – martin Nov 20 '13 at 9:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.