Ask Your Question

Revision history [back]

It seems that the answer is no. But you can do the following

$ sage -sh
(sage-sh)$ python -O
Python 2.7.10 (default, Dec 23 2015, 08:49:15) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from sage.all import *     # long time
>>> R = PolynomialRing(ZZ, 'x')
>>> x = R.gen()
>>> (x**2 + 2*x + 1).factor()
(x + 1)^2

Be careful that Sage uses a preparser that is different from Python...