Ask Your Question

Revision history [back]

Quick and dirty fix, look at the algebraic field:

sage: b = QQbar(k)
sage: b.as_number_field_element()
(Number Field in a with defining polynomial y^2 - 7,
 3*a + 37/4,
 Ring morphism:
  From: Number Field in a with defining polynomial y^2 - 7
  To:   Algebraic Real Field
  Defn: a |--> 2.645751311064591?)

Here, b is 3*a + 37/4, and a is the root of y^2 - 7 which is close to 2.645751311064591.

Also, you can do things like:

sage: b.minpoly()
x^2 - 37/2*x + 361/16

Quick and dirty fix, look at the algebraic field:

sage: b = QQbar(k)
sage: b.as_number_field_element()
(Number Field in a with defining polynomial y^2 - 7,
 3*a + 37/4,
 Ring morphism:
  From: Number Field in a with defining polynomial y^2 - 7
  To:   Algebraic Real Field
  Defn: a |--> 2.645751311064591?)

Here, b is 3*a + 37/4, and a is the root of y^2 - 7 which is close to 2.645751311064591., so there should be a way to get your formula from this automatically from Sage.

Also, you can do things like:

sage: b.minpoly()
x^2 - 37/2*x + 361/16