PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_roots_lambertw_real (c05ba)
Purpose
nag_roots_lambertw_real (c05ba) returns the real values of Lambert's function .
Syntax
Description
nag_roots_lambertw_real (c05ba) calculates an approximate value for the real branches of 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.
nag_roots_lambertw_real (c05ba) restricts
and its argument
to be real, resulting in a function defined for
and which is double valued on the interval
. This double-valued function is split into two real-valued branches according to the sign of
. We denote by
the branch satisfying
for all real
, and by
the branch satisfying
for all real
. You may select your branch of interest using the argument
branch.
The precise method used to approximate
is described fully in
Barry et al. (1995). For
close to
greater accuracy comes from evaluating
rather than
: by setting
on entry you inform
nag_roots_lambertw_real (c05ba) that you are providing
, not
, in
x.
References
Barry D J, Culligan–Hensley P J, and Barry S J (1995) Real values of the -function ACM Trans. Math. Software 21(2) 161–171
Parameters
Compulsory Input Parameters
- 1:
– double scalar
-
If
,
x is the offset
from
of the intended argument to
; that is,
is computed, where
.
If
,
x is the argument
of the function; that is,
is computed, where
.
Constraints:
- if , ;
- if , .
- 2:
– int64int32nag_int scalar
-
The real branch required.
- The branch is selected.
- The branch is selected.
Constraint:
or .
- 3:
– logical scalar
-
Controls whether or not
x is being specified as an offset from
.
Optional Input Parameters
None.
Output Parameters
- 1:
– double scalar
The result of the function.
- 2:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Note: nag_roots_lambertw_real (c05ba) 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.
-
-
Constraint: or .
Constraint: if and then .
Constraint: if and then .
Constraint: if then .
Constraint: if then .
- W
-
For the given offset , is negligibly different from .
is close to .
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
For a high percentage of legal
on input,
nag_roots_lambertw_real (c05ba) 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 implementations and for a small proportion of such
. This depends on the accuracy of the base-
logarithm on your system.
Further Comments
None.
Example
This example reads from a file the values 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.
Open in the MATLAB editor:
c05ba_example
function c05ba_example
fprintf('c05ba example results\n\n');
branch = int64(0);
offset = false;
x = [0.5, 1.0, 4.5, 6.0, 7.0e7];
w = zeros(length(x),1);
ifails = zeros(length(x),1);
for i = 1:length(x)
[w(i), ifails(i)] = c05ba(x(i), branch, offset);
end
fprintf('\nBranch = %d\n', branch);
if offset
fprintf('Offset = true\n\n');
else
fprintf('Offset = false\n\n');
end
fprintf(' x w(x) ifail\n');
for i=1:5
fprintf('%13.5e %13.5e %d\n', x(i), w(i), ifails(i));
end
c05ba example results
Branch = 0
Offset = false
x w(x) ifail
5.00000e-01 3.51734e-01 0
1.00000e+00 5.67143e-01 0
4.50000e+00 1.26724e+00 0
6.00000e+00 1.43240e+00 0
7.00000e+07 1.53339e+01 0
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015