Ask Your Question
1

log base 10

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

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
4

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

kcrisman gravatar image

This is in log?:

   EXAMPLES:

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

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

edit flag offensive delete link more

Comments

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 +0100 )edit

Well, the very first line of `log?` is "Return the logarithm of x to the given base." See http://www.sagemath.org/doc/reference/sage/functions/log.html#sage.functions.log.log. 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 +0100 )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 +0100 )edit
kcrisman gravatar imagekcrisman ( 2011-12-03 10:46:20 +0100 )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

Stats

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

Seen: 13,203 times

Last updated: Dec 01 '11