Opened 12 years ago

Last modified 7 years ago

#9466 closed defect

square root with all=True should not return ValueError but empty list — at Version 1

Reported by: mstreng Owned by: AlexGhitza
Priority: major Milestone: sage-5.12
Component: algebra Keywords: sd23 sd51 sqrt all
Cc: mderickx, ruckers Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by mstreng)

With Sage 4.4.4 and no relevant patches, I got the following:

sage: FiniteField(3)(2).sqrt(all = True)
[]

sage: 2.sqrt(extend = False, all = True)
ValueError: square root of 2 not an integer

sage: FiniteField(next_prime(2^100))(2).sqrt(extend = False, all = True)
ValueError: self must be a square

sage: _.<a>=FiniteField(9)
sage: a.sqrt(extend = False, all = True)
ValueError: must be a perfect square.

At sage days 23 we agreed that square root with all=True should not raise an error. If no square roots exist, then it should return an empty list.

Right now, it returns an empty list for elements of small prime finite fields, but raises an error for integers, elements of large prime finite fields, and elements of non-prime finite fields.

Change History (3)

comment:1 Changed 12 years ago by mstreng

  • Description modified (diff)

Changed 10 years ago by ruckers

Fixes the code: sage: 2.sqrt(extend = False, all = True)

Changed 10 years ago by ruckers

Fixes the code: sage: FiniteField?(next_prime(2100))(2).sqrt(extend = False, all = True)

Note: See TracTickets for help on using tickets.