QPMS
Electromagnetic multiple scattering library and toolkit.

In general, the (transversal) VSWFs can be defined using (some) vector spherical harmonics as follows:
\[ \wfm\pr{k\vect r}_{lm} = \sphbes_l(kr) \vshrot_{lm} (\uvec r),\\ \wfe\pr{k\vect r}_{lm} = \frac{\frac{\ud}{\ud(kr)}\pr{kr\sphbes_l(kr)}}{kr} \vshgrad_{lm}(\uvec r) + \sqrt{l(l+1)} \frac{\sphbes_l(kr)}{kr} \vshrad_{lm}(\uvec r), \]
where at this point, we don't have much expectations regarding the normalisations and phases of the "rotational", "gradiental" and "radial" vector spherical harmonics \( \vshrot, \vshgrad, \vshrad \), and the waves can be of whatever "direction" (regular, outgoing, etc.) depending on the kind of the spherical Bessel function \( \sphbes \). We only require that the spherical harmonic degree \( l \) is what it is supposed to be. The meaning of the order $m$ may vary depending on convention. Moreover, in order to \( \wfe \) be a valid "electric" multipole wave, there is a fixed relation between radial and gradiental vector spherical harmonics (more on that later).
Let us define the "dual" vector spherical harmonics \( \vshD_{\tau lm} \) as follows:
\[ \int_\Omega \vsh_{\tau lm} (\uvec r) \cdot \vshD_{\tau' l'm} (\uvec r) \, \ud \Omega = \delta_{\tau', \tau}\delta_{l',l} \delta_{m',m} \]
where the \( \cdot \) symbol here means the bilinear form of the vector components without complex conjugation (which is included in the "duality" mapping).
The problem with conventions starts with the very definition of associated Legendre / Ferrers functions.
For the sake of nonambiguity, let us first define the "canonical" associated Legendre/Ferrers polynomials without the CondonShortley phase.
\[ \rawLeg{l}{0}(x) = \frac{1}{2^n n!} \frac{\ud^n}{\ud x^n} \pr{x^21}^n , \\ \rawLeg{l}{m}(x) = \pr{1x^2}^{m/2} \frac{\ud^m}{\ud x^m} \rawLeg{l}{0},\quad\abs{x}\le 1, m \ge 0, \\ \rawLeg{l}{m}(x) = (1)^\abs{m} \frac{(l\abs{m})!}{(l+\abs{m})!} \rawLeg{l}{\abs{m}}, \quad \abs{x} \le 1, m < 0. \]
DLMF [1] has for nonnegative integer \(m\) (18.5.5), (14.6.1), (14.9.3):
\[ \dlmfFer{\nu}{} = \dlmfLeg{\nu}{} = \frac{1}{2^n n!} \frac{\ud^n}{\ud x^n} \pr{x^21}^n , \\ \dlmfFer{\nu}{m}\left(x\right)=(1)^{m}\left(1x^2\right)^{m/2}\frac{{ \ud}^{m}\dlmfFer{\nu}{}\left(x\right)}{{\ud x}^{m}},\\ %\dlmfLeg{\nu}{m}\left(x\right)=\left(1+x^2\right)^{m/2}\frac{{ %\ud}^{m}\dlmfLeg{\nu}{}\left(x\right)}{{\ud x}^{m}},\\ \]
where the connection to negative orders is
\[ \dlmfFer{\nu}{m}(x) = (1)^m \frac{\Gamma\pr{\num+1}}{\Gamma\pr{\nu+m+1}}\dlmfFer{\nu}{m}(x),\\ %\dlmfLeg{\nu}{m}(x) = \frac{\Gamma\pr{\num+1}}{\Gamma\pr{\nu+m+1}}\dlmfLeg{\nu}{m}(x).\\ \]
Note that there are called "Ferrers" functions in DLMF, while the "Legendre" functions have slightly different meaning / conventions (Ferrers functions being defined for \( \abs{x} \le 1 \), whereas Legendre for \( \abs{x} \ge 1 \). We will not use the DLMF "Legendre" functions here.
One sees that \( \dlmfFer{l}{m} = (1)^m \rawFer{l}{m} \), i.e. the CondonShortley phase is already included in the DLMF definitions of Ferrers functions.
GSL computes \( \rawFer{l}{m} \) unless the corresponding csphase
argument is set to \(1\) (then it computes \( \dlmfFer{l}{m} \)). This is not explicitly obvious from the docs [2], but can be tested by running gsl_sf_legendre_array_e
for some specific arguments and comparing signs.
Let' have two different (complex) spherical harmonic conventions connected by constant factors:
\[ \spharm[a]{l}{m} = c^\mathrm{a}_{lm}\spharm{l}{m}. \]
Both sets can be used to describe an angular function \( f \)
\[ f = \sum_{lm} f^\mathrm{a}_{lm} \spharm[a]{l}{m} = \sum_{lm} f^\mathrm{a}_{lm} c^\mathrm{a}_{lm}\spharm{l}{m} = \sum_{lm} f_{lm} \spharm{l}{m}. \]
If we perform a (symmetry) transformation \( g \) acting on the \( \spharm{l}{m} \) basis via matrix \( D(g)_{l,m;l',m'} \), i.e.
\[ g\pr{\spharm{l}{m}} = \sum_{l'm'} D(g)_{l,m;l'm'} \spharm{l'}{m'}, \]
we see
\[ g(f) = \sum_{lm} f_{lm}\sum_{l'm'} D(g)_{l,m;l'm'} \spharm{l'}{m'} = \sum_{lm} f^\mathrm{a}_{lm} c^\mathrm{a}_{lm}\sum_{l'm'} D(g)_{l,m;l'm'} \spharm{l'}{m'}. \]
Rewriting the transformation action in the second basis
\[ g\pr{\spharm[a]{l}{m}} = \sum_{l'm'} D(g)^\mathrm{a}_{l,m;l'm'} \spharm[a]{l'}{m'},\\ g(f) = \sum_{lm} f^\mathrm{a}_{lm}\sum_{l'm'} D(g)^\mathrm{a}_{l,m;l'm'} \spharm[a]{l'}{m'}, \]
and performing some substitutions,
\[ g(f) = \sum_{lm} \frac{f_{lm}}{c^\mathrm{a}_{lm}} \sum_{l'm'} D(g)^\mathrm{a}_{l,m;l'm'} c^\mathrm{a}_{l'm'}\spharm{l'}{m'}, \]
and comparing, we get
\[ D(g)^\mathrm{a}_{l,m;l'm'} = \frac{c^\mathrm{a}_{lm}}{c^\mathrm{a}_{l'm'}}D(g)_{l,m;l'm'}. \]
If the difference between conventions is in particular CondonShortley phase, this means a \( (1)^{mm'} \) factor between the transformation matrices. This does not affect the matrices for the inversion and mirror symmetry operations with respect to the xy, yz and xz planes, because they are all diagonal or antidiagonal with respect to m (hence \( mm \) is either zero or anyways even integer). It does, however, affect rotations, flipping the sign of the rotations along the z axis.
Apparently, a constant complex factor independent of \( l,m \) does nothing to the form of the tranformation matrix.
These conclusions about transformations of spherical harmonics hold also for the VSWFs built on top of them.
Let us declare VSWFs in Kristensson's conventions below, \( \wfkc \) [3], \( \wfkr \) [4], as the "canonical" spherical waves based on complex and real spherical harmonics, respectively. They both have the property that the translation operators \( \tropRrr{}{},\tropSrr{}{} \) that transform the VSWF field expansion coefficients between different origins, e.g.
\[ \wfkcreg(\vect{r}) = \tropRrr{\vect r}{\vect r'} \wfkcreg(\vect{r'}), \]
actually consist of two different submatrices $A,B$ for the sametype and differenttype (in the sense of "electric" versus "magnetic" waves) that repeat themselves once:
\[ \begin{bmatrix} \wfkcreg_1(\vect{r}) \\ \wfkcreg_2(\vect{r}) \end{bmatrix} = \begin{bmatrix} A & B \\ B & A \end{bmatrix}(\vect{r} \leftarrow \vect{r'}) \begin{bmatrix} \wfkcreg_1(\vect{r'}) \\ \wfkcreg_2(\vect{r'}) \end{bmatrix}. \]
(This symmetry holds also for singular translation operators \( \tropSrr{}{} \) and real spherical harmonics based VSWFs \( \wfkr \).)
However, the symmetry above will not hold like this in some stupider convention. Let's suppose that one uses a different convention with some additional coefficients compared to the canonical one,
\[ \wfm_{lm} = \alpha_{\wfm lm} \wfkc_{1lm},\\ \wfe_{lm} = \alpha_{\wfe lm} \wfkc_{2lm}.\\ \]
and with field expansion (WLOG assume regular fields only)
\[ \vect E = c_{\wfe l m} \wfe_{lm} + c_{\wfm l m } \wfm_{lm}. \]
Under translations, the coefficients then transform like
\[ \begin{bmatrix} \alpha_\wfe(\vect{r}) \\ \alpha_\wfm(\vect{r}) \end{bmatrix} = \begin{bmatrix} R_{\wfe\wfe} & R_{\wfe\wfm} \\ R_{\wfm\wfe} & R_{\wfm\wfm} \end{bmatrix}(\vect{r} \leftarrow \vect{r'}) \begin{bmatrix} \alpha_\wfe(\vect{r'}) \\ \alpha_\wfm(\vect{r'}) \end{bmatrix}, \]
and by substituting and comparing the expressions for canonical waves above, one gets
\[ R_{\wfe,lm;\wfe,l'm'} = \alpha_{\wfe lm}^{1} A_{lm,l'm'} \alpha_{\wfe l'm'},\\ R_{\wfe,lm;\wfm,l'm'} = \alpha_{\wfe lm}^{1} B_{lm,l'm'} \alpha_{\wfm l'm'},\\ R_{\wfm,lm;\wfe,l'm'} = \alpha_{\wfm lm}^{1} B_{lm,l'm'} \alpha_{\wfe l'm'},\\ R_{\wfm,lm;\wfm,l'm'} = \alpha_{\wfm lm}^{1} A_{lm,l'm'} \alpha_{\wfm l'm'}. \]
If the coefficients for magnetic and electric waves are the same, \( \alpha_{\wfm lm} = \alpha_{\wfe lm} \), the translation operator can be written in the same symmetric form as with the canonical convention, just the matrices \( A, B\) will be different inside.
If the coefficients differ (as in SCUFFEM convention, where there is a relative i factor between electric and magnetic waves), the functions such as qpms_trans_calculator_get_AB_arrays() will compute \( R_{\wfe\wfe}, R_{\wfe\wfm} \) for \( A, B \) arrays. The remaining matrices' elements must then be obtained as
\[ R_{\wfm,lm;\wfe,l'm'} = \alpha_{\wfm lm}^{1} \alpha_{\wfe lm} R_{\wfe,lm;\wfm,l'm'} \alpha_{\wfm l'm'}^{1} \alpha_{\wfe l'm'} = g_{lm}R_{\wfe,lm;\wfm,l'm'}g_{l'm'}, \\ R_{\wfm,lm;\wfm,l'm'} = \alpha_{\wfm lm}^{1} \alpha_{\wfe lm} R_{\wfe,lm;\wfe,l'm'} \alpha_{\wfe l'm'}^{1} \alpha_{\wfm l'm'} = g_{lm}R_{\wfe,lm;\wfe,l'm'}g_{l'm'}^{1}, \]
where the coefficients \( g_{lm} \) can be obtained by qpms_normalisation_factor_N_M().
 Source  Ferrers function  Negative \(m\)  Spherical harmonics  ————  DLMF [1] 
\[ \dlmfFer{\nu}{m}\left(x\right)=(1)^{m}\left(1x^2\right)^{m/2}\frac{{ \ud}^{m}\dlmfFer{\nu}{}\left(x\right)}{{\ud x}^{m}} \]

\[ \dlmfFer{\nu}{m}(x) = (1)^m \frac{\Gamma\pr{\num+1}}{\Gamma\pr{\nu+m+1}}\dlmfFer{\nu}{m}(x) \]
 Complex (14.30.1):
\[ \dlmfYc{l}{m} = \sqrt{\frac{(lm)!(2l+1)}{4\pi(l+m)!}} e^{im\phi} \dlmfFer{l}{m}(\cos\theta). \]
Real, unnormalized (14.30.2): \( \dlmfYrUnnorm{l}{m}\pr{\theta,\phi} = \cos\pr{m\phi} \dlmfFer{l}{m}\pr{\cos\theta} \) or \( \dlmfYrUnnorm{l}{m}\pr{\theta,\phi} = \sin\pr{m\phi} \dlmfFer{l}{m}\pr{\cos\theta} \).   GSL [2] 
\[ \Fer[GSL]{l}{m} = \csphase^m N \rawFer{l}{m} \]
for nonnegative \(m\). \( \csphase\) is one by default and can be set to \( 1\) using the functions ending with _e with argument csphase = 1
. \( N\) is a positive normalisation factor from from gsl_sf_legendre_t
.  N/A. Must be calculated manually.  The asimuthal part must be calculated manually. Use norm = GSL_SF_LEGENDRE_SPHARM
to get the usual normalisation factor \( N= \sqrt{\frac{(lm)!(2l+1)}{4\pi(l+m)!}} \).   Kristensson I [3]  \( \rawFer{l}{m} \)  As in \( \rawFer{l}{m} \). 
\[ \spharm[Kc]{l}{m} = (1)^m \sqrt{\frac{(lm)!(2l+1)}{4\pi(l+m)!}} \rawFer{l}{m}(\cos\theta) e^{im\phi}, \]
(cf. Sec. D.2), therefore it corresponds to the DLMF sph. harms.:
\[ \spharm[Kc]{l}{m} = \dlmfYc{l}{m}. \]
  Kristensson II [4]  \( \rawFer{l}{m} \)  As in \( \rawFer{l}{m} \). 
\[ \spharm[Kr]{\begin{Bmatrix}e \\ o\end{Bmatrix}}{l}{m} = \sqrt{2\delta_{m0}}\sqrt{\frac{(lm)!(2l+1)}{4\pi(l+m)!}} \rawFer{l}{m}(\cos\theta) \begin{Bmatrix}\cos\phi \\ \sin\phi\end{Bmatrix}, \]
\( m \ge 0 \). Cf. Appendix C.3.   Reid [5]  Not described in the memos. Superficial look into the code suggests that the GetPlm
function does include the CondonShortley phase and spherical harmonic normalisation, so
\[ \Fer[GetPlm]{l}{m} = (1)^m \sqrt{\frac{(lm)!(2l+1)}{4\pi(l+m)!}} \rawFer{l}{m} \]
for nonnegative \( m \).  N/A. Must be calculated manually. 
\[ \spharm[GetYlm]{l}{m}(\theta,\phi) = \Fer[GetPlm]{l}{m}(\cos\theta) e^{im\phi},\quad m\le 0, \\ \spharm[GetYlm]{l}{m}(\theta,\phi) = (1)^m\Fer[GetPlm]{l}{\abs{m}}(\cos\theta) e^{im\phi},\quad m<0, \]
and the negative sign in the second line's exponent is quite concerning, because that would mean the asimuthal part is actually \( e^{i\abs{m}\phi} \). Is this a bug in scuffem? Without it, it would be probably equivalent to DLMF's \( \dlmfYc{l}{m} \)s for both positive and negative \( m\)s. However, it seems that GetYlmDerivArray
has it consistent, with
\[ \spharm[GetYlmDerivArray]{l}{m} = \dlmfYc{l}{m} \]
for all \(m\), and this is what is actually used in GetMNlmArray
(used by both SphericalWave
in libIncField
(via GetMNlm
) and GetSphericalMoments
in libscuff
(via GetWaveMatrix
)) and GetAngularFunctionArray
(not used). 
 Source  VSWF definition  E/M interrelations  VSWF norm  CS Phase  Field expansion  Radiated power  Notes  — — — — — — — —   Kristensson I [3] 
\[ \wfkc = \dots \]
where \(\wfkc\) is either of \( \wfkcreg, \wfkcout, \dots \) based on the radial (spherical Bessel) function type. 
\[ \wfkcreg_{1lm} = \frac{1}{k}\nabla\times\wfkcreg_{2lm}, \\ \wfkcreg_{2lm} = \frac{1}{k}\nabla\times\wfkcreg_{1lm}, \]
and analogously for outgoing waves \( \wfkcout \), eq. (2.8) onwards.   Yes, in the spherical harmonics definition, cf. sect. D.2. 
\[ \vect E = k \sqrt{\eta_0\eta} \sum_n \left( \wckcreg_n \wfkcreg_n + \wckcout_n \wfkcout_n \right), \\ \vect H = \frac{k \sqrt{\eta_0\eta}}{i\eta_0\eta} \sum_n \left( \wckcreg_n \wfkcreg_n + \wckcout_n \wfkcout_n \right), \]
but for plane wave expansion [3] sect. 2.5 K. uses a different definition (same as in Kristensson II). 
\[ P = \frac{1}{2} \sum_n \left( \abs{\wckcout_n}^2 +\Re \left(\wckcout_n\wckcreg_n^{*}\right)\right) \]
 The \( \wckcreg, \wckcout \) coefficients have dimension \( \sqrt{\mathrm{W}} \).   Kristensson II [4] 
\[ \wfkr = \dots \]
where \(\wfkr\) is either of \( \wfkrreg, \wfkrout, \dots \) based on the radial (spherical Bessel) function type. 
\[ \nabla\times\wfkrreg_{\tau n} = k\wfkrreg_{\overline{\tau} n}, \]
eq. (7.7) and analogously for outgoing waves \( \wfkrout \).   
\[ \vect E = \sum_n \left( \wckrreg_n \wfkrreg_n + \wckrout_n \wfkrout_n \right), \\ \vect H = \frac{1}{i\eta_0\eta} \sum_n \left( \wckrreg_n \wfkrreg_n + \wckrout_n \wfkrout_n \right) \]

\[ P = \frac{1}{2k^2\eta_0\eta} \sum_n \left( \abs{\wckrout_n}^2 +\Re \left(\wckrout_n\wckrreg_n^{*}\right)\right) \]
 The \( \wckrreg, \wckrout \) coefficients have dimension \( \mathrm{V/m} \).   Reid [5]  By examining the code, it appears that both GetMNlmArray()
and GetWaveMatrix()
with argument MaxwellWaves = true
(with MaxwellWaves = false
it seems to calculate nonsense) return the following w.r.t. Kristensson's "complex VSWFs":
\[ \wfr_{lmM} = i\wfkc_{1lm}, \\ \wfr_{lmN} = \wfkc_{2lm}. \]

\[ \nabla\times\wfr_{lmM} = ik\wfr_{lmN}, \\ \nabla\times\wfr_{lmN} = +ik\wfr_{lmM}. \]
  
\[ \vect E = \sum_\alpha \pr{ \wcrreg_\alpha \wfrreg_\alpha + \wcrout_\alpha \wfrout_\alpha }, \\ \vect H = \frac{1}{Z_0Z^r} \sum_\alpha \pr{ \wcrreg_\alpha \sigma_\alpha\wfrreg_\overline{\alpha} + \wcrout_\alpha \sigma_\alpha\wfrout_\overline{\alpha}}, \]
where \( \sigma_{lmM} = +1, \sigma_{lmN}=1, \overline{lmM}=lmN, \overline{lmN}=lmM, \) cf. eq. (6). The notation is not extremely consistent throughout Reid's memo.     Taylor [6] 
\[ \wfet_{mn}^{(j)} = \frac{n(n+1)}{kr}\sqrt{\frac{2n+1}{4\pi}\frac{\left(nm\right)!}{\left(n+m\right)!}}\Fer[Taylor]{n}{m}\left(\cos\theta\right)e^{im\phi}z_{n}^{j}\left(kr\right)\uvec{r} \\ +\left[\tilde{\tau}_{mn}\left(\cos\theta\right)\uvec{\theta}+i\tilde{\pi}_{mn}\left(\cos\theta\right)\uvec{\phi}\right]e^{im\phi}\frac{1}{kr}\frac{\ud\left(kr\,z_{n}^{j}\left(kr\right)\right)}{\ud(kr)}, \\ \wfmt_{mn}^{(j)} = \left[i\tilde{\pi}_{mn}\left(\cos\theta\right)\uvec{\theta}\tilde{\tau}_{mn}\left(\cos\theta\right)\uvec{\phi}\right]e^{im\phi}z_{n}^{j}\left(kr\right). \]
Assuming the Legendre functions \( \Fer[Taylor]{n}{m} \) here do contain the CondonShortley phase (AFAIK not explicitly stated in the book), i.e. \(\Fer[Taylor]{l}{m} = \dlmfFer{l}{m} \), then the relation to Kristensson's waves is
\[ \wfmt_{mn} = \sqrt{n(n+1)} \wfkc_{1nm}, \\ \wfet_{mn} = \sqrt{n(n+1)} \wfkc_{2nm}. \]
 
\[ \int_{S(kr)} \wfmt_{mn}^{(j)} \wfmt_{m'n'}^{(j)}\,\ud S = n(n+1) \abs{z_n^{(j)}}^2 \delta_{m,m'}\delta_{n,n'} ,\\ \int_{S(kr)} \wfet_{mn}^{(j)} \wfet_{m'n'}^{(j)}\,\ud S = \pr{\pr{n(n+1)}^2 \abs{\frac{z_n^{(j)}}{kr}}^2 + n(n+1)\abs{\frac{1}{kr}\frac{\ud}{\ud(kr)}\pr{kr z_n^{(j)}}} } \delta_{m,m'}\delta_{n,n'} , \]
cf. [6], eqs. (2.40–41). I suspect that this is also wrong and \(\delta_{m,m'}\) should be replaced with \(\delta_{m,m'}\).  
\[ \vect E = \sum_{mn} \pr{i \pr{\wcetreg_{mn}\wfetreg_{mn} + \wcmtreg_{mn}\wfmtreg{mn}} +i \pr{\wcetout_{mn}\wfetout_{mn} + \wcmtout_{mn}\wfmtout_{mn}}}, \\ \vect H = n_{ext}\sum_{mn} \pr{ \pr{\wcmtreg_{mn}\wfetreg_{mn} + \wcetreg_{mn}\wfmtreg{mn}} + \pr{\wcmtout_{mn}\wfetout_{mn} + \wcetout_{mn}\wfmtout_{mn}}}, \]
  Different sign for regular/scattered waves! Also WTF are the units of \( n_{ext} \)? The whole definition seems rather inconsistent. 