Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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:

enter image description here

share|improve this question
1  
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
add comment

1 Answer

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}]

plot.png

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
add comment

Your Answer

 
discard

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.