If you just want to do simple arithmetic, you can use the FF class: In [1]: FF(12) Out[1]: ℤ₁₂
In [2]: FF(12)(4) Out[2]: 4 mod 12 In [3]: FF(12)(4)/FF(12)(11) Out[3]: 8 mod 12 Note that the name FF comes from finite field, so this may not work if the modulus is not a power of a prime. For example: In [4]: FF(12)(4)/FF(12)(2) --------------------------------------------------------------------------- NotInvertible Traceback (most recent call last) /Users/aaronmeurer/Documents/python/sympy/sympy/<ipython console> in <module>() /Users/aaronmeurer/Documents/python/sympy/sympy/sympy/polys/domains/modularinteger.pyc in __div__(self, other) 92 93 if val is not None: ---> 94 return self.__class__(self.val * self._invert(val)) 95 else: 96 return NotImplemented /Users/aaronmeurer/Documents/python/sympy/sympy/sympy/polys/domains/modularinteger.pyc in _invert(cls, value) 160 @classmethod 161 def _invert(cls, value): --> 162 return cls.dom.invert(value, cls.mod) 163 164 def invert(self): /Users/aaronmeurer/Documents/python/sympy/sympy/sympy/polys/domains/ring.pyc in invert(self, a, b) 39 return s % b 40 else: ---> 41 raise NotInvertible("zero divisor") 42 43 def revert(self, a): NotInvertible: zero divisor I'm not sure if you will get other errors if you use non-fields. If you want to solve congruence relations, like x = 2 mod 3, then you might look at this branch: https://github.com/sympy/sympy/pull/390. It would be great if you could give that branch a complete review, as I've only been able to comment on the code quality up to this point. Aaron Meurer On Fri, Sep 23, 2011 at 2:16 AM, smichr <smi...@gmail.com> wrote: > I'm not sure where to look in sympy for support of things like solving > congruence relationships (what number is 2 mod 3, 3 mod 5 and 2 mod 7; > answer 23 mod 105) and operations modulo n, e.g., from > http://tinyurl.com/3atamuj, > the following question: > > In Z_12, divide 4 by 2, 3, 5, 7,8, and 11 > > Do we have support for such things? > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To post to this group, send email to sympy@googlegroups.com. > To unsubscribe from this group, send email to > sympy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sympy?hl=en. > > -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.