Ask Your Question

Revision history [back]

The default backend for symbolic integration is Maxima. You can find out more about the Maxima interface here: http://www.sagemath.org/doc/reference/sage/interfaces/maxima.html

In Maxima, there is a global flag called logabs which changes the default behavior when integrating functions like 1/x or tan(x). Here is how you can get Maxima (via Sage) to return the anti-derivative of 1/x on its full natural domain:

sage: x=var('x')
sage: maxima.eval('logabs:true')
sage: maxima.integrate(1/x,x)
log(abs(x))
sage: maxima.integrate(tan(x),x)
log(sec(x))

I don't know if there is currently a way to accomplish this through the Sage integrate function directly. I do know that for definite integrals, log(abs(x)) is used as an anti-derivative of 1/x:

sage: integrate(1/x, x)
log(x)
sage: integrate(1/x, x, -2, -1)
-log(2)

which is correct.