Skip to content

sqrt(Mod(,),all=True) should raise more informative NotImplmentedError #38802

@maxale

Description

@maxale

Steps To Reproduce

Check this out:

sage: is_square(Mod(2, 101010))
False
sage: sqrt(Mod(2, 101010),all=True)
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)

Expected Behavior

Sage should simply return [], ie. an empty list of roots (as there are none exist). In fact, a reason (which I believe is tested by is_squre()) is very simple: the modulus 101010 is divisible by 3, while 2 is not a square modulo 3.

Actual Behavior

Raises NotImplemented, while is_square() easily establishes that there are no solutions.

Additional Information

Btw, sqrt(Mod(2, 101010)) (ie. without all=True) returns a weird/incorrect result, which I submit as another issue #38803.

Environment

  • OS: Ubuntu 24.04.1 LTS
  • Sage Version: 10.5.beta6

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions