Re: ProductLog function [message #60082] |
Fri, 02 May 2008 07:46 |
Jeremy Bailin
Messages: 618 Registered: April 2008
|
Senior Member |
|
|
If you're desperate, you can always get IDL to externally call
Mathematica... or even better, if you know that you'll be calling it
with a fairly restricted range of y values, get Mathmetica to pump out
a densely sampled array of x,y pairs to a file and then interpolate
within IDL.
That said, I'd probably just go the route Paolo suggests and solve it
numerically within IDL.
-Jeremy.
On May 1, 7:32 am, emitch...@googlemail.com wrote:
> Hi all, I've used Wolfrang Mathmatica to solve an equation for x, and
> have been given a solution involving the function ProductLog. I was
> wondering if anyone knew if there was any inbuilt capacity in IDL to
> evaluate this. It's definitely different to PRODUCT(ALOG(x)), as I've
> tried this but results were wrong.
>
> I'm trying to convert a matrix of y's to x's, but the equation I need
> to use is:
>
> y = 0.0015x + a(1-exp(-bx))
>
> Mathmatica gave me (to 6sf):
>
> 0.333333(-2000.a + 2000.y +
> (3.ProductLog(666.667(a.b.exp(666.667b(1.a-1.y)))))/b
>
> I tried this in IDL, but no joy:
>
> (1D/3D)*(-2000D*a + 2000D*y + (3*(PRODUCT(ALOG((2000D/
> 3D)*a*b*exp((2000D/3D)*b*((a-1D)*(y))))))/b))
>
> Cheers,
>
> Ed
|
|
|
Re: ProductLog function [message #60102 is a reply to message #60082] |
Thu, 01 May 2008 06:36  |
Allan Whiteford
Messages: 117 Registered: June 2006
|
Senior Member |
|
|
emitchard@googlemail.com wrote:
> Hi all, I've used Wolfrang Mathmatica to solve an equation for x, and
> have been given a solution involving the function ProductLog. I was
> wondering if anyone knew if there was any inbuilt capacity in IDL to
> evaluate this. It's definitely different to PRODUCT(ALOG(x)), as I've
> tried this but results were wrong.
>
> I'm trying to convert a matrix of y's to x's, but the equation I need
> to use is:
>
> y = 0.0015x + a(1-exp(-bx))
>
> Mathmatica gave me (to 6sf):
>
> 0.333333(-2000.a + 2000.y +
> (3.ProductLog(666.667(a.b.exp(666.667b(1.a-1.y)))))/b
>
> I tried this in IDL, but no joy:
>
> (1D/3D)*(-2000D*a + 2000D*y + (3*(PRODUCT(ALOG((2000D/
> 3D)*a*b*exp((2000D/3D)*b*((a-1D)*(y))))))/b))
>
> Cheers,
>
> Ed
>
>
Ed,
I think you're looking for an implementation of the Lambert W function.
IDL doesn't have one inbuilt. You can probably find a Fortran or C
implementation and convert or use it;
http://www.netlib.org/toms/443
seems to do it.
Thanks,
Allan
|
|
|
Re: ProductLog function [message #60103 is a reply to message #60102] |
Thu, 01 May 2008 06:35  |
Vince Hradil
Messages: 574 Registered: December 1999
|
Senior Member |
|
|
On May 1, 6:32 am, emitch...@googlemail.com wrote:
> Hi all, I've used Wolfrang Mathmatica to solve an equation for x, and
> have been given a solution involving the function ProductLog. I was
> wondering if anyone knew if there was any inbuilt capacity in IDL to
> evaluate this. It's definitely different to PRODUCT(ALOG(x)), as I've
> tried this but results were wrong.
>
> I'm trying to convert a matrix of y's to x's, but the equation I need
> to use is:
>
> y = 0.0015x + a(1-exp(-bx))
>
> Mathmatica gave me (to 6sf):
>
> 0.333333(-2000.a + 2000.y +
> (3.ProductLog(666.667(a.b.exp(666.667b(1.a-1.y)))))/b
>
> I tried this in IDL, but no joy:
>
> (1D/3D)*(-2000D*a + 2000D*y + (3*(PRODUCT(ALOG((2000D/
> 3D)*a*b*exp((2000D/3D)*b*((a-1D)*(y))))))/b))
>
> Cheers,
>
> Ed
A quick search of the 'net yielded: http://en.wikipedia.org/wiki/Lambert%27s_W_function
Unfortunately, a quick search of IDL help yielded only Lambert wrt map
projections. However, the wiki page above has an evaluation
algorithm.
BTW - I used Maxima to get:
- b x b x
%e (%e (a - y) - a)
[x = - ---------------------------]
c
Which you could solver iteratively...
Good luck!
|
|
|
Re: ProductLog function [message #60105 is a reply to message #60103] |
Thu, 01 May 2008 06:26  |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
You could try to use a numerical solver like fx_root in IDL.
Ciao,
Paolo
emitch...@googlemail.com wrote:
> Hi all, I've used Wolfrang Mathmatica to solve an equation for x, and
> have been given a solution involving the function ProductLog. I was
> wondering if anyone knew if there was any inbuilt capacity in IDL to
> evaluate this. It's definitely different to PRODUCT(ALOG(x)), as I've
> tried this but results were wrong.
>
> I'm trying to convert a matrix of y's to x's, but the equation I need
> to use is:
>
> y = 0.0015x + a(1-exp(-bx))
>
> Mathmatica gave me (to 6sf):
>
> 0.333333(-2000.a + 2000.y +
> (3.ProductLog(666.667(a.b.exp(666.667b(1.a-1.y)))))/b
>
> I tried this in IDL, but no joy:
>
> (1D/3D)*(-2000D*a + 2000D*y + (3*(PRODUCT(ALOG((2000D/
> 3D)*a*b*exp((2000D/3D)*b*((a-1D)*(y))))))/b))
>
> Cheers,
>
> Ed
|
|
|