log to parameterised base?

Why does java.lang.Math have:

log( a ) = loge( a )

but no

log( val, base ) = logbase( a )?

I need to take floats and do a base-2 log…

Is there some obvious transformation that takes you from arbitrary base to arbitrary base that I have embarassingly forgotten? :-[

logb® = loga® / loga(b)

eg:
log10(7) = log2(7) / log2(10)

Thanks, man. I went to a secondary school famous for high quality of its maths teaching/students and was in the top set, yet thanks to a f***ed up old vicar (head of maths!) was never taught basic stuff like that - he was too busy doing 2nd-year undergraduate teaching, and had a rule: Any student who was so stupid and lazy they took notes during his class was thrown out (literally: I saw him once pick up a 16 stone lad (who was one of the top rugby players in the school) one-handed, and actually throw him out the door in a fit of righteous (holy? unholy?) rage.

LOL. Oh, yeah, we weren’t allowed text-books either; I think he considered them somewhere near to “spawn of Satan” in the wider scheme of things. No notes and no textbooks made life…well, kinda tricky. ;D

EDIT: so stuff like this I didn’t find out until undergrad courses, and it will forever be kind of “new” to me…

They are adding a log10 method in Tiger to help those who haven’t learnt these basic rules for logarithms. A log2 method was proposed but appears to have been rejected.

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4919337

[quote]They are adding a log10 method in Tiger to help those who haven’t learnt these basic rules for logarithms. A log2 method was proposed but appears to have been rejected.

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4919337
[/quote]
Log2 rejected? What are they thinking of? I’ll take a log2 over a log10 any day.

shmoove

Remember that the accuracy requirements for the Math package mean that simply writing log2(x) as log(x)/log(2) would probably not be sufficient. Thus this apparently simple task of implementing log2 is rather more complex than it first appears (at least for Java implementors). Sun probably don’t have the resources to implement all the proposed math methods in the Tiger time frame, to the accuracy required by the specification and the performance we would like to expect.

As to log10 vs log2, I think log10 was the correct choice. It remains the most commonly understood form of logarithm outside specialist communities.

[quote]As to log10 vs log2, I think log10 was the correct choice. It remains the most commonly understood form of logarithm outside specialist communities.
[/quote]
Wouldn’t you consider programmers a specialist community? One that might find log2 more useful than log10?
Well, I guess they know better…

shmoove

In my experience log2 in code (as opposed to proofs of program behaviour) is very rare.

Hehe well my math/physic skills are also a bit rusty.

I guess it’s about time doing a refresh. Kinda funny actually. As you might know… the refresh intervals for keeping information for a life time are also logarithmic :wink: