Skip to content

square root with all=True should not return ValueError but empty list #9466

@mstreng

Description

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

apply

CC: @koffie @sagetrac-ruckers

Component: algebra

Keywords: sd23 sd51 sqrt all

Author: Marco Streng, Sonseeahray Rucker

Reviewer: Alejandro Argaez, Angelos Koutsianas

Merged: sage-5.12.beta3

Issue created by migration from https://trac.sagemath.org/ticket/9466

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions