Re: how to differentiate a list?

• To: mathgroup at smc.vnet.net
• Subject: [mg26018] Re: how to differentiate a list?
• From: Mike <m.honeychurch at sci.monash.edu.au>
• Date: Thu, 16 Nov 2000 03:43:04 -0500 (EST)
• Organization: Monash Uni
• References: <8ug96o\$id9@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

Interpolation is the probably the best bet but if you want to work with
discrete values of data then a higher order approximation for the derivative
is the way to go.

What you propose below has an error of O[h]^2. (Use Series to determine the
errors in approximations.)

In my work I often want to the derivative at a surface (point 1) using this
point plus other points away from the surface.

f'(point 1) = ([[2]]-[[1]])/2 has an error of O[h]^2

but improvements can be made by using a higher order approximation. These
approximations can be derived from Taylor series using Series or Normal (if
you want to get rid of the error term).

eg.

f'(point1) =( -3[[1]]+4[[2]]-[[3]])/2  error O[h]^3

or better

f'(point1)=(-25[[1]]+48[[2]]-36[[3]]+16[[4]]-4[[5]])/12

what order you use depends on the overall error in you data i.e. there is no
point going for O[h]^3 in the derivative if the errors in your data is
greater than that (hope I'm explaining this okay!).

In your case you want the derivative at each point in your list so for a
multipoint approximation you could get this using something like
ListCorrelate[{a,b,c}, yourList]

with a,b, and c (and d, e, etc. depending on how many points you want to
use) being coefficients determined from Taylor series.

Mike

in article 8ug96o\$id9 at smc.vnet.net, Rob at piovere at pdq.net wrote on 10/11/00
5:47 PM:

> I needed to get the derivative of a time varying pulse to do some
> numerical
> operations.  As seen below, the only way I could figure how to do it
> was to generate two lists, shifted by one sample and then subtract them:
>
> ***************
> del = 0.002; a = 12\[Pi]; b = \[Pi];
> ( s[t] is a function of t defining the pulse )
>
> sd = Table[N[s[t]], {t, 0, 1, del}];
> sd1 = Table[N[s[t]], {t, del, 1 + del, del}];
> diff = sd - sd1;
> ****************
>
> I looked all over and I didn't find a list operation available to do
> this. I bet
> you Mathematica gurus know how to do this.  If so, could you enlighten me?
>
> Thanks, Rob
>
>
>

• Prev by Date: Output Intermediate Steps in Solve or Roots?
• Next by Date: Re: Bug in Limit ?
• Previous by thread: Re: how to differentiate a list?
• Next by thread: binary import