0
votes

I have a Fourier transformed function f(w) whose analytical form I know. Say

f(w) = Product of j=1 to 1000 (a1_j * exp (i * w * b1_j) + a2_j * exp (i* w* b2_j)+...+a10_j * exp (i* w* b10_j)+ c_j)

Where a,b,c are real numbers and "i" is sqrt(-1). So even though the the a,b,c's are known function has to computed numerically it is not really analytically tractable.

Now I want to compute inverse transform f(w) to obtain the original function F(x).

My question is partly mathematical and partly software related:

  1. I can compute the inverse transform using a available software routines but I am not sure what kind of discrete sampling should I do for f(w) to be able reproduce F(x) faithfully given some tolerance. The domain of F(x) can be quite large. So what is a way out ?

  2. Is there any freely available software routines in C/C++ which can take in as input say a functor f(w) and perform the inverse transform for a given "x". If this exist it will bypass my first question (because I guess it will internally handle how many points to use to perform the sampling/integration given any function)

1
Um, could is be that you actually want to use Matlab / Octave instead of C++?kay
There may be libraries built to handle these sorts of operations, but as @kay said, this is more fitting for a mathematical language.Easton Bornemeier
Which language, C or C++? They are different languages. In C++ there is a complex type (std::complex) but in C there is only a macro for complex type.Thomas Matthews
@ThomasMatthews I would interpret c/c++ here as "I am open to either c or c++ solutions to this problem, whichever is better".Yakk - Adam Nevraumont
c or c++ whichever works as Yakk correctly interpreted. @Yakk : yes compute F(x) at a given "x". What I mean by tolerance is the estimate of F(x) should be within certain "tol" of true F(x). We do not know what the true F(x) is but perhaps the estimate gives an "error bar" of some kind.user1612986

1 Answers

-1
votes

Is there any freely available software routines in C/C++ which can take in as input say a functor f(w) and perform the inverse transform for a given "x". If this exist it will bypass my first question (because I guess it will internally handle how many points to use to perform the sampling/integration given any function)

Absolutely classic software for FFT, present on all systems, is

http://www.fftw.org/

On UBuntu, you have to install libfftw3-dev and that's it

UPDATE

I could write discretization code, but after looking at function definition

f(w) = Product of j=1 to 1000 (a1_j * exp (i * w * b1_j) + a2_j * exp (i* w* 2_j)+...+a10_j * exp (i* w* b10_j)+ c_j)

I'm opposing to the statement

So even though the the a,b,c's are known function has to computed numerically it is not really analytically tractable.

If you look at your function, expand it carefully you'll get linear sum of

f(w) = Sumk Ak*exp(i w Bk)

Remembering that x-domain and w-domain are pretty symmetric wrt direct and inverse Fourier transformation, if mono-harmonic in x-domain will produce Dirac's δ-function in frequency domain, then mono-harmonic in w-domain will produce Dirac's δ-function in x-domain.

So F(x) would be

F(x) = Sumk Ak * δ(x - Bk)

Dealing with δ numerically is EXTREMELY cumbersome, so I advise you to drop this whole discretization business and concentrate on how to compute Ak and Bk from your f(w) expression.