Diffraction is what a finite opening does to a wave. A narrow aperture does not simply pass through a smaller beam; it changes the angular pattern because different parts of the opening contribute with different phases. Computationally, this is an aperture-to-pattern transform problem with sampling limits.
For an ideal single slit of width a, the far-field intensity has the familiar form
The first dark minima satisfy approximately
\[a\sin\theta=\pm\lambda\]This is a far-field, scalar-wave result. It is useful as a reference fixture for a sampled Fourier-style model. Set the aperture array to a rectangle, compute its transform, square magnitude for intensity, and compare the first minimum against the analytic condition as the grid is refined.
const aperture = samples.map((x) => (Math.abs(x) <= width / 2 ? 1 : 0));
const intensity = spectrum.map((amplitude) => amplitude.real ** 2 + amplitude.imaginary ** 2);
Adjust amplitude and wavelength. The plotted line is a view of sampled displacement data; its speed is frequency divided by wave number.
Amplitude 1.0; wavelength 3.0 m; model speed 1.91 m/s.
The wave sampler supplies the amplitude and wavelength language. A diffraction calculation adds a spatial aperture array and sums phase-delayed contributions to each outgoing direction.
Prediction: At fixed wavelength, halving an ideal slit width makes the central diffraction pattern wider.
Choose a wavelength and calculate the first-minimum angle for widtha and a/2. Predict the direction of the change before calculating it, then state which far-field assumption the result relies on.Diffraction is a transform-shaped consequence of finite aperture data. Keep sampling and geometry visible, compare a numerical pattern with a known single-slit limit, and do not extend a far-field formula into every optical regime.
Treat the lesson as a small function before treating it as a fact to memorize. Give every value a unit, keep only the state needed for the next step, and make the output easy to inspect.
\[\text{observable output} = f(\text{inputs},\,\text{state})\]For Diffraction, write down the quantities you can control, the values your program must retain, and the result a reader could inspect. In Geometric and Wave Optics, the useful program is not the drawing: it is the smallest explicit model that makes a prediction you can test.
Prediction: changing one declared input while holding the others fixed should change only the outputs that the model connects to that input. Choose one input, predict the direction of change, then check a limiting case such as zero, a symmetric arrangement, or a familiar low-speed or small-change approximation.
This lesson is a teaching model, not a complete simulator. Before using it outside the stated question, check which interactions, scales, uncertainties, boundary conditions, and measurement limits it leaves out.
Treat Diffraction as a contract: named inputs and units enter a rule, the rule produces an observable result, and a known limit or invariant checks whether the implementation deserves trust.
Compute aperture diffraction from sampled wave data with explicit normalization and refinement checks.