  This paper presents a novel algorithm, based on use of rational approximants
of randomly scalarized boundary integral resolvents, for the evaluation of
acoustic and electromagnetic resonances in open and closed cavities; for
simplicity we restrict treatment to cavities in two-dimensional space. The
desired open cavity resonances (also known as ``eigenvalues'' for interior
problems, and ``scattering poles'' for exterior and open problems) are obtained
as the poles of associated rational approximants; both the approximants and
their poles are obtained by means of the recently introduced AAA
rational-approximation algorithm. In fact, the proposed resonance-search method
applies to any nonlinear eigenvalue problem (NEP) associated with a given
function $F: U \to \mathbb{C}^{n\times n}$, wherein a complex value $k$ is
sought for which $F_kw = 0$ for some nonzero $w\in \mathbb{C}^n$. For the
cavity problems considered in this paper, $F_k$ is taken as a spectrally
discretized version of a Green function-based boundary integral operator at
spatial frequency $k$. In all cases, the scalarized resolvent is given by an
expression of the form $u^* F_k^{-1} v$, where $u,v \in \mathbb{C}^n$ are fixed
random vectors. A variety of numerical results are presented for both
scattering resonances and other NEPs, demonstrating the accuracy of the method
even for high frequency states.
