Function: lambertw (z)
Function: lambertw (n, z)

Compute the Lambert W function of z.

This function satisfies W(z).*exp(W(z)) = z, and can thus be used to express solutions of transcendental equations involving exponentials or logarithms.

n must be integer, and specifies the branch of W to be computed; W(z) is a shorthand for W(0,z), the principal branch. Branches 0 and -1 are the only ones that can take on non-complex values.

For example, the principal branch passes through the point (0, 0):

lambertw (0)
  ⇒ ans = 0

And the 0 and -1 branches coincide for the following real value:

x = -1/exp (1);
lambertw (x)
  ⇒ ans = -1
lambertw (-1, x)
  ⇒ ans = -1

If either n or z are non-scalar, the function is mapped to each element; both may be non-scalar provided their dimensions agree. For example, we can repeat the above calculation as:

lambertw ([0 -1], x)
  ⇒ ans =
      -1  -1

This implementation should return values within 2.5*eps of its counterpart in Maple V, release 3 or later. Please report any discrepancies to the author, Nici Schraudolph <schraudo@inf.ethz.ch>.

For further algorithmic details, see:

Corless, Gonnet, Hare, Jeffrey, and Knuth (1996), ‘On the Lambert W Function’, Advances in Computational Mathematics 5(4):329-359.

See also: @sym/lambertw.

Package: symbolic