# single slit diffraction numerical simulation

I'm trying to simulate the Fraunhoffer diffraction at slits(single,double,triple) with Mathematica.

In the picture, the red one is analytical result and the green one is numerical result.

The question is, why does it oscilate on the numerical result? Or does it occurs in reality? If so, what is the mechanism or principle of the occurrence of the oscillation even though the analytic solution is smooth?

The mathematica source file is here.

source file

The slit size is 50um.

I don't think it is the sampling problem, because when I changed the sampling number 500 to 5000, the oscillation was still exist.

• The solution also is asymmetric. If you fix that problem, perhaps by explicitly assuming symmetry, it may help with the other problem too. Commented Jul 26, 2016 at 2:07
• How is that Mathematica question?
– Kuba
Commented Jul 26, 2016 at 6:19
• @bbgodfrey When I increase the sampling number, the graph is moved to the center and the symmetric problem is solved. But still, the oscillation exists. The width of the slit is wider(or closer to rectangular aperture), the oscillation disappears. Commented Jul 26, 2016 at 8:05
• @Kuba I'm sorry that this is too vague. The real problem is though I don't think there is no critical error in my code, the result is different form the analytical solution. I think there is no reason for the occurrence of the high frequency component on the numerical solution. Commented Jul 26, 2016 at 8:12
• Can you increase the resolution only regarding the y-axis? It seems that increasing the resolution decreases the amplitude of the high frequency component, but doing so for both dimensions increase the memory usage to unreasonable amounts. Commented Jul 26, 2016 at 15:28

I believe that the problem is the Nyquist limit. You are representing the slit as sampled array of zeros and ones. The bandwidth of the edge is infinite so at any sample interval you will be undersampled.

To see this effect in one dimension, consider the following code, which models the slit in much the way you have done, then upsamples it to give an impression of the underlying fully-sampled signal.

slit = Table[If[Abs[t] < 10, 1, 0], {t, -100, 99}];
spec = Fourier[slit] // Chop;
upslit = InverseFourier[Join[Take[spec, 100], Table[0, {1400}], Take[spec, -100]]];
ListLinePlot[Re[upslit], PlotRange -> All]


The oscillations shown here may well explain the oscillations seen in your final result. [Note: the phase of upslit is not right, but I hope it gets the message across]

You might get round the problem by fudging some sort of taper on the edge of the slit.

• I'm sorry for late. The problem was screen size(field size 'L' in my code). I changed the L as 0.5, 1, 1.5 keeping the sampling number (Delta n as 5000) and the oscillation was decreased! As the screen size is increased, the oscillation depth was down. I haven't expected and I thought that the screen size is enough. When the slit size is wide, it is not problem. However, when the slit size is very small, like ~micron, the huge screen size is required to calculate the propagation. Thanks! – Commented Aug 5, 2016 at 3:25