Ask Your Question

Revision history [back]

Building on @Emmanuel Charpentier's answer.

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

Building on @Emmanuel Charpentier's answer.

Below: - Below:

  • result when e is as when Sage starts - starts
  • result when e is a symbolic variable - 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