% error: lambertw(z) or 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. % % If either n or z are non-scalar, the function is mapped to each % element; both may be non-scalar provided their dimensions agree. % % 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 <email@example.com>. % % For further details, see: % % Corless, Gonnet, Hare, Jeffrey, and Knuth (1996), 'On the Lambert % W Function', Advances in Computational Mathematics 5(4):329-359.