Ask Your Question
0

log(e) won't convert to 1

asked 2020-09-26 01:18:11 +0100

cybervigilante gravatar image

updated 2020-10-03 08:55:37 +0100

FrédéricC gravatar image

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 flag offensive close merge delete

Comments

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()

ortollj gravatar imageortollj ( 2020-09-26 07:18:13 +0100 )edit

2 Answers

Sort by » oldest newest most voted
1

answered 2020-09-26 10:27:59 +0100

Emmanuel Charpentier gravatar image

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 ?

edit flag offensive delete link more
1

answered 2020-09-26 12:40:57 +0100

slelievre gravatar image

updated 2020-09-28 23:20:08 +0100

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
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-09-26 01:18:11 +0100

Seen: 262 times

Last updated: Sep 28 '20