Ask Your Question

Revision history [back]

For another perspective : symbolic expression are too wide so that equaity could be decided, in particular there can not be a consistent simplification procedure.

However, the expression you are dealing with represents an algebraic number. The field of algebraic numbers is a safer place : the problems above become decidable. So, let me suggest the following approach;

sage: a = (sqrt(2)+2)/(sqrt(2)+1)
sage: a.parent()
Symbolic Ring
sage: b = QQbar(a)
sage: b
1.414213562373095?
sage: b.parent()
Algebraic Field
sage: b.radical_expression()
sqrt(2)

Note howewer that the radical_expression method is a bit hackish and does not handle the wohle Galois theory (yet).

For another perspective : symbolic expression are too wide so that equaity could not be decided, in particular there can not be a consistent simplification procedure.

However, the expression you are dealing with represents an algebraic number. The field of algebraic numbers is a safer place : the problems above become decidable. So, let me suggest the following approach;

sage: a = (sqrt(2)+2)/(sqrt(2)+1)
sage: a.parent()
Symbolic Ring
sage: b = QQbar(a)
sage: b
1.414213562373095?
sage: b.parent()
Algebraic Field
sage: b.radical_expression()
sqrt(2)

Note howewer that the radical_expression method is a bit hackish and does not handle the wohle Galois theory (yet).