I'm trying to demonstrate the Lagrange approach to solving a cubic to a student.
w = CyclotomicField(3).gen()
x0 = var('x0')
x1 = var('x1')
x2 = var('x2')
s0 = x0 + x1 + x2
s1 = x0 + x1*w + x2*w^2
s2 = x0 + x1*w^2 + x2*w
After expanding s1^3 + s2^3
, the output is cluttered with cube roots of unity (these _should_ cancel out).
I would like to treat w
abstractly, where the only relevant constraints are w^2 + w + 1 == 0
and w^3 == 1
.
When simplifying, I would like it to collect all coefficients of powers of w
and automatically apply the above rules (e.g: w^2 + w == -1
).
Or -- is there some other way to do this?
Specifically, at least for the sake of readability, I would like to the roots to be represented only by w
.