|   | 1 |  initial version  | 
If your symbolic expression is a polynomial and your constants are algebraic numbers, work in a polynomial ring with coefficients in AA or QQbar.
sage: R.<x> = PolynomialRing(AA)
sage: a = AA(2).sqrt()
sage: x - a
x - 1.414213562373095?
Elements of AA or QQbar are exact. Compare:
sage: a = AA(2).sqrt()
sage: b = sqrt(2)
sage: c = n(sqrt(2))
sage: aa = a^2
sage: bb = b^2
sage: cc = c^2
sage: aa == 2
True
sage: bb == 2
2 == 2
sage: cc == 2
False
 Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.
 
                
                Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.