TVirtualFFT::FFT Clarifications about the output

ROOT Version: 6.10.06
Platform: Not Provided
Compiler: Not Provided


Context :
Knowing a function f:t->f(t) between 0 and L (a real number), I would like to compute the Fourier Transform in a point q (a real number) that is to say the quantity :

$\sum_{k=0}^n f(kL/n) * exp(-2i\pi q kL/n).$

So, I tried to use the TVirtualFFT library of root and I firstly began testing the Fourier transform of the cosine function between $-4 \pi$ and $+4 \pi$. Here is my code to have the real part :

Int_t N=10000;
Double_t x_min=-4*TMath::Pi();
Double_t x_max=4*TMath::Pi();

TF1 * func=new TF1("func","cos(x)",x_min,x_max);

Double_t *in=new Double_t[N+1];
Double_t x;
for(Int_t i=0;i<=N;i++) {

Int_t n_size=N+1;
TVirtualFFT *fft=TVirtualFFT::FFT(1,&n_size,"R2C");

TH1 * hist_transform=0;

Question :
I get a table of N+1 (n_size) points hist_transform but I don’t understand what they correspond to. How can I control the Fourier transform boundaries and more precisely the points at which it is calculated? For example, if I want to know the value of the Fourier transform of this cosine in q to what value it corresponds in the hist_transform ?
More generally, which is the formula calculated to have the values of the histogram hist_transform in comparison with the formula I defined in the context part ?

Best regards.

TVirtualFFT Class Reference

FFTW 3 manual -> FFTW Reference -> What FFTW Really Computes

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.