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.Fri, 28 Nov 2014 17:44:44 +0100Declaring variable to be in a particular field/ring/grouphttps://ask.sagemath.org/question/25037/declaring-variable-to-be-in-a-particular-fieldringgroup/Is it possible to have Sage symbolically simplify expressions involving variables subject to the assumption that the variables take values in a defined domain (field/ring/group/etc)?
The closest I've gotten is to declare a dummy polynomial ring over my domain of interest so that its variable has some notion of the domain, e.g.:
<pre>Z3=Integers(3)
Dummy.<x> = PolynomialRing(Z3)
3*x</pre>
evaluates to "0" as I'd expect, but sage fails to simplify "x^3" to "x", which ISTM should be doable if it really understood that x is a variable in Z/3Z.
Related things I've found in my searches that haven't panned out:<br/>
1. var('x', domain=*foo*) -- apparently *foo* can only be one of real/complex/positive (where I'd like to be able to say 'Z3' in the example above)<br/>
2. assume('x is Z3') - doesn't seem to have any effect.a1846583Fri, 28 Nov 2014 17:44:44 +0100https://ask.sagemath.org/question/25037/