Ask Your Question

Revision history [back]

It really depends on what you mean by an element... A number is well defined in mathematics but not inside a computer: there are many ways in Sage to represent a number. What you can do is to work with the set of algebraic numbers QQbar and obtain the degree of any element there

sage: sqrt2 = QQbar(sqrt(2))
sage: sqrt3 = QQbar(sqrt(3))
sage: a = sqrt2 + sqrt3    # this element has degree 4
sage: a.minpoly()
x^4 - 10*x^2 + 1
sage: b = a **2            # this element has degree 2
sage: b.minpoly()
x^2 - 10*x + 1