How to solve logarithmic functions

49 Views Asked by At

I'd like to know is there any way can solve the equation such as ln(1+x) = ax+b, where ln() is natural log. I can plot the figure out and find the intersection, but now 'a' and 'b' are arbitary numbers and is there any approximation approach to estimate the solution?

3

There are 3 best solutions below

0
On

We can do this using the Lambert W function, the inverse of

$$f(x) = xe^x$$

We have

$$\ln(1+x)=ax+b$$

$$1+x = e^{ax+b}$$

Substituting $y=1+x$:

$$y=e^{ay-a+b}$$

$$ye^{-ay} = e^{b-a}$$

$$-aye^{-ay} = -a e^{b-a}$$

$$-ay = W\left(-ae^{b-a}\right)$$

$$x = -\frac{W\left(-ae^{b-a}\right)}{a}-1$$

Note that we can also use $W_{-1}$, the other branch of the $W$ function, giving two possible answers.

0
On

Usually these are solved by Newton type methods, i.e.

$$f(x) = ln(1+x) - ax - b$$ $$f'(x) = \frac{1}{1+x} - a$$

Start with an initial guess $x_0$, then iterate as follows:

$$x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)} = x_n - \frac{ln(1+x_n) - ax_n - b}{\frac{1}{1+x_n} - a}$$

0
On

El Bazzi gives one approximation technique. There is a similar one called "Secant Line Method" which avoids calculus. Using the same function $f(x)$ you pick two values of $x_1$, $x_2$ which are (roughly) close to the solution. Plug them into the function to get two points. Find the equation of the line through those two points. Let $x_3$ be the $x$-intercept of that line. $x_3$ should be a closer approximation to the solution. Then repeat using the two points $x_2$ and $x_3$ to get $x_4$. The sequence $x_1, x_2, x_3, \ldots$ should converge to the solution. (But the method is not always stable. Unlucky choices of $x_1$ and $x_2$ may give a divergent sequence.)