Ask Your Question

Revision history [back]

To complement @ndomes answer, a good way to know what can be done with an object is to give it a name:

sage: a = (sqrt(2) - 1)*(sqrt(2)+1)

then, you can access all possible methods that available for this particular object by typing a. and then the TAB key:

sage: a.<TAB>

You will see a lot of things, in particular the .full_simplify() is pretty self explanatory:

sage: a.full_simplify()

This will also work for the the other expression:

sage: b = 1/(3*(1 + x)) - (2*x - 1)/(6*(x^2 - x + 1)) + 2/(3*(1 + ((2*x - 1)^2)/3))
sage: b.full_simplify()
1/(x^3 + 1)