Re: How to solve this natural log problem?
- From: David W. Cantrell <DWCantrell@xxxxxxxxxxx>
- Date: 29 Jan 2007 21:07:11 GMT
"Dirk Van de moortel" <dirkvandemoortel@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
"David W. Cantrell" <DWCantrell@xxxxxxxxxxx> wrote in message
news:20070129122419.199$HL@xxxxxxxxxxxxxxxxx
"Dirk Van de moortel" <dirkvandemoortel@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
wrote: <amy_burton2007@xxxxxxxxx> wrote in message
news:1170055954.369782.189430@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
How to solve for x?
4000x = -6.9 - ln x
Take excel and write a number in cell A1.
In cell A2 enter the formula
= A1 - ( 4000*A1 + 6.9 + LN(A1) ) / ( 4000 + 1/A1 )
and copy this down to about A20.
This is Newton's method with f(x) = 4000 x + 6.9 + ln(x)
You're going to need a very small number to start with in A1
Try putting 1, 0.1, 0.01, 0.001 etc... in A1 and see what happens.
If you don't have excel, just take a high precision calculator
and you'll find the result in a few minutes.
My first preference would be to use the Lambert W function, as Rob did.
Yes, although excel doesn't have the Lambert W function
And I don't have Excel. :-)
(and
I have *never* seen a home/garden/kitchen calculator offer it),
there is, at least on this group, a strange tendency to mention
Lambert W whenever someone is looking for a solution to this
kind of equations.
Strange :-)
My second preference would be to use some analysis to get an
approximate solution. Then, if that's not sufficiently accurate, it at
least gives a good value for A1 in Newton's (or some other iterative)
method.
Knowing that x must be a small positive number, the equation
a x = -b - ln(x)
has the approximate solution
x = (2a + 3c - Sqrt(-2a^2 + 24ac + 9c^2)) / (a(a - 2c))
where c = e^b.
Using a = 4000 and b = 6.9 in the above, we get the approximate
solution
x = 0.000308... For comparison, the solution, as mentioned by Rob, is
x = 0.0003016...
Yes, that's what Excel gives me after a mere 5 iterations
with a seed of 0.001.
OK, let's assume that Amy is using a common calculator. If she heeds your
advice to "Try putting 1, 0.1, 0.01, 0.001 etc... in A1 and see what
happens.", she will be frustrated by an error message at the second
iteration using 1, 0.1 or 0.01 for A1. (The error occurs because her
calculator cannot handle the log of a negative number.)
I'm advocating that one not pick A1 "blindly". If you don't like the
approximation I gave earlier (because it's too complicated?), then merely
use
1/(a + e^b)
a much cruder approximation, for A1. Doing so will still avoid any error
messages.
I had given the more accurate approximation earlier because I thought that
perhaps it would be accurate enough for Amy's purpose without any
iterations at all. (Her "6.9" might be an approximation with just two
significant digits.)
David
.
- References:
- How to solve this natural log problem?
- From: amy_burton2007
- Re: How to solve this natural log problem?
- From: Dirk Van de moortel
- Re: How to solve this natural log problem?
- From: David W . Cantrell
- Re: How to solve this natural log problem?
- From: Dirk Van de moortel
- How to solve this natural log problem?
- Prev by Date: Re: a simple(?) probability question...
- Next by Date: Re: Size of equivalence class of Cauchy sequences
- Previous by thread: Re: How to solve this natural log problem?
- Next by thread: Re: How to solve this natural log problem?
- Index(es):
Relevant Pages
|