Re: Numerical Differentiation using Fourier Transform

*To*: mathgroup at smc.vnet.net*Subject*: [mg33011] Re: Numerical Differentiation using Fourier Transform*From*: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>*Date*: Tue, 26 Feb 2002 04:34:51 -0500 (EST)*Organization*: Universitaet Leipzig*References*: <a4vgmt$r4b$1@smc.vnet.net> <200202210707.CAA02160@smc.vnet.net> <a57gs9$2dk$1@smc.vnet.net>*Reply-to*: kuska at informatik.uni-leipzig.de*Sender*: owner-wri-mathgroup at wolfram.com

Hi, it he would use a Fourier approximation to it's discrete sampled points he would use the NumericalMath`TrigFit` package. *This* calculates a function expansion with continuous time and discrete frequencies! But he asked how to use a discret to discret Fourier transform to compute the derivative and I told him that a discrete derivative does not exist (what a surprise). In addition to this bad news, I pointed out that he can use a discrete approximation of a derivative and use it with a DFT. > I don't think you're right about the previous question by Mike Croucher. > His practical problem is to use an approximation for a function given a > finite set of sampling points. Tha'ts quite common thing ! > And he clearly wants to use a Fourier approximation (instead of > interpolation polynomials, or whatever). This has decisive advantages if you > want to remove noise for example from an experimental array of values. TrigFit[] has a complete different error than a Fourier expansion, because it make a least square fit. So it is not realy a Fourier series. > One point, however, is very important to have in mind. This is the so called > 'Gibbs' phenomenon arising because of discontinuity between the first point > and the last point of the array. If the function does not take the same > value, then you will get strange things due to non absolute convergence of > the Fourier approximation. Just use the following code by replacing the > function f[x] by a function taking different values at f[0] and f[xmax]. You > will see what I mean by very strange (and yet perfectly well understood) > phenomenon § > > ************************** > Clear[test, xt, Foutest, n, nHalf, xmax, ismooth] > xmax = 6. > nHalf = 200 > n = 2*nHalf + 1 > xt = Table[i*xmax/n , {i, 0, n - 1}]; > f[x_] := E^(-(x - xmax/2.)^2) > test = Table[f[i*xmax/n] , {i, 0, n - 1}]; > Foutest = Chop[Fourier[test]]; > FouDer = Foutest; > FouDer[[1]] = 0.; > ismooth = 1000000; > freq1 = -I*Table[i*Exp[-(i/ismooth)^2], {i, 1, nHalf}]; (* Here is one half > of the frequency terms *) > freq2 = I*Table[i*Exp[-(i/ismooth)^2], {i, 1, nHalf}]; (* Here is the other > half . Notice the Reverse order below*) > We must have different analysis books. I always thought that Limit[(f[x+h]-f[x])/h,h->0] is the derivative and not -(s^2)^(3/2)* Integrate[ t*E^(-(s^2*t^2)/4)*f[x - t], {t, -Infinity, Infinity}]/(4* Sqrt[Pi]) Using your new definition one can express an approximation of the new "Dumas derivative" in terms of the old definition DDumas[f[x],x] approx f'[x]+x*f''[x] did the original poster want this ? really ? I must have overseen that ! If you want reduce the noise, the approximation of the derivative should have more points like my suggestion (f[i-2] - 8*f[i-1] + 8*f[i+1] - f[i+2])/12 but TrigFit[] should also smooth the data. But TrigFit[] has nothing to do with DFT. Regards Jens

**References**:**Re: Numerical Differentiation using Fourier Transform***From:*Jens-Peer Kuska <kuska@informatik.uni-leipzig.de>