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, 17 Jan 2024 22:46:28 +0100Symbolic arithmetic in a number fieldhttps://ask.sagemath.org/question/75522/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`.kejv2Wed, 17 Jan 2024 22:46:28 +0100https://ask.sagemath.org/question/75522/