Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Matlab Problem!!!
Date: Wed, 3 Dec 2008 17:14:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 16
Message-ID: <gh6eoq$7fi$1@fred.mathworks.com>
References: <6200318.1228278241565.JavaMail.jakarta@nitrogen.mathforum.org> <gh59kj$hrr$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 1228324442 7666 172.30.248.37 (3 Dec 2008 17:14:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 3 Dec 2008 17:14:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:504746


"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <gh59kj$hrr$1@fred.mathworks.com>...
> Matt <mcushi2@gmail.com> wrote in message <6200318.1228278241565.JavaMail.jakarta@nitrogen.mathforum.org>...
> > ......
> > f = [@(x)x.^2, @(x)2*x];
> > newton(f, 0.2);
> > .......
> .....
>   As to the three attempts to call 'newton' in your second article, the second two tries are bound to fail since they don't return the desired derivative.  'feval' is certainly not smart enough to furnish a derivative of its own accord.
> ......

  I would also like to point out a theoretical difficulty with Newton's method that occurs with the type of function you gave as an example, Matt.  In that case the root of the equation f(x) = x^2 = 0 occurs at a point where the derivative also has a root, f'(x) = 0.  When this happens there is danger of the ratio f(x(n))/f'(x(n)) becoming indeterminate, which is to say, capable of serious computational errors in obtaining x(n+1) from x(n).

  For example if you had used f(x) = x^2-2*pi+pi^2, with a root at x = pi, where its derivative also has a root, you would not be able to find that root to better than about eight-place accuracy using Newton's method, in spite of Matlab's general sixteen-place accuracy.

Roger Stafford