Re: Re: Finding derivatives of a list?
- To: mathgroup at smc.vnet.net
- Subject: [mg40888] Re: [mg40854] Re: [mg40816] Finding derivatives of a list?
- From: Selwyn Hollis <selwynh at earthlink.net>
- Date: Wed, 23 Apr 2003 01:17:33 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
I feel compelled to point out that using interpolation for this purpose is, in general, a Bad Idea. Please have a look at the following, which uses an example attributed to Runge. The Do loop plots the difference between f''[x] and the second derivative of the InterpolatingFunction based on 21 nodes -1, -.9, ..., .9, 1, for InterpolationOrders 3 through 20. You'll notice that the difference is quite large in all cases. runge[x_] := 1/(1 + 20 x^2); Plot[runge[x], {x, -1, 1}, Frame->True, PlotLabel->"Runge's example"]; pts = Table[{x, runge[x]}, {x, -1., 1, 0.1}]; Do[ interp = Interpolation[pts, InterpolationOrder -> n]; Plot[Evaluate[{runge''[x] - interp''[x]}], {x, -1, 1}, PlotRange -> {-10, 10}, PlotLabel -> "InterpolationOrder --> " <> ToString[n]], {n, 3, 20}] ----- Selwyn Hollis http://www.math.armstrong.edu/faculty/hollis On Tuesday, April 22, 2003, at 06:44 AM, Daniel Lichtblau wrote: > AES/newspost wrote: >> >> Specific problem is how to generate a list of values of the second >> derivative of a relatively smooth function at a set of equally spaced >> points, when the function itself is known only as a list of numerical >> values at those same points? >> >> -- >> "Power tends to corrupt. Absolute power corrupts absolutely." >> Lord Acton (1834-1902) >> "Dependence on advertising tends to corrupt. Total dependence on >> advertising corrupts totally." (today's equivalent) > > Here are some possibilities. > > (i) Form an interpolation of relatively high order (say 6 or so). Take > second derivatives. > > (ii) Use finite differences to approximate the second derivatives. > > (iii) Use Fourier to get the approximated derivatives. See for example > > Wang, Jing. B (2002). Numerical differentiation using Fourier. The > Mathematica Journal 8:3. 383-388. > > I believe there was a small error in the code provided; you might want > to contact the author at wang at physics.uwa.edu.au > > > Daniel Lichtblau > Wolfram Research > >
- Follow-Ups:
- Re: Re: Re: Finding derivatives of a list?
- From: Daniel Lichtblau <danl@wolfram.com>
- Re: Re: Re: Finding derivatives of a list?