Re: Numerical Differentiation using Fourier Transform
- To: mathgroup at smc.vnet.net
- Subject: [mg32951] Re: [mg32941] Numerical Differentiation using Fourier Transform
- From: Sseziwa Mukasa <mukasa at jeol.com>
- Date: Thu, 21 Feb 2002 02:07:05 -0500 (EST)
- Organization: JEOL (USA) Ltd.
- References: <200202200626.BAA27697@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Mike wrote: > Hi > > I need to differentiate a function that i only know numerically and > for various reasons I have been asked to do this via a Fourier > Transform Method. Before doing it on the horrible function I am > dealing with, I thought I would get to grips with the method using > much easier functions. > > So say I want to differentiate > > E^(-x^2) > > w.r.t x using Fourier Transforms : analytically i could proceed as > follows > > FourierTransform[E^(-x^2), x, w]] = 1/(Sqrt[2]*E^(w^2/4)) > > multiply this by I*w and taking the inverse Transform yields > > (-2*x)/E^x^2 > > as expected so i am along the right lines here. Now I assume that I > only know this function numerically and see if i can reproduce this > result. First I made a table of values : > > test = Table[E^(-x^2), {x, 0.01, 20, 0.01}]; > > and find it's DFT using > > Fourier[test] > > now in order to find the derivative I need to multiply this by I*w and > take the inverse transform. My problem is how to do this? what are > my values of w? The DFT looks very different to the one I found > analytically and to be honest I don't have a clue of whats going on. > Any help would be appreciated - Thanks > The values of w associated with the DFT of a vector of length n and sampling period t are: if n is even w in [0, (n/2-1)/(n*t)] are in positions [1,n/2] and [-1/(2*t) , -1/(n*t)] are in [n/2+1,n]. If n is odd the first n/2+1 points contain [0,1/(2*t)], since F(1/(2*t))=F(-1/(2*t)) for the DFT F of f DFT's of odd length are usually computed such that the frequency range is [-(n-1)/(2*t),1/(2*t)] or some other range instead, Mathematica does not support this however. Furthermore there is no unique definition of the DFT, in particular there is a sign convention: whether the basis functions are Exp[-2*pi*I*j*k/(n-1)] or Exp[2*pi*I*j*k/(n-1)] and a normalization convention: usually multiplication by a constant factor of 1/n when applying the inverse transform but sometimes using 1/sqrt(n) for both the transform and its inverse. Mathematica supports different conventions through the FourierParameters option to Fourier see the Help Browser for more information. Regards, Sseziwa
- References:
- Numerical Differentiation using Fourier Transform
- From: m.p.croucher@sheffield.ac.uk (Mike)
- Numerical Differentiation using Fourier Transform