# How to approximate $y=\frac{W(e^{cx+d})}{W(e^{ax+b})}$?

How to approximate

$$y=\frac{W(e^{cx+d})}{W(e^{ax+b})}$$

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.

-

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

-
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 math.stackexchange.com/questions/203931/… 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.

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

-
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