Home arrow static arrow Java Programming [Archive] - Math.log()
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Math.log()
This topic has 11 replies on 1 page.

Posts:17
Registered: 3/11/04
Math.log()  
Mar 29, 2004 6:32 AM



 
Hi

(Just discard this, if you're not interested!)

Just out of curiosity; can someone tell me why they named it Math.log(), and not Math.ln(), as it performs a natural logarithm (often termed "ln"), and "log" is often used for logarithm base 10?
 

Posts:4,496
Registered: 19/06/02
Re: Math.log()  
Mar 29, 2004 6:58 AM (reply 1 of 11)



 
I think purists will tell you that ln() should not be used at all.

btw: The Math class has a log10 method in 1.5.
 

Posts:17
Registered: 3/11/04
Re: Math.log()  
Mar 29, 2004 7:07 AM (reply 2 of 11)



 
I think purists will tell you that ln() should not be
used at all.

Now, you see, I don't get that; I'd have said the opposite: "log" (for me) is the general expression (abbreviation) for logarithmus -> all bases, whereas "ln" would stand for logarithmus naturalis with base e (the one implemented).


btw: The Math class has a log10 method in 1.5.

:-)
 

Posts:11,200
Registered: 7/22/99
Re: Math.log()  
Mar 29, 2004 7:09 AM (reply 3 of 11)



 
Because of a long tradition, I suppose. The natural logarithm has been called "log" and the base 10 logarithm "log10" since the days of FORTRAN. The FORTRAN convention was copied to C, C++, and finally Java.

When I was in high school it was "lg" that meant a log in base 10 (it was called "Briggs logarithm") while "log" meant a log in any base that should be specified with a subscript. Base 2 logarithm was "lb." Apparently these conventions are not universal and no standards exist; according to Mathworld lg means base 2 and log means base 10...
http://mathworld.wolfram.com/Logarithm.html
 

Posts:4,496
Registered: 19/06/02
Re: Math.log()  
Mar 29, 2004 7:19 AM (reply 4 of 11)



 
I think purists will tell you that ln() should not
be used at all.

Now, you see, I don't get that; I'd have said the
opposite: "log" (for me) is the general expression
(abbreviation) for logarithmus -> all bases, whereas
"ln" would stand for logarithmus naturalis with base e
(the one implemented).

Are you American?
 

Posts:17
Registered: 3/11/04
Re: Math.log()  
Mar 29, 2004 9:56 AM (reply 5 of 11)



 
I think purists will tell you that ln() should
not
be used at all.

Now, you see, I don't get that; I'd have said the
opposite: "log" (for me) is the general expression
(abbreviation) for logarithmus -> all bases,
whereas
"ln" would stand for logarithmus naturalis with base
e
(the one implemented).

Are you American?

No ..., a HP user.
 

Posts:364
Registered: 6/10/03
Re: Math.log()  
Mar 30, 2004 1:51 AM (reply 6 of 11)



 
I think he is a Latinus Nuaturalis, and not an Americanus Bastardialus.
 

Posts:17
Registered: 3/11/04
Re: Math.log()  
Mar 30, 2004 1:55 AM (reply 7 of 11)



 
I think he is a Latinus Nuaturalis, and not an
Americanus Bastardialus.

I was a little bit ..., once.
 

Posts:4
Registered: 6/17/04
Re: Math.log()  
Jun 17, 2004 12:32 AM (reply 8 of 11)



 
natural log is the mother of all logs,

log2(x) = ln(x) / ln(2)
log10(x) = ln(x) / ln(10)

etc ... so you can have any base you want simply by having natural log ...

Apparently Java is defined by engineers and the Math library by the matheticians ... this is obvious-ed by the power of the language and its robotic documentation - not that usable in general. ;-)
 

Posts:4
Registered: 6/17/04
Re: Math.log()  
Jun 17, 2004 12:37 AM (reply 9 of 11)



 
oh sorry, the point is that since natural log is the mother of all logs and Math lib is defined by mathetician, the term 'log' officially represent natural log.

ln is used by primary school kids who learned about log10 first as log and later patch the term ln for log e

natural log is the mother of all logs,

log2(x) = ln(x) / ln(2)
log10(x) = ln(x) / ln(10)

etc ... so you can have any base you want simply by
having natural log ...

Apparently Java is defined by engineers and the Math
library by the matheticians ... this is obvious-ed by
the power of the language and its robotic
documentation - not that usable in general. ;-)
 

Posts:11,200
Registered: 7/22/99
Re: Math.log()  
Jun 17, 2004 1:50 AM (reply 10 of 11)



 
the term 'log' officially represent natural log.

Go tell that to a mathematician ...
 

Posts:2,909
Registered: 13.8.2003
Re: Math.log()  
Jun 17, 2004 2:05 AM (reply 11 of 11)



 
The natural log can be found in the forest, possibly left behind by a lumberjack.
 
This topic has 11 replies on 1 page.