Skip to content
Prev 229087 / 398500 Next

Optimization problem with nonlinear constraint

Very nice, Hans!  I didn't know of the existence of Lambert W function
(a.k.a Omega function) before.  I didn't know that it occurs in the solution
of exponential decay with delay: dy/dy = a * y(t - 1).  Apparently it is
more than 250 years old!

Thanks,
Ravi.

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Hans W Borchers
Sent: Wednesday, July 28, 2010 11:11 AM
To: r-help at stat.math.ethz.ch
Subject: Re: [R] Optimization problem with nonlinear constraint

Uli Kleinwechter <u.kleinwechter <at> uni-hohenheim.de> writes:
I don't think optimization is the right approach for simply inverting
a simple function.

The inverse of the function  x \to x * e^x  is the Lambert W function.
So the solution in your case is:

    W(log(T)*y*T) / log(T)  # hope I transformed it correctly.

Now, how to compute Lambert's W ? Well, look into the 'gsl' package
and, alas, there is the function lambert_W0.

Your example:
----
    y <-   3
    T <- 123

    library(gsl)
    lambert_W0(log(T)*y*T)/log(T)
    # [1] 1.191830
----

Regards,  Hans Werner
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.