Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Newton's Divided Difference Method
Date: Fri, 2 Mar 2012 03:45:17 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 14
Message-ID: <jipfod$g6v$1@newscl01ah.mathworks.com>
References: <jipbfo$4db$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-01-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1330659917 16607 172.30.248.46 (2 Mar 2012 03:45:17 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 2 Mar 2012 03:45:17 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:759546

"Akmal " <virtuoso_kraken@yahoo.com> wrote in message <jipbfo$4db$1@newscl01ah.mathworks.com>...
> I'm writing a code for interpolation using Newton's method. The code works but it gave me a different value. When I enter f(x) = log(x), x0=1, it gave me y=1 which is wrong. Can anyone help me?
> ......
>     if x==y
> ......
> Warning: FOR loop index is too large. Truncating to 9223372036854775807. 
- - - - - - - - -
  Why do you say that y = 1 is wrong?  That is the solution to log(y) = 0 which is apparently what you were seeking.

  You shouldn't be requiring exact equality in your loop where you write "x==y".  That is apparently what caused the warning message.  The code never achieved exact equality.  It probably eventually began bouncing back and forth between two different values and would have never stopped if it were not for the excessive size of 'u'.  You should only require that your value becomes approximately zero to within some tolerance.

  Note: This is not interpolation.  Newton's method allows you to solve an equation for an unknown value.

Roger Stafford