in my project i have faced with a formula that I can't solve it. a very simplified and basic version of that equation can be rewritten as $ax + e^x = k$. please help me to solve this elementary calculus equation.
-
4It's not that elementary. – Raskolnikov Jun 11 '13 at 05:56
-
Your problem is a special case of the more general problem. – Mhenni Benghorbal Jun 12 '13 at 23:57
5 Answers
Let $f(x) = ax+e^x-k$, and solve $f(x) = 0$.
Newton's method would be a reasonable first start.
The update for $x$ would be $x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)} = \frac{(x_n-1)e^{x_n}+k}{e^{x_n}+a}$.

- 172,524
-
-
3I'm not sure what you mean. Simpson's rule is for quadrature, Newton's method is for root finding? – copper.hat Jun 11 '13 at 06:30
-
Hint :
1.let $\large{f(x)=\frac{k-e^x}{a}}$ by numerical method find fix point of $f$
2. or let $\large{g(x)=ax + e^x - k}$ by numerical method find roots of $g$

- 11,498
- 3
- 30
- 66
myfunc=@(a,x,k) a*x+exp(x)-k;
>> a=1;
>> k=3;
>> fun=@(x) myfunc(a,x,k);
>> x=fzero(fun,0.1,k)
x =
0.7921
for different value of a and k ,you get different root.or you can use Lambert W function.thanks i hope it will help you
you dont need to use extra parameter $k$,simply do like this
x=fzero(fun,0.1)
x =
0.7921

- 9,194
Your equation can be solved with the Lambert $W$ function or the simpler single-valued Wright $\omega$ function:
$$x = \frac{k}{a} - W_0(e^{k/a}/a) = \frac{k}{a} - \omega(k/a-\ln a)$$
for $x, a, k \in \mathbb{Z}$ and where $W_0$ is the upper (principal) branch of the Lambert $W$ function. As @Raskolnikov suggests, these are still not "elementary," though there will be exact solutions for particular combinations of $a$ and $k$ (e.g., $x = 0$ for $a = k = 1$). See my answer to this recent question for some suggestions on computing numeric solutions. The 2012 paper by Lawrence, Corless, and Jeffrey is recommended reading if you end up needing to implement a method to evaluate the Wright $\omega$ function in part or all of the complex plane.
Let $x=\log(u)$ then $$ ax+e^x=k\mapsto a\log(u)+u=k $$ divide by $a$, exponentiate, divide by $a$ again: $$ (u/a)e^{u/a}=\frac1ae^{k/a} $$ The Lambert-W function is the inverse of $x\mapsto xe^x$, so we get $$ \begin{align} u/a&=\mathrm{W}\left(\frac1ae^{k/a}\right)\\ u&=a\mathrm{W}\left(\frac1ae^{k/a}\right)\\ x&=\log\left(a\mathrm{W}\left(\frac1ae^{k/a}\right)\right)\\ &=\frac ka-\mathrm{W}\left(\frac1ae^{k/a}\right) \end{align} $$ The last formula follows from $u=e^x$ and $ax+u=k$
Numerical Iteration for Lambert W
Using Newton's method, we get the iteration $$ w_{\text{new}}=\frac{xe^{-w}+w^2}{w+1} $$ Initial Values
For the principal branch when $-1/e\le x\lt0$ and when $0\le x\le10$, use $w=0$. When $x\gt10$, use $w=\log(x)-\log(\log(x))$.
For the non-principal brance, if $x\in[-1/e,-0.1]$, use $w=-2$; and if $x\in(-0.1,0)$, use $w=\log(-x)-\log(-\log(-x))$.

- 345,667
-
Please remember that $\log a \neq \ln a$, so always remember to add proper bases to the log function. You must have seen in physics textbooks where the base $e$ is omitted, but in mathematical textbooks (non calculus ones) always have mentioned that if no base is there, then 10 is assumed in such cases. – Apr 25 '19 at 06:28
-
Please remember that this is a math site, so all logarithms are natural unless otherwise specified. Actually, pure math and engineering differ in the assumption about $\log(x)$: see this post. – robjohn Apr 25 '19 at 09:28
-
In mathematics if no base is mentioned, then it is taken with base 10, I can show you papers regarding that! – Apr 25 '19 at 11:56
-
Anyone is free to use whatever convention they want. In pure mathematics, natural logs are used far more often, and so $\log(x)$ is usually assumed to be base $e$. In engineering, the base may be more often assumed to be ten. – robjohn Apr 25 '19 at 13:28