From: TideMan <>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Problem
Date: Thu, 6 May 2010 01:24:21 -0700 (PDT)
Lines: 33
Message-ID: <>
References: <hrqe77$jcs$> <> 
	<hrt7e0$drs$> <hrttqi$ftj$>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: 1273134261 30678 (6 May 2010 08:24:21 GMT)
NNTP-Posting-Date: Thu, 6 May 2010 08:24:21 +0000 (UTC)
Injection-Info:; posting-host=; 
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: 
	Gecko/20100401 Firefox/3.6.3,gzip(gfe)
Xref: comp.soft-sys.matlab:633056

On May 6, 8:15 pm, "Roger Stafford"
<> wrote:
> "Roger Stafford" <> wrote in message <hrt7e0$>...
> >   Prepare yourself for a long-winded explanation. .......
> - - - - - - - - -
>   Please add this onto the previous discussion I gave.
>   If y = f(x) is some continuous function with its first three derivatives also continuous over the interval xa < xb < xc, then by an extension of the famous Rolle's theorem of elementary calculus, there is a value xi (Greek letter) such that the difference between the expression above for an approximation of the derivative at xb and the actual derivative, f'(xb) is equal to
>   1/6*f'''(xi)*(xc-xb)*(xb-xa)
> where xi lies in xa < xi < xc and f'''(xi) is the third derivative value of f(x) there.  A remarkable fact!
>   What this signifies is that if the function whose derivative you are attempting to approximate with the formula I gave you has a third derivative which remains very small - in other words is reasonably smooth - then you are guaranteed a close approximation.
> Roger Stafford

But Roger, doesn't your fancy algorithm reduce to central finite
differences if the x are equispaced:
dydx(2:end-1)=(y(3:end) - y(1:end-2))/(2*dx);
without the pretty stuff at the ends of course.