Revision history [back]

You can go back-and-forth from sage to sympy, i.e. turn your expression into a sympy one then ask sympy to factor it, then transform it back into a sage object:

sage: i = integrate(exp(h)*exp(x)*f(x),x)
sage: i
integrate(e^(h + x)*f(x), x)

sage: i._sympy_().factor()._sage_()
e^h*integrate(e^x*f(x), x)


You can go back-and-forth from sage to sympy, i.e. turn your expression into a sympy one then ask sympy to factor it, then transform it back into a sage object:

sage: i = integrate(exp(h)*exp(x)*f(x),x)
sage: integrate(exp(h)*exp(x)*f(x),x) ; i
integrate(e^(h + x)*f(x), x)

sage: i._sympy_().factor()._sage_()
e^h*integrate(e^x*f(x), x)