Hi, We don't need any separate functions for finding square roots and cube roots. Following are from csolve[0] branch -
For the cube root In [14]: from sympy.polys.galoistools import gf_csolve In [15]: gf_csolve([1, 0, 0, -4], 7) Out[15]: [] In [16]: gf_csolve([1, 0, 0, -4], 11) Out[16]: [5] In [17]: [x for x in range(7) if x**3 % 7 == 4] Out[17]: [] In [18]: [x for x in range(7) if x**3 % 11 == 4] Out[18]: [5] For the square root In [19]: gf_csolve([1, 0, -4], 7) Out[19]: [5, 2] In [20]: [x for x in range(7) if x**2 % 7 == 4] Out[20]: [2, 5] But I don't know where and how to modify it to be able to make it as an attribute of finite fields. On Thu, Sep 29, 2011 at 7:59 PM, Chris Smith <[email protected]> wrote: > As a followup, if anyone is interested, there is a fairly tractable > paper on computing cube roots in a modular field at > http://eprint.iacr.org/2009/457.pdf . It does not appear that this is > implemented yet: > > ```python > >>> m7(4)**Rational(1,3) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "sympy\polys\domains\modularinteger.py", line 129, in __pow__ > return self.__class__(val**exp) > File "sympy\polys\domains\modularinteger.py", line 18, in __init__ > self.val = self.dom.convert(val) % self.mod > File "sympy\polys\domains\domain.py", line 103, in convert > return K1.from_sympy(a) > File "sympy\polys\domains\pythonintegerring.py", line 34, in from_sympy > raise CoercionFailed("expected an integer, got %s" % a) > sympy.polys.polyerrors.CoercionFailed: expected an integer, got 2**(2/3) > ``` > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sympy?hl=en. > > -- -Regards Hector Whenever you think you can or you can't, in either way you are right. [0] https://github.com/sympy/sympy/pull/390 -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
