Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Symbolic arithmetic in a number field

How to prevent expanding the value of the generating element in symbolic expressions?

E.<w> = CyclotomicField(3)
w^4 # shows w
(w+1)^2 # shows w
a = var('a')
(w + a)^2 # shows an expression with w expanded as a complex number

How can I make the last expression show up as $w^2 + 2aw + a^2$?

Symbolic arithmetic in a number field

How to prevent expanding the value of the generating element in symbolic expressions?

E.<w> = CyclotomicField(3)
w^4 # shows w
(w+1)^2 # shows w
a = var('a')
(w + a)^2 # shows an expression with w expanded as a complex number

How can I make the last expression show up as $w^2 + 2aw + a^2$?

My use case is to expand $(a+bw+cw^2)^3$ so that the result is expressed as a rational (or integer) combination of 1, w, w^2.