Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: Solving an equation with no close analytical solution Date: Sun, 21 Dec 2008 05:09:02 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 19 Message-ID: <gikj1e$4cv$1@fred.mathworks.com> References: <gifvtb$6tp$1@fred.mathworks.com> <gihaei$pim$1@fred.mathworks.com> <giihj1$ije$1@fred.mathworks.com> <gikasr$a4q$1@fred.mathworks.com> Reply-To: <HIDDEN> NNTP-Posting-Host: webapp-02-blr.mathworks.com Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1229836142 4511 172.30.248.37 (21 Dec 2008 05:09:02 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Sun, 21 Dec 2008 05:09:02 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 1187260 Xref: news.mathworks.com comp.soft-sys.matlab:508169 "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <gikasr$a4q$1@fred.mathworks.com>... > ........ > As I mentioned earlier, to get around this you will have to use Pascal Getreuer's second input argument which is called 'b' to force 'lambertw' onto another branch. I do not know what value of 'b' this will require, but I suspect it is b = 1 and if not that then b = -1. > ........ I just tried out 'lambertw'. For your stuff you need to set the "branch" input equal to -1 in order to stay off the principal branch. Its output may have a very tiny imaginary part due to round off error and you can take its real part to get rid of that: w = real(lambertw(-1,z)); where z is all the stuff that should go inside the Lambert W function. However, you should always check that your results satisfy the original equation. It is possible to have 'a' set so large that for the given 'b' and 'c' values there are no real-valued solutions except the one at x = b. As I mentioned earlier, you can use a vector form of z for your 5000 points and avoid for-loops altogether. Roger Stafford