Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to approximate


with (a) simple function(s)?

given $a=-1/\lambda_0$, $b=(\mu_0+\lambda_0)/\lambda_0$, $c=1/\lambda_1$, $d=(\mu_1+\lambda_1-1)/\lambda_1$ for positive $\mu_0,\lambda_0,\mu_1,\lambda_1$

where $W$ is a Lambert $W$ function, i.e., if $y=xe^x$ then $x=W(y)$

My problem is that I can not invert the function and get $x=f(y)$ alone and decided to go for some nice approximations.

Thanks alot for any help.

share|cite|improve this question
up vote 1 down vote accepted

You could try to estimate $W(x)$ by using Newton-Raphson iteration, because $W(c)$ is the root of $x\exp(x)-c$:

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

and as $n$ is sufficiently large, we can get approximations for $W$ using only elementary functions.

Using this method, we can find $W(1)=\Omega = 0.567143\cdots$, starting with $x_0=1$ and keeping 6 places precision:

Iteration       Value         Error
1               0.683939      0.116795
2               0.577454      0.010310
3               0.56723       0.000086
4               0.567143      0.000000
share|cite|improve this answer
Thank you very much for your answer. I am not sure if I can use it in my problem. Because I have a probability density function $g(a,b,c,d,x)$, where $a,b,c,d$ are some constants and $x$ is a variable and the density makes sense if I have it in the following form $g(a,b,c,d,y)$. Only after this I can determine $a,b,c,d$ constants to get the density via $\int g(a,b,c,d,y)=1$ – Seyhmus Güngören Sep 30 '12 at 16:21
@SeyhmusGüngören Is this being done numerically? – Argon Sep 30 '12 at 16:26
If I can get the densities probably I will try)). Please have a look at… I reduced that problem to the current problem. Assuming that I found $x$ as a function of $y$, then I will get some densities. These densities will be integrated to add up to one. The region where to integrate is also dependent on $\mu_0,\mu_1,\lambda_0,\lambda_1$. In this way I will have $2$ nonlinear equations to solve. If I have the densities, then I have 2 other nonlinear equations as well. – Seyhmus Güngören Sep 30 '12 at 16:33
As a result finally I will have $4$ strange looking nonlinear equations with $4$ unknowns. Then I will think if I can solve them efficiently. At the moment, since I can not get $x$ as a function of $y$, I cannot get the densities as well. As a result I cannot get 4 nonlinear equations too. I can still run a brute search without having $x=f(y)$ but it is academically a bit weird to say, I am trying)) – Seyhmus Güngören Sep 30 '12 at 16:36

You need to specify better the sense of the approximation, and the range of values. For example:

>>> a= -5; b= 2 ; c= 8; d=3;
>>> x=[1:20-0.5]/20;
>>> plot(x,lambertw(e.^[c*x+d])./lambertw(e.^[a*x+b]))

does not look almost linear to me.

enter image description here

Perhaps you want $b \gg |a|$, $d \gg c$ or something like that

share|cite|improve this answer
I figured out that logarithm of $y$ seems almost linear. Perhaps I need to model the log of the function in a linear way? – Seyhmus Güngören Sep 30 '12 at 14:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.