ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 10 Jul 2013 11:45:45 +0200Summing with Euler_phi Errorhttps://ask.sagemath.org/question/10340/summing-with-euler_phi-error/New to sage, having some trouble with summation.
z, k both declared as variables.
sum((euler_phi(k)/k)*log(1/(1-2*z^k)),k,2,5)
Error: not an integer argument in an arithmetic function (18)
If I change it to euler_phi(5)/5 it's fine.
Wed, 10 Jul 2013 11:29:53 +0200https://ask.sagemath.org/question/10340/summing-with-euler_phi-error/Answer by vdelecroix for <p>New to sage, having some trouble with summation. </p>
<p>z, k both declared as variables.</p>
<p>sum((euler_phi(k)/k)<em>log(1/(1-2</em>z^k)),k,2,5)</p>
<p>Error: not an integer argument in an arithmetic function (18)
If I change it to euler_phi(5)/5 it's fine.</p>
https://ask.sagemath.org/question/10340/summing-with-euler_phi-error/?answer=15219#post-id-15219I guess this is because `euler_phi` does not accept symbolic argument
sage: var('z')
sage: euler_phi(z)
Traceback (most recent call last):
...
PariError: not an integer argument in an arithmetic function (18)
Nevertheless, you can do
sage: sum((euler_phi(k)/k)*log(1/(1-2*z^k)) for k in xrange(2,5))
1/2*log(-1/(2*z^4 - 1)) + 2/3*log(-1/(2*z^3 - 1)) + 1/2*log(-1/(2*z^2 - 1))Wed, 10 Jul 2013 11:39:36 +0200https://ask.sagemath.org/question/10340/summing-with-euler_phi-error/?answer=15219#post-id-15219Comment by kcrisman for <p>I guess this is because <code>euler_phi</code> does not accept symbolic argument</p>
<pre><code>sage: var('z')
sage: euler_phi(z)
Traceback (most recent call last):
...
PariError: not an integer argument in an arithmetic function (18)
</code></pre>
<p>Nevertheless, you can do</p>
<pre><code>sage: sum((euler_phi(k)/k)*log(1/(1-2*z^k)) for k in xrange(2,5))
1/2*log(-1/(2*z^4 - 1)) + 2/3*log(-1/(2*z^3 - 1)) + 1/2*log(-1/(2*z^2 - 1))
</code></pre>
https://ask.sagemath.org/question/10340/summing-with-euler_phi-error/?comment=17311#post-id-17311See also http://trac.sagemath.org/sage_trac/ticket/8383Wed, 10 Jul 2013 11:45:45 +0200https://ask.sagemath.org/question/10340/summing-with-euler_phi-error/?comment=17311#post-id-17311