Skip to content

Symbolic expression to number fields #14602

@videlec

Description

@videlec

The ticket stands to improve the AlgebraicConverter in sage.symbolic.expression_converters and make it works with number fields.

As mentioned on ask the following fails

sage: K = QuadraticField(3)
sage: K(sqrt(3))
Traceback (most recent call last):
...
TypeError: ...

The following gives an answer with a wrong parent

sage: x = K(3)**(1/2); x
sqrt(3)
sage: a.parent()
Symbolic Ring

while it is possible to do

sage: y = K(3).sqrt(); y
a
sage: y == K.gen()
True

Finally, we hopefully have

sage: K.gen() == sqrt(3)
sqrt(3) == sqrt(3)
sage: bool(K.gen() == sqrt(3))
True

CC: @videlec @mkoeppe

Component: number fields

Author: Dave Morris

Branch/Commit: a5fc9f9

Reviewer: Vincent Delecroix

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions