# Revision history [back]

### Declaring variable to be in a particular field/ring/group

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.:

Z3=Integers(3)
Dummy.<x> = PolynomialRing(Z3)
3*x

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:
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)
2. assume('x is Z3') - doesn't seem to have any effect.