Incorrect output of a sum

24 views
Skip to first unread message

saad khalid

unread,
Mar 31, 2017, 2:17:25 PM3/31/17
to sage-support
Not what sure the issue is, but I couldn't find any typos in what I was doing. I define a function:

gamma3(a,b,c,j) = 1/((e^(2*pi*i*(a*j/16))-1)(e^(2*pi*i*(b*j/16))-1)(e^(2*pi*i*(c*j/16))-1))

Then I do the sum:

sum(gamma3(1,2,9,j) for j in [1..7]).n()

and this gives me
1.98224774759702 + 4.04301409838109*I

This isn't right. I copy almost exactly the same code into wolframalpha
sum for j from 1 to 7 of 1/((e^(2*pi*i*(1*j/16))-1)(e^(2*pi*i*(2*j/16))-1)(e^(2*pi*i*(9*j/16))-1))
and get
3 - .25i


What am I doing wrong here? Thanks!


John Cremona

unread,
Mar 31, 2017, 2:26:23 PM3/31/17
to SAGE support
It works fine if you insert * between the parentheses -- no implicit
multiplication:

sage: gamma3(a,b,c,j) =
1/((e^(2*pi*i*(a*j/16))-1)*(e^(2*pi*i*(b*j/16))-1)*(e^(2*pi*i*(c*j/16))-1))
sage: sum(gamma3(1,2,9,j) for j in [1..7]).n()
3.00000000000000 - 0.249999999999999*I
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support...@googlegroups.com.
> To post to this group, send email to sage-s...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.

saad khalid

unread,
Apr 1, 2017, 12:13:03 PM4/1/17
to sage-support
Wow, sorry about that, I forgot that part... thank you!


Reply all
Reply to author
Forward
0 new messages