Ask Your Question

Revision history [back]

Note that in addition to the symbolic ring, Sage has an implementation of algebraic numbers.

Start in the symbolic ring and convert to algebraic numbers:

sage: a = 1 + (1/2 + i*sqrt(3)/2)^3
sage: aa = QQbar(a)
sage: aa
0.?e-18 + 0.?e-19*I
sage: aa.exactify()
sage: aa
0

Directly work with algebraic numbers:

sage: i = QQbar.0
sage: a = 1 + (1/2 + i*QQbar(3).sqrt()/2)^3
sage: a
0.?e-18 + 0.?e-19*I
sage: a.exactify()
sage: a
0