Skip to main content

lib_jsl_special_functions/
mathieu.rs

1//! Mathieu functions (SciPy's `mathieu_a`, `mathieu_b`, `mathieu_cem`, `mathieu_sem`,
2//! `mathieu_modcem1`, `mathieu_modcem2`, `mathieu_modsem1`, `mathieu_modsem2`): solutions of
3//! `y'' + (a − 2q cos 2x) y = 0` periodic in `x`, and of the modified equation
4//! `y'' − (a − 2q cosh 2z) y = 0`.
5//!
6//! See the book entry [Mathieu, parabolic cylinder and spheroidal wave functions](https://jwkunz.github.io/lib_jsl/book/special_functions/wave-functions.html).
7
8use crate::bessel_functions_integer::bessel_jy_integer;
9use crate::tridiagonal::{eigenvalues, eigenvector};
10
11/// The four families of periodic Mathieu functions, by parity and period.
12#[derive(Clone, Copy, PartialEq, Eq, Debug)]
13enum Family {
14    /// `ce_{2n}`: `Σ A_{2k} cos 2kx`.
15    CeEven,
16    /// `ce_{2n+1}`: `Σ A_{2k+1} cos (2k+1)x`.
17    CeOdd,
18    /// `se_{2n+1}`: `Σ B_{2k+1} sin (2k+1)x`.
19    SeOdd,
20    /// `se_{2n+2}`: `Σ B_{2k+2} sin (2k+2)x`.
21    SeEven,
22}
23
24impl Family {
25    fn of(m: usize, sine: bool) -> Family {
26        match (sine, m.is_multiple_of(2)) {
27            (false, true) => Family::CeEven,
28            (false, false) => Family::CeOdd,
29            (true, false) => Family::SeOdd,
30            (true, true) => Family::SeEven,
31        }
32    }
33    /// The harmonic of coefficient index `k`.
34    fn harmonic(self, k: usize) -> f64 {
35        match self {
36            Family::CeEven => (2 * k) as f64,
37            Family::CeOdd | Family::SeOdd => (2 * k + 1) as f64,
38            Family::SeEven => (2 * k + 2) as f64,
39        }
40    }
41    /// The position of order `m` in its family (the eigenvalue index).
42    fn index(self, m: usize) -> usize {
43        match self {
44            Family::CeEven => m / 2,
45            Family::CeOdd | Family::SeOdd => (m - 1) / 2,
46            Family::SeEven => (m - 2) / 2,
47        }
48    }
49}
50
51// ANCHOR: mathieu_matrix
52/// The tridiagonal matrix of the Fourier-coefficient recurrence of a family (`q ≥ 0`):
53/// diagonal `h_k²` (with `±q` in the first entry of the odd families) and off-diagonals `q`,
54/// except the coupling of `A₀` and `A₂`, which is `2q` below the diagonal.
55fn matrix(f: Family, q: f64, size: usize) -> (Vec<f64>, Vec<f64>, Vec<f64>) {
56    let mut d: Vec<f64> = (0..size).map(|k| f.harmonic(k).powi(2)).collect();
57    let sup = vec![q; size - 1];
58    let mut sub = vec![q; size - 1];
59    match f {
60        Family::CeEven => sub[0] = 2.0 * q,
61        Family::CeOdd => d[0] += q,
62        Family::SeOdd => d[0] -= q,
63        Family::SeEven => {}
64    }
65    (d, sup, sub)
66}
67// ANCHOR_END: mathieu_matrix
68
69fn size_for(m: usize, q: f64) -> usize {
70    m / 2 + 30 + (4.0 * q.abs().sqrt()) as usize
71}
72
73/// The characteristic value and the normalised Fourier coefficients for `q ≥ 0`.
74fn solve(f: Family, m: usize, q: f64) -> (f64, Vec<f64>) {
75    let n = size_for(m, q);
76    let (d, sup, sub) = matrix(f, q, n);
77    let lam = eigenvalues(&d, &sup, &sub)[f.index(m)];
78    let mut c = eigenvector(&d, &sup, &sub, lam);
79    // ∫₀^{2π} y² = π: 2A₀² + ΣA² = 1 for ce_{2n}, ΣA² = 1 otherwise.
80    let norm = (c.iter().map(|v| v * v).sum::<f64>() + if f == Family::CeEven { c[0] * c[0] } else { 0.0 }).sqrt();
81    c.iter_mut().for_each(|v| *v /= norm);
82    // Sign (DLMF 28.2.30): ce_m(0, q) > 0 and se_m'(0, q) > 0.
83    let at_zero: f64 = match f {
84        Family::CeEven | Family::CeOdd => c.iter().sum(),
85        Family::SeOdd | Family::SeEven => c.iter().enumerate().map(|(k, v)| f.harmonic(k) * v).sum(),
86    };
87    if at_zero < 0.0 {
88        c.iter_mut().for_each(|v| *v = -*v);
89    }
90    (lam, c)
91}
92
93/// The characteristic value `a_m(q)` of the even solutions `ce_m` (SciPy's `mathieu_a`).
94pub fn mathieu_a(m: usize, q: f64) -> f64 {
95    if q < 0.0 {
96        // a_{2n}(−q) = a_{2n}(q), a_{2n+1}(−q) = b_{2n+1}(q).
97        return if m.is_multiple_of(2) { mathieu_a(m, -q) } else { mathieu_b(m, -q) };
98    }
99    solve(Family::of(m, false), m, q).0
100}
101
102/// The characteristic value `b_m(q)` of the odd solutions `se_m`, `m ≥ 1` (SciPy's `mathieu_b`).
103pub fn mathieu_b(m: usize, q: f64) -> f64 {
104    if m == 0 {
105        return f64::NAN;
106    }
107    if q < 0.0 {
108        return if m.is_multiple_of(2) { mathieu_b(m, -q) } else { mathieu_a(m, -q) };
109    }
110    solve(Family::of(m, true), m, q).0
111}
112
113fn series(f: Family, c: &[f64], x: f64) -> (f64, f64) {
114    let sine = matches!(f, Family::SeOdd | Family::SeEven);
115    let (mut y, mut dy) = (0.0, 0.0);
116    for (k, ck) in c.iter().enumerate() {
117        let h = f.harmonic(k);
118        if sine {
119            y += ck * (h * x).sin();
120            dy += ck * h * (h * x).cos();
121        } else {
122            y += ck * (h * x).cos();
123            dy -= ck * h * (h * x).sin();
124        }
125    }
126    (y, dy)
127}
128
129// ANCHOR: mathieu_cem
130/// The even Mathieu function `ce_m(x, q)` and its derivative `d/dx` (SciPy's `mathieu_cem`;
131/// as in SciPy, `x` is in **degrees** and the derivative is with respect to radians).
132/// Normalised so that `∫₀^{2π} ce_m² dx = π`, with `ce_m(0, q) > 0` (DLMF 28.2.30).
133pub fn mathieu_cem(m: usize, q: f64, x_deg: f64) -> (f64, f64) {
134    let x = x_deg.to_radians();
135    if q < 0.0 {
136        // ce_{2n}(x, −q) = (−1)ⁿ ce_{2n}(π/2 − x, q); ce_{2n+1}(x, −q) = (−1)ⁿ se_{2n+1}(π/2 − x, q).
137        let sign = if (m / 2).is_multiple_of(2) { 1.0 } else { -1.0 };
138        let (y, dy) = if m.is_multiple_of(2) { mathieu_cem(m, -q, 90.0 - x_deg) } else { mathieu_sem(m, -q, 90.0 - x_deg) };
139        return (sign * y, -sign * dy);
140    }
141    let f = Family::of(m, false);
142    let (_, c) = solve(f, m, q);
143    series(f, &c, x)
144}
145// ANCHOR_END: mathieu_cem
146
147/// The odd Mathieu function `se_m(x, q)`, `m ≥ 1`, and its derivative (SciPy's `mathieu_sem`;
148/// `x` in degrees).
149pub fn mathieu_sem(m: usize, q: f64, x_deg: f64) -> (f64, f64) {
150    if m == 0 {
151        return (0.0, 0.0);
152    }
153    let x = x_deg.to_radians();
154    if q < 0.0 {
155        // se_{2n+1}(x, −q) = (−1)ⁿ ce_{2n+1}(π/2 − x, q); se_{2n+2}(x, −q) = (−1)ⁿ se_{2n+2}(π/2 − x, q).
156        let n = if m % 2 == 1 { (m - 1) / 2 } else { (m - 2) / 2 };
157        let sign = if n % 2 == 0 { 1.0 } else { -1.0 };
158        let (y, dy) = if m % 2 == 1 { mathieu_cem(m, -q, 90.0 - x_deg) } else { mathieu_sem(m, -q, 90.0 - x_deg) };
159        return (sign * y, -sign * dy);
160    }
161    let f = Family::of(m, true);
162    let (_, c) = solve(f, m, q);
163    series(f, &c, x)
164}
165
166/// `J_n` and `C_n` (`J` or `Y`) of integer order, any sign, with derivatives.
167fn bessel(kind: usize, n: i64, x: f64) -> (f64, f64) {
168    let val = |n: i64| -> f64 {
169        let (j, y) = bessel_jy_integer(n.unsigned_abs() as i32, x);
170        let v = if kind == 1 { j } else { y };
171        if n < 0 && n % 2 != 0 { -v } else { v }
172    };
173    (val(n), 0.5 * (val(n - 1) - val(n + 1)))
174}
175
176// ANCHOR: modified
177/// The modified (radial) Mathieu functions of the first (`kind = 1`) and second (`kind = 2`)
178/// kind by Bessel-function product series (DLMF 28.24): with `u₁ = √q e^{−z}`, `u₂ = √q e^{z}`,
179/// e.g. `Mc_{2n}^{(j)}(z) = Σ_k (−1)^{k+n} A_{2k}/A_{2s} [J_{k−s}(u₁) C_{k+s}(u₂) + J_{k+s}(u₁) C_{k−s}(u₂)] / ε_s`,
180/// where `s` is the index of the largest coefficient (for accuracy), `ε₀ = 2`, `ε_s = 1`
181/// otherwise, and `C = J` or `Y`. Returns the value and the derivative in `z`; `q > 0`.
182fn modified(m: usize, q: f64, z: f64, kind: usize, sine: bool) -> (f64, f64) {
183    if q <= 0.0 || (sine && m == 0) {
184        return (f64::NAN, f64::NAN);
185    }
186    let direct = modified_direct(m, q, z, kind, sine);
187    if direct.0.is_finite() && direct.1.is_finite() { direct } else { modified_scaled(m, q, z, kind, sine) }
188}
189
190/// The product series with the Bessel functions evaluated directly: fast, and exact to rounding
191/// until the high-order functions overflow or underflow (a product of an underflowed `J` and an
192/// overflowed `Y` is NaN), which happens beyond about `q = 2·10⁴`.
193fn modified_direct(m: usize, q: f64, z: f64, kind: usize, sine: bool) -> (f64, f64) {
194    let f = Family::of(m, sine);
195    let (_, c) = solve(f, m, q);
196    let h = q.sqrt();
197    let (u1, u2) = (h * (-z).exp(), h * z.exp());
198    let s = (0..c.len()).max_by(|&a, &b| c[a].abs().total_cmp(&c[b].abs())).unwrap();
199    // Offsets: Mc_{2n}: (k−s, k+s); Mc_{2n+1}, Ms_{2n+1}: (k−s, k+s+1); Ms_{2n+2}: (k−s, k+s+2).
200    let off = match f {
201        Family::CeEven => 0,
202        Family::CeOdd | Family::SeOdd => 1,
203        Family::SeEven => 2,
204    };
205    let minus = sine;
206    let n = f.index(m) as i64;
207    let (mut val, mut der) = (0.0, 0.0);
208    for (k, ck) in c.iter().enumerate() {
209        let k = k as i64;
210        let sk = s as i64;
211        let sign = if (k + n) % 2 == 0 { 1.0 } else { -1.0 };
212        let w = sign * ck / c[s];
213        let (j1a, dj1a) = bessel(1, k - sk, u1);
214        let (c2a, dc2a) = bessel(kind, k + sk + off, u2);
215        let (j1b, dj1b) = bessel(1, k + sk + off, u1);
216        let (c2b, dc2b) = bessel(kind, k - sk, u2);
217        let pm = if minus { -1.0 } else { 1.0 };
218        val += w * (j1a * c2a + pm * j1b * c2b);
219        // d/dz: J(u₁)' brings −u₁, C(u₂)' brings +u₂.
220        der += w * ((-u1 * dj1a) * c2a + j1a * (u2 * dc2a) + pm * ((-u1 * dj1b) * c2b + j1b * (u2 * dc2b)));
221    }
222    let eps = if f == Family::CeEven && s == 0 { 2.0 } else { 1.0 };
223    (val / eps, der / eps)
224}
225// ANCHOR_END: modified
226
227/// `ln|J_n(x)|` and the sign of `J_n(x)` for `n = 0..=nmax`, `x > 0`, by Miller's backward recurrence
228/// with rescaling, so that orders for which `J_n` underflows are still represented.
229fn j_table(x: f64, nmax: usize) -> Vec<(f64, f64)> {
230    const BIG: f64 = 1e200;
231    let start = nmax.max(x.ceil() as usize) + 60 + (x.sqrt() as usize) * 4;
232    let mut val = vec![0.0f64; start + 2];
233    let mut shift = vec![0i32; start + 2];
234    let mut sh = 0i32;
235    val[start] = 1e-200;
236    for n in (1..=start).rev() {
237        let mut v = 2.0 * n as f64 / x * val[n] - val[n + 1];
238        shift[n - 1] = sh;
239        if v.abs() > BIG {
240            // Rescale the two newest values; older (higher-order) ones keep their shift count.
241            val[n] /= BIG;
242            val[n - 1] = v / BIG;
243            sh += 1;
244            shift[n - 1] = sh;
245            shift[n] = sh;
246            v = val[n - 1];
247        }
248        val[n - 1] = v;
249    }
250    let lnb = BIG.ln();
251    // ln of u_n = |val_n| S^{shift_n}, and the normalisation J_0 + 2 Σ J_{2k} = 1.
252    let ln_u = |n: usize| if val[n] == 0.0 { f64::NEG_INFINITY } else { val[n].abs().ln() + shift[n] as f64 * lnb };
253    let top = (0..=start).map(&ln_u).fold(f64::NEG_INFINITY, f64::max);
254    let mut sum = 0.0;
255    for n in (0..=start).step_by(2) {
256        let t = (ln_u(n) - top).exp() * val[n].signum();
257        sum += if n == 0 { t } else { 2.0 * t };
258    }
259    let ln_norm = top + sum.abs().ln();
260    (0..=nmax).map(|n| (val[n].signum() * sum.signum(), ln_u(n) - ln_norm)).collect()
261}
262
263/// `ln|Y_n(x)|` and the sign for `n = 0..=nmax` by the (stable) forward recurrence, rescaled.
264fn y_table(x: f64, nmax: usize) -> Vec<(f64, f64)> {
265    let (_, y0) = bessel_jy_integer(0, x);
266    let (_, y1) = bessel_jy_integer(1, x);
267    let mut out = Vec::with_capacity(nmax + 1);
268    let (mut a, mut b, mut ln_scale) = (y0, y1, 0.0f64);
269    out.push((a.signum(), a.abs().ln()));
270    if nmax >= 1 {
271        out.push((b.signum(), b.abs().ln()));
272    }
273    for n in 1..nmax {
274        let c = 2.0 * n as f64 / x * b - a;
275        a = b;
276        b = c;
277        if b.abs() > 1e200 {
278            a /= 1e200;
279            b /= 1e200;
280            ln_scale += 1e200f64.ln();
281        }
282        out.push((b.signum(), b.abs().ln() + ln_scale));
283    }
284    out
285}
286
287/// A signed logarithm times another: `s₁ s₂ e^{l₁ + l₂}`.
288fn lprod(a: (f64, f64), b: (f64, f64)) -> f64 {
289    if a.1 == f64::NEG_INFINITY || b.1 == f64::NEG_INFINITY {
290        0.0
291    } else {
292        a.0 * b.0 * (a.1 + b.1).exp()
293    }
294}
295
296/// The same series as [`modified_direct`] with the Bessel functions held as signs and logarithms,
297/// so that no product of a tiny and a huge factor is ever formed in floating point as `0 · ∞`.
298/// Used where the direct evaluation is not finite.
299fn modified_scaled(m: usize, q: f64, z: f64, kind: usize, sine: bool) -> (f64, f64) {
300    let f = Family::of(m, sine);
301    let (_, c) = solve(f, m, q);
302    let h = q.sqrt();
303    let (u1, u2) = (h * (-z).exp(), h * z.exp());
304    let s = (0..c.len()).max_by(|&a, &b| c[a].abs().total_cmp(&c[b].abs())).unwrap();
305    let off = match f {
306        Family::CeEven => 0,
307        Family::CeOdd | Family::SeOdd => 1,
308        Family::SeEven => 2,
309    } as i64;
310    let nmax = c.len() + s + off as usize + 3;
311    let jt = j_table(u1, nmax);
312    let ct = if kind == 1 { j_table(u2, nmax) } else { y_table(u2, nmax) };
313    // The table value at an integer order of any sign: J_{−n} = (−1)^n J_n, and likewise for Y.
314    let at = |t: &[(f64, f64)], n: i64| {
315        let (sg, l) = t[n.unsigned_abs() as usize];
316        (if n < 0 && n % 2 != 0 { -sg } else { sg }, l)
317    };
318    let minus = sine;
319    let n0 = f.index(m) as i64;
320    let sk = s as i64;
321    let (mut val, mut der) = (0.0, 0.0);
322    for (k, ck) in c.iter().enumerate() {
323        let k = k as i64;
324        let sign = if (k + n0) % 2 == 0 { 1.0 } else { -1.0 };
325        let w = sign * ck / c[s];
326        let pm = if minus { -1.0 } else { 1.0 };
327        let (oa, ob) = (k - sk, k + sk + off);
328        // J(u₁) of order oa with C(u₂) of order ob, and J(u₁) of order ob with C(u₂) of order oa.
329        let (j_a, c_b, j_b, c_a) = (at(&jt, oa), at(&ct, ob), at(&jt, ob), at(&ct, oa));
330        val += w * (lprod(j_a, c_b) + pm * lprod(j_b, c_a));
331        // Derivatives: f'(n) = (f(n−1) − f(n+1))/2; J(u₁)' brings −u₁, C(u₂)' brings +u₂.
332        let dprod_j_c = |jn: i64, cn: i64| -> f64 {
333            // (−u₁ J'_jn(u₁)) C_cn(u₂) + J_jn(u₁) (u₂ C'_cn(u₂))
334            let first = -u1 * 0.5 * (lprod(at(&jt, jn - 1), at(&ct, cn)) - lprod(at(&jt, jn + 1), at(&ct, cn)));
335            let second = u2 * 0.5 * (lprod(at(&jt, jn), at(&ct, cn - 1)) - lprod(at(&jt, jn), at(&ct, cn + 1)));
336            first + second
337        };
338        der += w * (dprod_j_c(oa, ob) + pm * dprod_j_c(ob, oa));
339    }
340    let eps = if f == Family::CeEven && s == 0 { 2.0 } else { 1.0 };
341    (val / eps, der / eps)
342}
343
344/// `Mc_m^{(1)}(z, q)` and its derivative (SciPy's `mathieu_modcem1`).
345pub fn mathieu_modcem1(m: usize, q: f64, z: f64) -> (f64, f64) {
346    modified(m, q, z, 1, false)
347}
348
349/// `Mc_m^{(2)}(z, q)` and its derivative (SciPy's `mathieu_modcem2`).
350pub fn mathieu_modcem2(m: usize, q: f64, z: f64) -> (f64, f64) {
351    modified(m, q, z, 2, false)
352}
353
354/// `Ms_m^{(1)}(z, q)` and its derivative, `m ≥ 1` (SciPy's `mathieu_modsem1`).
355pub fn mathieu_modsem1(m: usize, q: f64, z: f64) -> (f64, f64) {
356    modified(m, q, z, 1, true)
357}
358
359/// `Ms_m^{(2)}(z, q)` and its derivative, `m ≥ 1` (SciPy's `mathieu_modsem2`).
360pub fn mathieu_modsem2(m: usize, q: f64, z: f64) -> (f64, f64) {
361    modified(m, q, z, 2, true)
362}
363
364#[cfg(test)]
365mod tests {
366    use super::*;
367
368    #[test]
369    fn small_q_limits_and_symmetries() {
370        // a_m(0) = b_m(0) = m², ce_m(x, 0) = cos mx (ce₀ = 1/√2).
371        for m in 1..5 {
372            assert!((mathieu_a(m, 0.0) - (m * m) as f64).abs() < 1e-12 && (mathieu_b(m, 0.0) - (m * m) as f64).abs() < 1e-12);
373        }
374        assert!((mathieu_cem(0, 0.0, 33.0).0 - 0.5f64.sqrt()).abs() < 1e-14);
375        assert!((mathieu_cem(3, 0.0, 33.0).0 - (99.0f64).to_radians().cos()).abs() < 1e-14);
376        // Known value: a₀(1) = −0.4551386041…
377        assert!((mathieu_a(0, 1.0) + 0.455_138_604_107_414_7).abs() < 1e-12);
378        // a_{2n+1}(−q) = b_{2n+1}(q).
379        assert!((mathieu_a(3, -2.5) - mathieu_b(3, 2.5)).abs() < 1e-12);
380        // The Wronskian of the modified functions: Mc⁽¹⁾ Mc⁽²⁾' − Mc⁽¹⁾' Mc⁽²⁾ = 2/π.
381        let (j, dj) = mathieu_modcem1(2, 3.0, 0.7);
382        let (y, dy) = mathieu_modcem2(2, 3.0, 0.7);
383        assert!((j * dy - dj * y - 2.0 / std::f64::consts::PI).abs() < 1e-10);
384    }
385
386    /// Where the direct product series is finite, the scaled evaluation (signs and logarithms of the
387    /// Bessel functions) gives the same numbers; beyond `q = 2·10⁴`, where the direct one gives NaN,
388    /// the scaled one keeps the Wronskian at 2/π.
389    #[test]
390    fn scaled_evaluation_agrees_and_extends_the_range() {
391        for &(m, q, z, sine) in &[(0usize, 5.0f64, 0.7f64, false), (2, 30.0, 1.1, false), (3, 100.0, 0.4, true), (1, 500.0, 0.9, true), (5, 2000.0, 1.3, false)] {
392            for kind in [1usize, 2] {
393                let (a, b) = (modified_direct(m, q, z, kind, sine), modified_scaled(m, q, z, kind, sine));
394                assert!((a.0 - b.0).abs() <= 1e-9 * (1.0 + a.0.abs()) && (a.1 - b.1).abs() <= 1e-9 * (1.0 + a.1.abs()), "m={m} q={q} z={z} kind={kind}: {a:?} vs {b:?}");
395            }
396        }
397        for q in [2.5e4, 1e5] {
398            for z in [0.3, 1.2] {
399                for (g1, g2, mm) in [(mathieu_modcem1 as fn(usize, f64, f64) -> (f64, f64), mathieu_modcem2 as fn(usize, f64, f64) -> (f64, f64), 0usize), (mathieu_modcem1, mathieu_modcem2, 3), (mathieu_modsem1, mathieu_modsem2, 2)] {
400                    let ((y1, d1), (y2, d2)) = (g1(mm, q, z), g2(mm, q, z));
401                    let w = y1 * d2 - d1 * y2;
402                    assert!((w - 2.0 / std::f64::consts::PI).abs() < 1e-7, "q = {q}, m = {mm}, z = {z}: {w}");
403                }
404            }
405        }
406    }
407
408    /// The Wronskian of the first and second kind is 2/π for every order, argument and `q`: a test
409    /// of the radial functions that does not need a reference (an error in either kind's
410    /// coefficients, or an admixture of the first kind in the second, changes it).
411    #[test]
412    fn modified_functions_satisfy_the_wronskian_at_large_q() {
413        for q in [10.0, 100.0, 1000.0, 10000.0] {
414            for m in [0usize, 1, 2, 5, 10] {
415                // At q = 10⁴ and z = 2 the Bessel functions of high order in the product series
416                // overflow and the result is NaN, so that case is left out.
417                for z in if q > 5000.0 { vec![0.2, 1.0] } else { vec![0.2, 1.0, 2.0] } {
418                    for (g1, g2, mm) in [(mathieu_modcem1 as fn(usize, f64, f64) -> (f64, f64), mathieu_modcem2 as fn(usize, f64, f64) -> (f64, f64), m), (mathieu_modsem1, mathieu_modsem2, m.max(1))] {
419                        let ((y1, d1), (y2, d2)) = (g1(mm, q, z), g2(mm, q, z));
420                        let w = y1 * d2 - d1 * y2;
421                        assert!((w - 2.0 / std::f64::consts::PI).abs() < 1e-9, "q = {q}, m = {mm}, z = {z}: {w}");
422                    }
423                }
424            }
425        }
426    }
427}