Ask Your Question

Revision history [back]

Having defined:

sage: a = sqrt(-7)

This works:

sage: number_field_elements_from_algebraics([a])
(Number Field in a with defining polynomial y^2 - y + 2,
 [-2*a + 1],
 Ring morphism:
   From: Number Field in a with defining polynomial y^2 - y + 2
   To:   Algebraic Field
   Defn: a |--> 0.50000000000000000? - 1.322875655532296?*I)

This fails:

sage: number_field_elements_from_algebraics([a], embedded=True)
Traceback (most recent call last)
...
NotImplementedError:

The reason for why only embeddings of real numbers are supported is that nobody has done it yet. If you can do it, your contribution will be appreciated.

Having defined:

sage: a = sqrt(-7)

This works:

sage: number_field_elements_from_algebraics([a])
(Number Field in a with defining polynomial y^2 - y + 2,
 [-2*a + 1],
 Ring morphism:
   From: Number Field in a with defining polynomial y^2 - y + 2
   To:   Algebraic Field
   Defn: a |--> 0.50000000000000000? - 1.322875655532296?*I)

This fails:

sage: number_field_elements_from_algebraics([a], embedded=True)
Traceback (most recent call last)
...
NotImplementedError:

The reason for why only embeddings of real numbers are supported is that nobody has done it yet. If you can do it, your contribution will be appreciated.

Regarding your worry that there was a good reason: if so, the correct thing to do would have been to add as a comment about the reason, and to raise a ValueError rather than a NotImplementedError.