7$ equispaced angles in $(-\pi/2, \pi/2)$; $n_{\mathrm{dir}} = 7$. In nonlocal homogenization, the additional DoF are the integrals of the form , with the Gaussian kernel of width $\tau_0 = a$.

Fig. \[fig:Re-RT-vs-angle-ExA-PRB2013\] shows the real part of $R$ and $T$ as a function of the angle of incidence, for $a / \lambda = 0.2$. (The imaginary parts are not plotted to save space but are qualitatively similar). Since analytical solutions for wave propagation in layered media are fairly simple and well known, one may easily calculate the errors in $R$ and $T$; those are plotted in Fig. \[fig:error-R-vs-angle-ExA-PRB2013\].

The figures show that our numerical results, especially for nonlocal homogenization, are highly accurate. In fact, we are not aware of any alternative methods that could produce a comparable level of accuracy at a comparable computational cost.[^2]

What explains this high accuracy? Plausible mechanisms are presented in [Section \[sec:Trefftz-approximation\]]{}.

Electromagnetic Waves in Slab Geometries {#sec:FLAME-slab}
========================================

Formulation of the problem {#sec:Formulation}
--------------------------

![Schematic for the structure used in the sample FLAME-slab calculation. The structure consists of 10 dielectric pillars positioned aperiodically on a dielectric slab. Light is incident from the top, with wavenumber $k$ and incidence angle $\theta_{\mathrm{inc}}$.[]{data-label="fig:schematic"}](schematic_CAMWA.pdf){width="11cm"}

The general description 