1 | initial version |
What bothers me is that, though Qb
is defined with an embedding in $\mathbb{C}$, there is no canonical coercion from Qb
to QQbar
, as if the information of the embedding was lost (ideally, there should be a difference between "number field" and "embedded number field"):
sage: cm = sage.structure.element.get_coercion_model()
sage: cm.common_parent(Qb,QQbar)
TypeError: no common canonical parent for objects with parents: 'Number Field in b with defining polynomial x^3 - 2*x^2 - 2*x - 2' and 'Algebraic Field'
Not even a conversion:
sage: QQbar(b)
TypeError: Illegal initializer for algebraic number
That said, the following workaround to consider b
as a real algebraic number could do the job:
sage: Qb.embeddings(AA)
[
Ring morphism:
From: Number Field in b with defining polynomial x^3 - 2*x^2 - 2*x - 2
To: Algebraic Real Field
Defn: b |--> 2.919639565839419?
]
sage: bb = Qb.embeddings(AA)[0](b) ; bb
2.919639565839419?
sage: 0 < bb
True
2 | No.2 Revision |
What bothers me is that, though Qb
is defined with an embedding in $\mathbb{C}$, there is no canonical coercion from Qb
to QQbar
, as if the information of the embedding was lost (ideally, there should be a difference between "number field" and "embedded number field"):field", even two different parents):
sage: cm = sage.structure.element.get_coercion_model()
sage: cm.common_parent(Qb,QQbar)
TypeError: no common canonical parent for objects with parents: 'Number Field in b with defining polynomial x^3 - 2*x^2 - 2*x - 2' and 'Algebraic Field'
Not even a conversion:
sage: QQbar(b)
TypeError: Illegal initializer for algebraic number
sage: AA(b)
TypeError: Illegal initializer for algebraic number
That said, the following workaround to consider b
as a real algebraic number could do the job:
sage: Qb.embeddings(AA)
[
Ring morphism:
From: Number Field in b with defining polynomial x^3 - 2*x^2 - 2*x - 2
To: Algebraic Real Field
Defn: b |--> 2.919639565839419?
]
sage: bb = Qb.embeddings(AA)[0](b) ; bb
2.919639565839419?
sage: 0 < bb
True