Ask Your Question

Revision history [back]

The closest you can get is with Maxima's ratsimp:

sage: ex = trm.expand()
sage: m = ex._maxima_()
sage: m.ratsimp(sqrt(2)).sage()
sqrt(2)*(3*b + d) + 2*sqrt(2)*c + 3*a + c + 4*d