Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: log to the base 2


From   "Rodrigo A. Alfaro" <ralfaro76@hotmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: RE: log to the base 2
Date   Tue, 17 Oct 2006 13:53:11 -0400

What do you mean with easy?

I think that the famous book of Abramovitch "Handbook of Formula...." (maybe 
the reference there... I have it in some backup file) explains that the 
algorithm for the approximation of logarithm works better for base 10 than 
other lower base (e, 2 or whatever). For that reason, log10 is computed and 
log or ln is obtained as a second result using the property of logarithms. 
Therefore the natural was added and the unnatural or common is the original. 
I don't know how Stata works here (interesting question), but if you take a 
regular scientific calculator you will see log10 and ln not log2 or log5... 
the chip was produced in 60 (maybe before) with the 'tables' for log10.

Rodrigo.



----- Original Message ----- 
From: "Raphael Fraser" <raphael.fraser@gmail.com>
To: <statalist@hsphsun2.harvard.edu>
Sent: Tuesday, October 17, 2006 1:33 PM
Subject: Re: st: RE: log to the base 2


I thought the logs were so easy to calculate this would be a single
standard function in Stata. I suppose you thought: if they are so easy
to calculate why write a function.


On 10/17/06, Nick Cox <n.j.cox@durham.ac.uk> wrote:
> You hardly need any such function. The recipe
> log(x) / log(2) or log10(x) / log10(2) will suffice.
>
> For example,
>
> . di log(8) / log(2)
> 3
>
> Strictly just one log function is enough, but -log10()-
> is a convenience for those preferring the unnatural.
>
> Nick
> n.j.cox@durham.ac.uk
>
> Raphael Fraser
>
> > I have been trying to find a function that can calculate the log of a
> > number to base 2. I can't find one. Am I missing something here or am
> > I not searching hard enough? Can any one help?
> >
> > I see log to base 10 and log to base e but what happen to the
> > other bases?
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index