# log(e) won't convert to 1 Is there a way to make log(e) print as 1? I know they're equal but I can't get sage to do that, and in complex expressions it's tedious to redo all the log(e)s.

f(x) = e^x*cos(x)
f_int(x) = integrate(f,x)
f_int(x)
result
(e^x*cos(x)*log(e) + e^x*sin(x))/(log(e)^2 + 1)

edit retag close merge delete

1

which Sagemath version ? I got : 1/2*(cos(x) + sin(x))*e^x with 9.1

moreover I got the same with (e^x*cos(x)*log(e) + e^x*sin(x))/(log(e)^2 + 1).simplify()

Sort by » oldest newest most voted

on Sage 9.2.beta13, WorksForMe(TM):

sage: integrate(f(x),x)
1/2*(cos(x) + sin(x))*e^x


Didn't you inadvertently redefine (= scratch) e ?

more

Below:

• result when e is as when Sage starts
• result when e is a symbolic variable
• how to restore the initial value of e

With e as when Sage starts, no unsimplified log(e):

sage: log(e)
1

sage: f(x) = e^x*cos(x)
sage: f_int(x) = integrate(f, x)
sage: f_int(x)
1/2*(cos(x) + sin(x))*e^x


With e redefined as a symbolic variable, log(e) stays log(e):

sage: e = SR.var('e')
sage: log(e)
log(e)

sage: f(x) = e^x*cos(x)
sage: f_int(x) = integrate(f,x)
sage: f_int(x)
(e^x*cos(x)*log(e) + e^x*sin(x))/(log(e)^2 + 1)


To reset e to its default value, use either:

sage: reset('e')


or

sage: e = sage.symbolic.constants.e


or

sage: from sage.symbolic.constants import e


To figure out what import statement to use above, run this in a fresh Sage session:

sage: import_statements(e)
from sage.symbolic.constants import e

more