Ask Your Question

log base 10

asked 2011-12-01 12:46:54 +0200

Jason gravatar image

Is there a built-in way to use a log with base other than e? The log documentation doesn't show any example (I thought log(10,x) was what I wanted for a while but it's actually different than what one might expect).

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2011-12-01 13:07:22 +0200

kcrisman gravatar image

This is in log?:


      sage: log(e^2)
      sage: log(1024, 2); RDF(log(1024, 2))

So log(x,10) should be what you're looking for...

edit flag offensive delete link more


Thanks, I wasn't aware that log_b(x) was equivalent to log(x)/log(b). Might be good to add that to the docs. (I got hung up because I saw log(10)/log(2) in the log? documentation and assumed it meant that log(x,y) was something that didn't help me, because it didn't say "To use the log in base b, do this")

Jason gravatar imageJason ( 2011-12-01 13:23:51 +0200 )edit

Well, the very first line of `log?` is "Return the logarithm of x to the given base." See But if you think we should be a little more explicit, let us know and we could open a ticket...

kcrisman gravatar imagekcrisman ( 2011-12-01 15:53:05 +0200 )edit

If you could make this change it would be great: "EXAMPLES: sage: log(e^2)" : To something like: EXAMPLES: To change the base of the logarithm, add a second parameter. sage: log(1000,10): 3 Small change but helpful!

Jason gravatar imageJason ( 2011-12-01 16:16:40 +0200 )edit
kcrisman gravatar imagekcrisman ( 2011-12-03 10:46:20 +0200 )edit

Your Answer

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

Add Answer

Question Tools


Asked: 2011-12-01 12:46:54 +0200

Seen: 12,975 times

Last updated: Dec 01 '11