Logarithms
The other day, when I was wanting to code some financial formulae in F#, I got side-tracked and derived something that's not intuitive to me:
Can that really be? I didn't see an obvious mention of this in the Logarithms article on Wikipedia, nor in the pre-calc book we have at home. So maybe I screwed up the math? I tried some test cases with F#, by defining a function that, given a b and an x, evaluates both sides of that last equation, resulting in a tuple of two floats:
> let logcheck b x = (Math.Log(x, b), (1.0 / Math.Log(b, x)));;
val logcheck : float -> float -> float * float
> logcheck 2.0 3.0;;
val it : float * float = (1.584962501, 1.584962501)
> logcheck 5.0 11.2;;
val it : float * float = (1.501091629, 1.501091629)
> logcheck 7.382 123.123;;
val it : float * float = (2.407742101, 2.407742101)
The equivalence seems to be checking out, so maybe I did the math right. As it turns out, this equivalence is noted in the middle of a Wikipedia page. But what the heck does it mean?
Book ordered:
Can that really be? I didn't see an obvious mention of this in the Logarithms article on Wikipedia, nor in the pre-calc book we have at home. So maybe I screwed up the math? I tried some test cases with F#, by defining a function that, given a b and an x, evaluates both sides of that last equation, resulting in a tuple of two floats:
> let logcheck b x = (Math.Log(x, b), (1.0 / Math.Log(b, x)));;
val logcheck : float -> float -> float * float
> logcheck 2.0 3.0;;
val it : float * float = (1.584962501, 1.584962501)
> logcheck 5.0 11.2;;
val it : float * float = (1.501091629, 1.501091629)
> logcheck 7.382 123.123;;
val it : float * float = (2.407742101, 2.407742101)
The equivalence seems to be checking out, so maybe I did the math right. As it turns out, this equivalence is noted in the middle of a Wikipedia page. But what the heck does it mean?
Book ordered:
1 Comments:
At 12:55 AM , Anonymous said...
One way to understand basic logs is: A function taking two inputs and returning the required exponent to take the first number to the second number.
Example: Log(2, 8) = 3 since 2^y = 8 requires that y = 3.
When viewed this way, it is obvious that Log(8, 2) = 1/3 = 1/Log(2, 8).
Regards,
CarlMon
Post a Comment
Subscribe to Post Comments [Atom]
<< Home