Real Values of the Lambert W Function
The Lambert package contains a function (wapr) for calculating real values of the Lambert W function, as well as a test module for testing wapr against high precision results.
Note: The Symbolic Math Toolbox already contains Maple's implementation of the W function. The Maple version accepts complex arguments, and gives results for complex branches of W.
Syntax:
[w,nerror] = wapr(x,nb,l,m);
where
w = output, W(x);
nerror = error flag, 0 (no errors), or 1 (error);
x = argument of W;
nb = branch (0 for upper branch - default, anything else for the lower branch);
l ~= 1, argument x is actual value for which W is desired (default); = 1, argument x is positive offset from -exp(-1);
m = 1, print error/information messages, ~= 1, don't print anything (default).
Cite As
D. A. Barry (2026). Real Values of the Lambert W Function (https://www.mathworks.com/matlabcentral/fileexchange/3644-real-values-of-the-lambert-w-function), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
