One matrix per layer
Once you have more than two layers, doing interference by hand turns into a mess. The transfer-matrix method (TMM) is the trick that keeps the math under control. Each layer (and each interface) is represented by a 2×2 matrix that maps the (forward, backward) amplitudes of the wave on its left to those on its right.
The whole stack in one product
Multiply all the layer matrices and you get an effective 2×2 matrix for the entire stack. The reflection and transmission coefficientsr and t are simple ratios of its entries, andR = |r|² is what we plot.
The simulator uses an existing implementation of TMM (the Pythontmm package) — but the conceptual recipe is exactly the one sketched above. Every reflectance dip in the app comes from this one calculation, repeated at every photon energy.
- Each layer = one 2×2 matrix.
- Whole stack = the matrix product.
R(E)= |r(E)|² evaluated for every E in the chosen window.