ランベルト関数

 投稿者:GAI  投稿日:2012年 8月27日(月)11時57分28秒
  y=x*e^xの逆関数をランベルトの関数W(x)と言うらしく
ただこれを初等関数であらわすことはできず、これを使う為には漸化式等を用いて入手するらしい。
この関数はいろいろと使い道がとれそうで便利と感じる。

以下サイトを参考に調べてみました。


There have been quite a few posts recently regarding problems whose
solutions involve the Lambert W-function.  I have an iterative algorithm
that I use for computing this function that converges fairly quickly.
First, let's look at the inverse of W(x), w e^w.

Analysis of x e^x
-----------------
For w > 0, w e^w increases monotonically from 0 to infinity.  When w is
negative, w e^w is negative.  Thus, for x > 0, W(x) is positive and well
defined and increases monotonically.

For w < 0, w e^w reaches a minimum of -1/e at -1.  On (-1,0), w e^w
increases monotonically from -1/e to 0.  On (-oo,-1), w e^w decreases
monotonically from 0 to -1/e.  Thus, on (-1/e,0), W(x) can have one of
two values, one in (-1,0) and another in (-oo,-1).  The value in (-1,0)
is called the principal value.
(ここまではグラフ等を書いて理解しました。)


The iteration
-------------
Using Newton's method for solving w e^w yields the following iterative
step for finding W(x):

           x e^-w + w^2
    w    = ------------                                              [1]
     new       w + 1

Initial values of w
-------------------
For the principal value when -1/e <= x < 0 and when 0 <= x <= 10, use
w = 0.  When x > 10, use w = log(x) - log(log(x)).

For the non-principal value, if x is in [-1/e,-.1], use w = -2; and
if x is in (-.1,0), use w = log(-x) - log(-log(-x)).

Another iteration
-----------------
When x is near -1/e, [1] converges a little slowly.  I use a parabolic
iteration method in those cases.

                              x + 1/e
    w    = -1 + (w+1) sqrt( ----------- )                            [2]
     new                    w e^w + 1/e

Using an initial w of 0 for the principal value, and w = -2 for the
non-principal value.


この説明文でNewton's method とかparabolic iteration method の意味や
プログラムの組み方がチンプンカンです。

このW関数を使えるようにプログラムを構成して頂けないでしょうか?

 

Re: ランベルト関数

 投稿者:山中和義  投稿日:2012年 8月27日(月)21時51分23秒
  > No.1962[元記事へ]

GAIさんへのお返事です。

> Using Newton's method for solving w e^w yields the following iterative
> step for finding W(x):
>
>            x e^-w + w^2
>     w    = ------------                                              [1]
>      new       w + 1
>
> Initial values of w
> -------------------
> For the principal value when -1/e <= x < 0 and when 0 <= x <= 10, use
> w = 0.  When x > 10, use w = log(x) - log(log(x)).
>
> For the non-principal value, if x is in [-1/e,-.1], use w = -2; and
> if x is in (-.1,0), use w = log(-x) - log(-log(-x)).


LET x=-LOG(2)/3

!!!IF x>=-1/EXP(1) AND x<0 THEN LET W=0 !主値
IF x>=-1/EXP(1) AND x<=-0.1 THEN LET W=-2 ![-1/e, -0.1]
IF x>-0.1 AND x<0 THEN LET W=-LOG(-x)-LOG(-LOG(-x)) !(-0.1, 0)

IF x>=0 AND x<=10 THEN LET W=0
IF x>10 THEN LET W=LOG(x)-LOG(LOG(x))

FOR N=1 TO 10
   LET W=(x*EXP(-W)+W^2)/(W+1)
NEXT N
PRINT W

END



> When x is near -1/e, [1] converges a little slowly.  I use a parabolic
> iteration method in those cases.
>
>                               x + 1/e
>     w    = -1 + (w+1) sqrt( ----------- )                            [2]
>      new                    w e^w + 1/e
>
> Using an initial w of 0 for the principal value, and w = -2 for the
> non-principal value.


!!OPTION ARITHMETIC COMPLEX !複素数モード
!!LET i=SQR(-1) !虚数単位

LET x=-LOG(2)/3
LET W=0 !主値
!!!LET W=-2
FOR N=1 TO 80
   LET W=-1+(W+1)*SQR((x+1/EXP(1))/(W*EXP(W)+1/EXP(1)))
NEXT N
PRINT W

END
 

戻る