NAG FL Interface
c05bbf (lambertw_complex)
1
Purpose
c05bbf computes the values of Lambert's function .
2
Specification
Fortran Interface
Integer, Intent (In) |
:: |
branch |
Integer, Intent (Inout) |
:: |
ifail |
Real (Kind=nag_wp), Intent (Out) |
:: |
resid |
Complex (Kind=nag_wp), Intent (In) |
:: |
z |
Complex (Kind=nag_wp), Intent (Out) |
:: |
w |
Logical, Intent (In) |
:: |
offset |
|
C Header Interface
#include <nag.h>
void |
c05bbf_ (const Integer *branch, const logical *offset, const Complex *z, Complex *w, double *resid, Integer *ifail) |
|
C++ Header Interface
#include <nag.h> extern "C" {
void |
c05bbf_ (const Integer &branch, const logical &offset, const Complex &z, Complex &w, double &resid, Integer &ifail) |
}
|
The routine may be called by the names c05bbf or nagf_roots_lambertw_complex.
3
Description
c05bbf calculates an approximate value for Lambert's
function (sometimes known as the ‘product log’ or ‘Omega’ function), which is the inverse function of
The function
is many-to-one, and so, except at
,
is multivalued.
c05bbf allows you to specify the branch of
on which you would like the results to lie by using the argument
branch. Our choice of branch cuts is as in
Corless et al. (1996), and the ranges of the branches of
are summarised in
Figure 1.
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
is as described in
Corless et al. (1996). For
close to
greater accuracy comes from evaluating
rather than
: by setting
on entry you inform
c05bbf that you are providing
, not
, in
z.
4
References
Corless R M, Gonnet G H, Hare D E G, Jeffrey D J and Knuth D
E (1996) On the Lambert function Advances in Comp. Math. 3 329–359
5
Arguments
-
1:
– Integer
Input
-
On entry: the branch required.
-
2:
– Logical
Input
-
On entry: controls whether or not
z is being specified as an offset from
.
-
3:
– Complex (Kind=nag_wp)
Input
-
On entry: if
,
z is the offset
from
of the intended argument to
; that is,
is computed, where
.
If
,
z is the argument
of the function; that is,
is computed, where
.
-
4:
– Complex (Kind=nag_wp)
Output
-
On exit: the value
: see also the description of
z.
-
5:
– Real (Kind=nag_wp)
Output
-
On exit: the residual
: see also the description of
z.
-
6:
– Integer
Input/Output
-
On entry:
ifail must be set to
,
or
to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value
or
is recommended. If message printing is undesirable, then the value
is recommended. Otherwise, the value
is recommended since useful values can be provided in some output arguments even when
on exit.
When the value or is used it is essential to test the value of ifail on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6
Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
Errors or warnings detected by the routine:
Note: in some cases c05bbf may return useful information.
-
For the given offset , is negligibly different from : and .
is close to . Enter as an offset to for greater accuracy: and .
-
The iterative procedure used internally did not converge in
iterations. Check the value of
resid for the accuracy of
w.
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See
Section 9 in the Introduction to the NAG Library FL Interface for further information.
7
Accuracy
For a high percentage of
,
c05bbf is accurate to the number of decimal digits of precision on the host machine (see
x02bef). An extra digit may be lost on some platforms and for a small proportion of
. This depends on the accuracy of the base-
logarithm on your system.
8
Parallelism and Performance
c05bbf is not threaded in any implementation.
The following figures show the principal branch of
.
10
Example
This example reads from a file the value of the required branch, whether or not the arguments to are to be considered as offsets to , and the arguments themselves. It then evaluates the function for these sets of input data and prints the results.
10.1
Program Text
10.2
Program Data
10.3
Program Results