Message Boards Message Boards

GROUPS:

Why does FourierTransform return 0, while it's obviously incorrect?

Posted 6 months ago
897 Views
|
4 Replies
|
6 Total Likes
|

Here are my calculations:

d = 10
s = 0.1
f = 1
wavelength = 0.0004
lens = Exp[(I*Pi*y^2)/(wavelength*f)]
aperture = Exp[-((y-d)^2)/(2*s^2)]*lens
APERTURE = FourierTransform[aperture, y, k] 

APERTURE gets evaluated as 0.0 + 0.0i, which is just not true... I can do this transform by hand... It's not that difficult, but for some reason Mathematica seems to choke on it... If I don't multiply by lens, it comes out okay... But I do need the lens term in there.

And this is just the first step, I could write what this evaluates to (since I did it by hand), but now I need to multiply APERTURE by Exp[-2*Pi*I*Sqrt[(1/wavelength^2-k^2)]] and take the inverse Fourier, which doesn't work either! (give 0 + 0i).

i.e.:

APERTURE = (1/Sqrt[(1/(2*Pi*s^2))-(I/(wavelength*f))])*Exp[-s^2*k^2/(2-4*Pi*s^2*I/(wavelength*f))+d*k/(i+2*Pi*s^2/(wavelength*f))-d^2*(wavelength*f-I*Pi*s^2)/(s^2*(wavelength*f-2*I*Pi*s^2))]
PROPAGATED = APERTURE*Exp[-2*Pi*I*Sqrt[(1/wavelength^2-k^2)]]
propagated = InverseFourierTransform[PROPAGATED,k,y]

get propagated evaluated as 0 + 0i.

Any idea how I can get this solved?

When calculating this numerically, I get the correct solution (when f is large enough), but for small f, I get a wrong solution, so I thought it might be a case of underflow.

With that in mind, I turned to try and solve it symbolically, so that I don't run into these type of trouble - but it would seem Mathematica has some trouble solving these Fourier transforms...

4 Replies

Use exact numbers not numeric.

d = 10;
s = 1/10;
f = 1;
wavelength = 4/10000;
lens = Exp[(I*Pi*y^2)/(wavelength*f)];
aperture = Exp[-((y - d)^2)/(2*s^2)]*lens;
APERTURE = FourierTransform[aperture, y, k]

(*E^(-5000 - (I (-1000 I + k)^2)/(200 (I + 50 \[Pi])))/(10 Sqrt[
 1 - 50 I \[Pi]])*)

For second question aka: Inverse FourierTransform ,

Do you have any reason to believe that a closed form solution should exist?

Questions like this should always indicate why it is reasonable to expect a solution.

I am not an experienced Mathematica user and thus I can't say what exactly is wrong in your example, but let me guess.

First, usually I try to avoid using approximate numbers (decimal notation) like 0.1 while working with symbolic computations. Such numbers can trigger numeric algorithms inside built-in functions which is probably not what we need. In your particular case one can rewrite the code as follows:

d = 10;
s = 1 / 10;
f = 1;
wavelength = 4 / 10000;
lens = Exp[(I*Pi*y^2)/(wavelength*f)];
aperture = Exp[-((y - d)^2)/(2*s^2)]*lens;
APERTURE = FourierTransform[aperture, y, k]

If you run this code you will get an exact solution for APERTURE:

E^(-5000 - (I (-1000 I + k)^2)/(200 (I + 50 \[Pi])))/(10 Sqrt[1 - 50 I \[Pi]])

As you can see, absolute values of APERTURE are extremely small and are far beyond machine precision which is automatically assumed when the system encounters approximate numbers.

I believe that was the problem: Mathematica identified approximate coefficients inside the Fourier integral and then tried to simplify the solution using numerical coefficients. These coefficients were too small and therefore whole expression was simplified to machine zero.

Hope I expressed my thoughts clearly.

@Nikolay Shilov is quite on target. Here is one plausible internal simplification that can be seen to give machine 0 on the FR input.

In[175]:= MapAll[Together, aperture]

(* Out[175]= 0. + 0. I *)

This is a consequence of chopping machine underflow to 0.0, coupled with the hard-to-predict and sometimes awkward way that functions like Together and Factor pull out approximate numeric constants from expressions. At some point we may have to just convert machine numbers to equivalent bignums inside those functions that were designed for symbolic manipulation, as they are the most vulnerable to such issues when given a mix of symbolic and approximate numeric input.

Thank you all for your replies - using rational constants instead of floats did indeed solve the first case, but the second case (of the inverse transform) still remains unsolved.

Now I simply get this as the result (after a lot of time has passed):

InverseFourierTransform[(
 E^(-2 I \[Pi] Sqrt[-k^2 + 1/\[Lambda]^2] - (
   2 d^2 \[Pi] + 2 d f k \[Lambda] + I f k^2 s^2 \[Lambda])/(
   4 \[Pi] s^2 + 2 I f \[Lambda])) (1 + E^((2 d f k \[Lambda])/(
    2 \[Pi] s^2 + I f \[Lambda]))))/Sqrt[
 1/s^2 - (2 I \[Pi])/(f \[Lambda])], k, y]

There could be that there isn't a closed analytic solution to this integral, but I would nevertheless like to render this solution with arbitrary precision - is it possible to do this using Mathematica?

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract