Estimate intersection of exponential and linear function

81 Views Asked by At

I would like to solve a function of the form $a^x = bx + c$ for $x$, but I read it can not be solved algebraically (transcendental equation).

My attempts basically fall flat at $\log_a(a^x - bx) = \log_a(c)$ as there is no way to simplify $\log_a(a^x - bx)$.

Although I did read that $$\log(s + t) = \log(s) + \log\left(1 + \frac{t}{s}\right) \approx \log(\max(s, t))$$

So I can simplify $x \approx \log_a(a^x - bx) = \log_a(c)$, if $a^x \gg -bx$.

I tested this numerically and the results seem plausible, but I am unsure how to test if $a^x + bx$ is really large enough for the approximation to be accurate. How would I go about calculating the error to keep it below, say 1%?

2

There are 2 best solutions below

3
On BEST ANSWER

We can use Newton's method to compute the root of $f(x) = a^x - bx - c$. Newton's method is the following algorithm:

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

Where an initial estimate $x_0$ of the root is repeatedly improved. Substituting the relation for $f(x)$:

$$ x_{n + 1} = x_n - \frac{a^{x_n} - bx_n - c}{a^{x_n} \ln a - b} $$

We repeatedly apply the above to get better and better estimates for the root.

0
On

The only explicit solution of $$a^x=bx+c \quad \implies \quad e^{x\log(a)}=bx+c $$ is given in terms of Lambert function.

It write $$x=-\frac c b-\frac 1 {\log(a)}W\left(-\frac{\log (a)}{b}\, a^{-\frac{c}{b}}\right)$$ which, in the real domain, exists if $$\frac{\log (a)}{b}\, a^{-\frac{c}{b}}~ \leq ~ \frac 1 e$$

You must take care that this is a multi-valued function (the branches being $W_0(.)$ and $W_{-1}(.)$. For example, with $(a=3,b=5,c=7)$, the solutions are close to $-1.35$ and $2.76$.

You will find in the linked page series expansion for the evaluation of this function which is more and more used.

Just by curiosity, on the search bar of the site, just type Lambert : you will see $4318$ entries.