Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: NaN with root finding method
Date: Tue, 4 Dec 2012 04:45:08 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 9
Message-ID: <k9jv4k$9u6$1@newscl01ah.mathworks.com>
References: <k9jti1$4r9$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1354596308 10182 172.30.248.37 (4 Dec 2012 04:45:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 4 Dec 2012 04:45:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:784110

"Matthew Brenneman" <mtbrenneman@gmail.com> wrote in message <k9jti1$4r9$1@newscl01ah.mathworks.com>...
> My results agree with theirs for the first couple of iterations, but then when I get very close to the root, I get "NaN" for my output (and they don't: they give results for numbers as low as 10^(-600)).
> I know using difference quotients and the like, when you're close to a root, you're basically dividing a number very close to zero by another number very close to zero, .....
- - - - - - - - - - -
  With matlab double precision, the very smallest positive number that can be represented is 2^(-1074) or around 10^(-323), which is far, far above your 10^(-600).  These latter would of necessity be rounded to exact zeros, which would explain your NaNs - you would be dividing zero by zero as far as the computer is concerned and it frowns on that.

  I'm afraid you will have to modify the method you are using to be able to use double precision in your calculations - either that or make use of the Symbolic Toolbox which uses arbitrarily large numbers of digits (at the expense of slower computation, of course.)

Roger Stafford