Ask Your Question

Revision history [back]

The square root of a square is not the same as the number. (There is controversy over whether it is the absolute value of the number, or either plus or minus the number. Don't ask.)

But if you want to make it do that, use this:

sage: S.canonicalize_radical()
(3*p + 1)*t^2 - 2*p^2 - 2*(p - 1)*t + p + 1


which even does some factoring for you as a bonus.