hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_roots_lambertw_complex (c05bb)

Purpose

nag_roots_lambertw_complex (c05bb) computes the values of Lambert's WW function W(z)W(z).

Syntax

[w, resid, ifail] = c05bb(branch, offset, z)
[w, resid, ifail] = nag_roots_lambertw_complex(branch, offset, z)

Description

nag_roots_lambertw_complex (c05bb) calculates an approximate value for Lambert's WW function (sometimes known as the ‘product log’ or ‘Omega’ function), which is the inverse function of
f(w) = wew   for   wC .
f(w) = wew   for   wC .
The function ff is many-to-one, and so, except at 00, WW is multivalued. nag_roots_lambertw_complex (c05bb) allows you to specify the branch of WW on which you would like the results to lie by using the parameter branch. Our choice of branch cuts is as in Corless et al. (1996), and the ranges of the branches of WW are summarised in Figure 1.
Ranges of the branches of Wz
Figure 1: Ranges of the branches of W(z)W(z)
For more information about the closure of each branch, which is not displayed in Figure 1, see Corless et al. (1996). The dotted lines in the Figure denote the asymptotic boundaries of the branches, at multiples of ππ.
The precise method used to approximate WW is as described in Corless et al. (1996). For zz close to exp(1)-exp(-1) greater accuracy comes from evaluating W(exp(1) + Δz)W(-exp(-1)+Δz) rather than W(z)W(z): by setting on entry you inform nag_roots_lambertw_complex (c05bb) that you are providing ΔzΔz, not zz, in z.

References

Corless R M, Gonnet G H, Hare D E G, Jeffrey D J and Knuth D E (1996) On the Lambert WW function Advances in Comp. Math. 3 329–359

Parameters

Compulsory Input Parameters

1:     branch – int64int32nag_int scalar
The branch required.
2:     offset – logical scalar
Controls whether or not z is being specified as an offset from exp(1)-exp(-1).
3:     z – complex scalar
If , z is the offset ΔzΔz from exp(1)-exp(-1) of the intended argument to WW; that is, W(β)W(β) is computed, where β = exp(1) + Δzβ=-exp(-1)+Δz.
If , z is the argument zz of the function; that is, W(β)W(β) is computed, where β = zβ=z.

Optional Input Parameters

None.

Input Parameters Omitted from the MATLAB Interface

None.

Output Parameters

1:     w – complex scalar
The value W(β)W(β): see also the description of z.
2:     resid – double scalar
The residual |W(β)exp(W(β))β||W(β)exp(W(β))-β|: see also the description of z.
3:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Note: nag_roots_lambertw_complex (c05bb) may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the function:

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

W ifail = 1ifail=1
For the given offset zz, WW is negligibly different from 1-1.
zz is close to exp(1)-exp(-1).
W ifail = 2ifail=2
The iterative procedure used internally did not converge in __ iterations. Check the value of resid for the accuracy of w.

Accuracy

For a high percentage of zz, nag_roots_lambertw_complex (c05bb) is accurate to the number of decimal digits of precision on the host machine (see nag_machine_decimal_digits (x02be)). An extra digit may be lost on some platforms and for a small proportion of zz. This depends on the accuracy of the base-1010 logarithm on your system.

Further Comments

The following figures show the principal branch of WW.
realW0z
Figure 2: real(W0(z))real(W0(z))
W0z
Figure 3: Im(W0(z))Im(W0(z))
W0z
Figure 4: abs(W0(z))abs(W0(z))

Example

function nag_roots_lambertw_complex_example
branch = int64(0);
offset = false;
z = [0.5-i; 1+2.3*i; 4.5-0.1*i; 6+6*i];
fprintf('\nBranch = %d\n', branch);
if offset
  fprintf('Offset = true\n');
else
  fprintf('Offset = false\n');
end
fprintf('\n               z            w           resid    ifail\n');
for j =1:4
  [w, resid, ifail] = nag_roots_lambertw_complex(branch, offset, z(j)) ;
  fprintf('%18s %18s %10s %3d\n', num2str(z(j)), num2str(w), num2str(resid), ifail);
end
 

Branch = 0
Offset = false

               z            w           resid    ifail
            0.5-1i   0.51651-0.42205i 5.5511e-17   0
            1+2.3i   0.87361+0.57698i 1.1102e-16   0
          4.5-0.1i   1.2673-0.012419i          0   0
              6+6i    1.6149+0.49051i 1.2561e-15   0

function c05bb_example
branch = int64(0);
offset = false;
z = [0.5-i; 1+2.3*i; 4.5-0.1*i; 6+6*i];
fprintf('\nBranch = %d\n', branch);
if offset
  fprintf('Offset = true\n');
else
  fprintf('Offset = false\n');
end
fprintf('\n               z            w           resid    ifail\n');
for j =1:4
  [w, resid, ifail] = c05bb(branch, offset, z(j)) ;
  fprintf('%18s %18s %10s %3d\n', num2str(z(j)), num2str(w), num2str(resid), ifail);
end
 

Branch = 0
Offset = false

               z            w           resid    ifail
            0.5-1i   0.51651-0.42205i 5.5511e-17   0
            1+2.3i   0.87361+0.57698i 1.1102e-16   0
          4.5-0.1i   1.2673-0.012419i          0   0
              6+6i    1.6149+0.49051i 1.2561e-15   0


PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013