dcsimg
logarithm with base!=e
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Pikaichu_Pokemonov
Posted On:   Wednesday, January 18, 2006 04:54 AM

Is there a java function that calculates a log of a given number with base different of e?

Re: logarithm with base!=e

Posted By:   Nils_Kulk  
Posted On:   Wednesday, January 18, 2006 06:13 AM

Hi,

Since 1.5 the Math class also has a log10 method. Other bases can be calculated with a simple formula. Let loga be the logarithm base a, logb the logarithm base b, then:

loga(x) = logb(x) / logb(a). So for example log2(8) = log10(8) / log10(2) or log2(8) = ln(8) / ln(2)
About | Sitemap | Contact