I think this is just maxima's inability to simplify this expression,
which is easy to see by invariance under multiplication by e^(2pi i/
n), but less obvious from first principles. (The even case is easy
because the expressions come in +/- pairs.)
If you really want to work with roots of unity, you can use number
fields.
sage: K.<a> = CyclotomicField(7) # Q[a] where a is a 7th root of unity.
sage: a^7
1
sage: sum([a^r for r in range(7)])
0
- Robert
OK, that's just weird. A test for equality changes the value?? Am I
reading that correctly?
I tried tracing this, but got lost in a maze of twisty little
passages, all subtly different...
Justin
--
Justin C. Walker, Curmudgeon-At-Large
Director
Institute for the Enhancement of the Director's Income
--------
"Weaseling out of things is what separates us from the animals.
Well, except the weasel."
- Homer J Simpson
--------
Ok, I was wrong: it's not weird, it's cool!
Thanks for the explanation.
Justin
--
Justin C. Walker, Curmudgeon-At-Large, Director
Institute for the Enhancement of the Director's Income
--------
The path of least resistance:
it's not just for electricity any more.
--------
> Instead of using these symbolic expressions, you may want to
> manipulate roots of unity using QQbar. Here's an example:
>
> sage: def sumofroots(d):
> ....: return sum([QQbar.zeta(d)^r for r in range(d)])
> ....:
> sage: v = sumofroots(4); v
> 0
> sage: v = sumofroots(5); v
> [-7.3183646642771550e-19 .. 7.3183646642771550e-19] +
> [-5.4210108624275222e-19 .. 5.4210108624275222e-19]*I
> sage: v == 0
> True
> sage: v
> 0
>
> Note that even though the numbers print out in a floating-point
> notation, computations using QQbar are exact.
This is interesting. After playing around a bit, I'm wondering why v
can't be converted into an integer? Both Integer(v) and ZZ(v)
complain.
Franco
--
I would use the CyclotomicField. For example,
sage: s = SFASchur(QQ)
sage: a = s([2,2]).expand(8)
sage: C.<zeta15> = CyclotomicField(15)
sage: zeta3 = zeta15^5
sage: zeta5 = zeta15^3
sage: a([zeta3^d for d in range(3)]+[zeta5^d for d in range(5)])
0
--Mike