Coder's Guild Mailing List

Re: Natural Logarithm

Posted by Jes Rahbek Klinke on 1999-04-15

Matthew Pratt wrote:
>--- Kspansel@xxx.xxx wrote:
>> In a message dated 4/13/99 6:54:00 PM Pacific
>> Daylight Time, 
>> palfrader@xxxxxxx.xxx writes:
>> 
>> > s ASM: no predefined func :)
>> >  in most others, there is a 'ln' or a 'log' or
>> something like this.
>> 
>> Well...what I mean is there like a mathematical
>> formula for finding ln.  Like 
>> a pencil and paper thing.  No calculators or
>> computers.  hehe.  Thanks.  I 
>> hope I got my point straight this time.  Let me know
>> if you need me to 
>> clarify things.  Thanks.  
>
>Isn't it a infinite Taylor series?? 
>
>Something like 1/2 + 1/3 + 1/4 + 1/5 ....
>
>Or am I getting it confused with something else. You
>need a good maths textbook. The only one I have here
>at the moment is "Fundamentals of differential
>equations and boundry value problems".
>
>Jeez its been a while since high school for me...

You are very close. The value of your expression
is in fact the natural logaritm of 2. The more general
Taylor polynomial for the natural logaritm of x looks
like this:

ln(1+x) = x - x^2/2 + x^3/3 - x^4/4 + ...

But it is only valid for -1 < x <= 1. For smaller values
the logarithm simply is not defined (unless you use
complex numbers), for larger values you can use the
equation

ln(2^n * x) = n * ln(2) + ln(x)

Using this you can take a large argument, and
repeatedly divide it by two, until it is small enough
for the first formula, then you simply add the
number of times you divided by two multiplied
by the constant ln(2) to the result.

I hope this was what you were looking for
-Jes Klinke