Coupled channel Riemann sheets#

Hide code cell content

# @title
import os
import warnings
from typing import Any

import matplotlib.pyplot as plt
import numpy as np
import plotly.graph_objects as go
import plotly.io as pio
import sympy as sp
from ampform.io import aslatex
from ampform.kinematics.phasespace import Kallen
from ampform.sympy import unevaluated
from IPython.display import Math, display
from ipywidgets import widgets as w
from matplotlib_inline.backend_inline import set_matplotlib_formats
from plotly.colors import DEFAULT_PLOTLY_COLORS
from plotly.subplots import make_subplots

set_matplotlib_formats("svg")
warnings.filterwarnings("ignore")
pio.renderers.default = "plotly_mimetype+notebook_connected"

Expression definitions#

Hide code cell source

# @title
@unevaluated(real=False)
class PhaseSpaceFactor(sp.Expr):
    s: Any
    m1: Any
    m2: Any
    _latex_repr_ = R"\rho_{{{m1}, {m2}}}\left({s}\right)"

    def evaluate(self) -> sp.Expr:
        s, m1, m2 = self.args
        return sp.sqrt((s - ((m1 + m2) ** 2)) * (s - (m1 - m2) ** 2) / s**2)


s, m1, m2 = sp.symbols("s m1 m2")
rho_expr = PhaseSpaceFactor(s, m1, m2)
Math(aslatex({rho_expr: rho_expr.doit(deep=False)}))
\[\begin{split}\displaystyle \begin{aligned} \rho_{m_{1}, m_{2}}\left(s\right) \;&=\; \sqrt{\frac{\left(s - \left(m_{1} - m_{2}\right)^{2}\right) \left(s - \left(m_{1} + m_{2}\right)^{2}\right)}{s^{2}}} \\ \end{aligned}\end{split}\]

Hide code cell source

# @title
@unevaluated(real=False)
class PhaseSpaceFactorKallen(sp.Expr):
    s: Any
    m1: Any
    m2: Any
    _latex_repr_ = R"\rho_{{{m1}, {m2}}}\left({s}\right)"

    def evaluate(self) -> sp.Expr:
        s, m1, m2 = self.args
        return 2 * BreakupMomentum(s, m1, m2) / sp.sqrt(s)


@unevaluated(real=False)
class PhaseSpaceCM(sp.Expr):
    s: Any
    m1: Any
    m2: Any
    _latex_repr_ = R"\rho^\mathrm{{CM}}_{{{m1},{m2}}}\left({s}\right)"

    def evaluate(self) -> sp.Expr:
        s, m1, m2 = self.args
        return -16 * sp.pi * sp.I * ChewMandelstam(s, m1, m2)


@unevaluated(real=False)
class ChewMandelstam(sp.Expr):
    s: Any
    m1: Any
    m2: Any
    _latex_repr_ = R"\Sigma\left({s}\right)"

    def evaluate(self) -> sp.Expr:
        s, m1, m2 = self.args
        q = BreakupMomentum(s, m1, m2)
        return (
            1
            / (16 * sp.pi**2)
            * (
                (2 * q / sp.sqrt(s))
                * sp.log((m1**2 + m2**2 - s + 2 * sp.sqrt(s) * q) / (2 * m1 * m2))
                - (m1**2 - m2**2) * (1 / s - 1 / (m1 + m2) ** 2) * sp.log(m1 / m2)
            )
        )


@unevaluated(real=False)
class BreakupMomentum(sp.Expr):
    s: Any
    m1: Any
    m2: Any
    _latex_repr_ = R"q\left({s}\right)"

    def evaluate(self) -> sp.Expr:
        s, m1, m2 = self.args
        return sp.sqrt(Kallen(s, m1**2, m2**2)) / (2 * sp.sqrt(s))


s, m1, m2 = sp.symbols("s m1 m2")
rho_expr_kallen = PhaseSpaceFactorKallen(s, m1, m2)
rho_cm_expr = PhaseSpaceCM(s, m1, m2)
cm_expr = ChewMandelstam(s, m1, m2)
q_expr = BreakupMomentum(s, m1, m2)
kallen = Kallen(*sp.symbols("x:z"))
Math(
    aslatex({
        e: e.doit(deep=False)
        for e in [rho_expr_kallen, rho_cm_expr, cm_expr, q_expr, kallen]
    })
)
\[\begin{split}\displaystyle \begin{aligned} \rho_{m_{1}, m_{2}}\left(s\right) \;&=\; \frac{2 q\left(s\right)}{\sqrt{s}} \\ \rho^\mathrm{CM}_{m_{1},m_{2}}\left(s\right) \;&=\; - 16 i \pi \Sigma\left(s\right) \\ \Sigma\left(s\right) \;&=\; \frac{- \left(m_{1}^{2} - m_{2}^{2}\right) \left(- \frac{1}{\left(m_{1} + m_{2}\right)^{2}} + \frac{1}{s}\right) \log{\left(\frac{m_{1}}{m_{2}} \right)} + \frac{2 \log{\left(\frac{m_{1}^{2} + m_{2}^{2} + 2 \sqrt{s} q\left(s\right) - s}{2 m_{1} m_{2}} \right)} q\left(s\right)}{\sqrt{s}}}{16 \pi^{2}} \\ q\left(s\right) \;&=\; \frac{\sqrt{\lambda\left(s, m_{1}^{2}, m_{2}^{2}\right)}}{2 \sqrt{s}} \\ \lambda\left(x, y, z\right) \;&=\; x^{2} - 2 x y - 2 x z + y^{2} - 2 y z + z^{2} \\ \end{aligned}\end{split}\]

Riemann sheet I#

Matrix definition#

Hide code cell source

# @title
class DiagonalMatrix(sp.DiagonalMatrix):
    def _latex(self, printer, *args):
        return printer._print(self.args[0])


n = 2
I = sp.Identity(n)
K = sp.MatrixSymbol("K", n, n)
CM = DiagonalMatrix(sp.MatrixSymbol(R"\rho^\Sigma", n, n))
Math(aslatex({CM: CM.as_explicit()}))
\[\begin{split}\displaystyle \begin{aligned} \rho^{\Sigma} \;&=\; \left[\begin{matrix}{\rho^{\Sigma}}_{0,0} & 0\\0 & {\rho^{\Sigma}}_{1,1}\end{matrix}\right] \\ \end{aligned}\end{split}\]
T_I = (I - sp.I * K * CM).inv() * K
T_I
\[\displaystyle \left(\mathbb{I} + - i K \rho^{\Sigma}\right)^{-1} K\]
T_I_explicit = T_I.as_explicit()
T_I_explicit[0, 0].simplify(doit=False)
\[\displaystyle \frac{\left(i {K}_{1,1} {\rho^{\Sigma}}_{1,1} - 1\right) {K}_{0,0} - i {K}_{0,1} {K}_{1,0} {\rho^{\Sigma}}_{1,1}}{{K}_{0,0} {K}_{1,1} {\rho^{\Sigma}}_{0,0} {\rho^{\Sigma}}_{1,1} + i {K}_{0,0} {\rho^{\Sigma}}_{0,0} - {K}_{0,1} {K}_{1,0} {\rho^{\Sigma}}_{0,0} {\rho^{\Sigma}}_{1,1} + i {K}_{1,1} {\rho^{\Sigma}}_{1,1} - 1}\]

Parametrization#

Hide code cell content

# @title
s = sp.Symbol("s")
ma1 = sp.Symbol("m_{a1}")
mb1 = sp.Symbol("m_{b1}")
ma2 = sp.Symbol("m_{a2}")
mb2 = sp.Symbol("m_{b2}")
m0 = sp.Symbol("m0")
w0 = sp.Symbol("Gamma0")
g1 = sp.Symbol(R"g^{0}_1")
g2 = sp.Symbol(R"g^{0}_2")
symbols = sp.Tuple(s, ma1, mb1, ma2, mb2, m0, g1, g2)

Hide code cell source

# @title
k_expr_00 = (g1 * g1 * m0) / (s - m0**2)
k_expr_10 = (g1 * g2 * m0) / (s - m0**2)
k_expr_11 = (g2 * g2 * m0) / (s - m0**2)
cm_expressions = {
    K[0, 0]: k_expr_00,
    K[1, 1]: k_expr_11,
    K[0, 1]: k_expr_10,
    K[1, 0]: k_expr_10,
    CM[0, 0]: -PhaseSpaceCM(s, ma1, mb1),
    CM[1, 1]: -PhaseSpaceCM(s, ma2, mb2),
}
Math(aslatex(cm_expressions))
\[\begin{split}\displaystyle \begin{aligned} {K}_{0,0} \;&=\; \frac{\left(g^{0}_1\right)^{2} m_{0}}{- m_{0}^{2} + s} \\ {K}_{1,1} \;&=\; \frac{\left(g^{0}_2\right)^{2} m_{0}}{- m_{0}^{2} + s} \\ {K}_{0,1} \;&=\; \frac{g^{0}_1 g^{0}_2 m_{0}}{- m_{0}^{2} + s} \\ {K}_{1,0} \;&=\; \frac{g^{0}_1 g^{0}_2 m_{0}}{- m_{0}^{2} + s} \\ {\rho^{\Sigma}}_{0,0} \;&=\; - \rho^\mathrm{CM}_{m_{a1},m_{b1}}\left(s\right) \\ {\rho^{\Sigma}}_{1,1} \;&=\; - \rho^\mathrm{CM}_{m_{a2},m_{b2}}\left(s\right) \\ \end{aligned}\end{split}\]
T_I_cm_expr = T_I_explicit.xreplace(cm_expressions)
T_I_cm_expr[0, 0].simplify(doit=False)
\[\displaystyle \frac{\left(g^{0}_1\right)^{2} m_{0}}{i \left(g^{0}_1\right)^{2} m_{0} \rho^\mathrm{CM}_{m_{a1},m_{b1}}\left(s\right) + i \left(g^{0}_2\right)^{2} m_{0} \rho^\mathrm{CM}_{m_{a2},m_{b2}}\left(s\right) - m_{0}^{2} + s}\]

Sheets II, III, and IV#

In the case of two channels, there are four Riemann sheets. The first sheet (Sheet I) is physical and three unphysical ones. The physical sheet is calculated using the analytic solution of the Chew-Mandelstam function.

\[\begin{split}\begin{aligned} \operatorname{Disc}_{\mathrm{I,II}} T_K^{-1} &= 2 i\left[\begin{array}{rr}\rho_1 & 0 \\ 0 & 0 \end{array}\right], \\ \operatorname{Disc}_{\mathrm{I,III}} T_K^{-1} &= 2 i\left[\begin{array}{rr}\rho_1 & 0 \\ 0 & \rho_2 \end{array}\right], \\ \operatorname{Disc}_{\mathrm{I,IV}} T_K^{-1} &= 2 i\left[\begin{array}{rr}0 & 0 \\ 0& \rho_2 \end{array}\right]. \end{aligned}\end{split}\]

Depending on the centre-of-mass energy, different Riemann sheets connect smoothly to the physical one. Therefore, two cases are studied: one where the resonance mass is above the threshold of the second and first channel, and another where the resonance mass is between the threshold of the first and second channel.

Hide code cell source

# @title
rho = DiagonalMatrix(sp.MatrixSymbol("rho", n, n))
Math(aslatex({rho: rho.as_explicit()}))
\[\begin{split}\displaystyle \begin{aligned} \rho \;&=\; \left[\begin{matrix}{\rho}_{0,0} & 0\\0 & {\rho}_{1,1}\end{matrix}\right] \\ \end{aligned}\end{split}\]
T_II = (T_I.inv() + 2 * sp.I * rho).inv()
T_III = (T_I.inv() + 2 * sp.I * rho).inv()
T_IV = (-T_I.inv() - 2 * sp.I * rho).inv()
Math(aslatex([T_II, T_III, T_IV]))
\[\begin{split}\displaystyle \begin{array}{c} \left(2 i \rho + K^{-1} \left(\mathbb{I} + - i K \rho^{\Sigma}\right)\right)^{-1} \\ \left(2 i \rho + K^{-1} \left(\mathbb{I} + - i K \rho^{\Sigma}\right)\right)^{-1} \\ \left(- 2 i \rho - K^{-1} \left(\mathbb{I} + - i K \rho^{\Sigma}\right)\right)^{-1} \\ \end{array}\end{split}\]
T_II_explicit = T_II.as_explicit()
T_II_explicit[0, 0].simplify(doit=False)
\[\displaystyle \frac{- i {K}_{0,0} {K}_{1,1} {\rho^{\Sigma}}_{1,1} + 2 i {K}_{0,0} {K}_{1,1} {\rho}_{1,1} + {K}_{0,0} + i {K}_{0,1} {K}_{1,0} {\rho^{\Sigma}}_{1,1} - 2 i {K}_{0,1} {K}_{1,0} {\rho}_{1,1}}{- {K}_{0,0} {K}_{1,1} {\rho^{\Sigma}}_{0,0} {\rho^{\Sigma}}_{1,1} + 2 {K}_{0,0} {K}_{1,1} {\rho^{\Sigma}}_{0,0} {\rho}_{1,1} + 2 {K}_{0,0} {K}_{1,1} {\rho^{\Sigma}}_{1,1} {\rho}_{0,0} - 4 {K}_{0,0} {K}_{1,1} {\rho}_{0,0} {\rho}_{1,1} - i {K}_{0,0} {\rho^{\Sigma}}_{0,0} + 2 i {K}_{0,0} {\rho}_{0,0} + {K}_{0,1} {K}_{1,0} {\rho^{\Sigma}}_{0,0} {\rho^{\Sigma}}_{1,1} - 2 {K}_{0,1} {K}_{1,0} {\rho^{\Sigma}}_{0,0} {\rho}_{1,1} - 2 {K}_{0,1} {K}_{1,0} {\rho^{\Sigma}}_{1,1} {\rho}_{0,0} + 4 {K}_{0,1} {K}_{1,0} {\rho}_{0,0} {\rho}_{1,1} - i {K}_{1,1} {\rho^{\Sigma}}_{1,1} + 2 i {K}_{1,1} {\rho}_{1,1} + 1}\]
T_III_explicit = T_III.as_explicit()
T_III_explicit[0, 0].simplify(doit=False)
\[\displaystyle \frac{- i {K}_{0,0} {K}_{1,1} {\rho^{\Sigma}}_{1,1} + 2 i {K}_{0,0} {K}_{1,1} {\rho}_{1,1} + {K}_{0,0} + i {K}_{0,1} {K}_{1,0} {\rho^{\Sigma}}_{1,1} - 2 i {K}_{0,1} {K}_{1,0} {\rho}_{1,1}}{- {K}_{0,0} {K}_{1,1} {\rho^{\Sigma}}_{0,0} {\rho^{\Sigma}}_{1,1} + 2 {K}_{0,0} {K}_{1,1} {\rho^{\Sigma}}_{0,0} {\rho}_{1,1} + 2 {K}_{0,0} {K}_{1,1} {\rho^{\Sigma}}_{1,1} {\rho}_{0,0} - 4 {K}_{0,0} {K}_{1,1} {\rho}_{0,0} {\rho}_{1,1} - i {K}_{0,0} {\rho^{\Sigma}}_{0,0} + 2 i {K}_{0,0} {\rho}_{0,0} + {K}_{0,1} {K}_{1,0} {\rho^{\Sigma}}_{0,0} {\rho^{\Sigma}}_{1,1} - 2 {K}_{0,1} {K}_{1,0} {\rho^{\Sigma}}_{0,0} {\rho}_{1,1} - 2 {K}_{0,1} {K}_{1,0} {\rho^{\Sigma}}_{1,1} {\rho}_{0,0} + 4 {K}_{0,1} {K}_{1,0} {\rho}_{0,0} {\rho}_{1,1} - i {K}_{1,1} {\rho^{\Sigma}}_{1,1} + 2 i {K}_{1,1} {\rho}_{1,1} + 1}\]
T_IV_explicit = T_IV.as_explicit()
T_IV_explicit[0, 0].simplify(doit=False)
\[\displaystyle \frac{i {K}_{0,0} {K}_{1,1} {\rho^{\Sigma}}_{1,1} - 2 i {K}_{0,0} {K}_{1,1} {\rho}_{1,1} - {K}_{0,0} - i {K}_{0,1} {K}_{1,0} {\rho^{\Sigma}}_{1,1} + 2 i {K}_{0,1} {K}_{1,0} {\rho}_{1,1}}{- {K}_{0,0} {K}_{1,1} {\rho^{\Sigma}}_{0,0} {\rho^{\Sigma}}_{1,1} + 2 {K}_{0,0} {K}_{1,1} {\rho^{\Sigma}}_{0,0} {\rho}_{1,1} + 2 {K}_{0,0} {K}_{1,1} {\rho^{\Sigma}}_{1,1} {\rho}_{0,0} - 4 {K}_{0,0} {K}_{1,1} {\rho}_{0,0} {\rho}_{1,1} - i {K}_{0,0} {\rho^{\Sigma}}_{0,0} + 2 i {K}_{0,0} {\rho}_{0,0} + {K}_{0,1} {K}_{1,0} {\rho^{\Sigma}}_{0,0} {\rho^{\Sigma}}_{1,1} - 2 {K}_{0,1} {K}_{1,0} {\rho^{\Sigma}}_{0,0} {\rho}_{1,1} - 2 {K}_{0,1} {K}_{1,0} {\rho^{\Sigma}}_{1,1} {\rho}_{0,0} + 4 {K}_{0,1} {K}_{1,0} {\rho}_{0,0} {\rho}_{1,1} - i {K}_{1,1} {\rho^{\Sigma}}_{1,1} + 2 i {K}_{1,1} {\rho}_{1,1} + 1}\]
rho_expressions_II = {
    **cm_expressions,
    rho[0, 0]: PhaseSpaceFactor(s, ma1, mb1),
    rho[1, 1]: 0,
}
rho_expressions_III = {
    **cm_expressions,
    rho[0, 0]: PhaseSpaceFactor(s, ma1, mb1),
    rho[1, 1]: PhaseSpaceFactor(s, ma2, mb2),
}
rho_expressions_IV = {
    **cm_expressions,
    rho[0, 0]: 0,
    rho[1, 1]: PhaseSpaceFactor(s, ma2, mb2),
}
# @title
T_II_rho_expr = T_II_explicit.xreplace(rho_expressions_II)
T_III_rho_expr = T_III_explicit.xreplace(rho_expressions_III)
T_IV_rho_expr = T_IV_explicit.xreplace(rho_expressions_IV)
T_II_rho_expr[0, 0].simplify(doit=False)
\[\displaystyle \frac{\left(g^{0}_1\right)^{2} m_{0}}{i \left(g^{0}_1\right)^{2} m_{0} \rho^\mathrm{CM}_{m_{a1},m_{b1}}\left(s\right) + 2 i \left(g^{0}_1\right)^{2} m_{0} \rho_{m_{a1}, m_{b1}}\left(s\right) + i \left(g^{0}_2\right)^{2} m_{0} \rho^\mathrm{CM}_{m_{a2},m_{b2}}\left(s\right) - m_{0}^{2} + s}\]
T_III_rho_expr[0, 0].simplify(doit=False)
\[\displaystyle \frac{\left(g^{0}_1\right)^{2} m_{0}}{i \left(g^{0}_1\right)^{2} m_{0} \rho^\mathrm{CM}_{m_{a1},m_{b1}}\left(s\right) + 2 i \left(g^{0}_1\right)^{2} m_{0} \rho_{m_{a1}, m_{b1}}\left(s\right) + i \left(g^{0}_2\right)^{2} m_{0} \rho^\mathrm{CM}_{m_{a2},m_{b2}}\left(s\right) + 2 i \left(g^{0}_2\right)^{2} m_{0} \rho_{m_{a2}, m_{b2}}\left(s\right) - m_{0}^{2} + s}\]

Visualizations#

Lineshapes (real axis)#

Hide code cell source

# @title
from itertools import cycle

T_I_func = sp.lambdify(symbols, T_I_cm_expr[0, 0].doit())
T_II_func = sp.lambdify(symbols, T_II_rho_expr[0, 0].doit())
T_III_func = sp.lambdify(symbols, T_III_rho_expr[0, 0].doit())
T_IV_func = sp.lambdify(symbols, T_IV_rho_expr[0, 0].doit())
parameter_defaults1 = {
    ma1: 1.0,
    mb1: 1.5,
    ma2: 1.5,
    mb2: 2.0,
    m0: 4.0,
    g1: 0.7,
    g2: 0.7,
}
parameter_defaults2 = {
    **parameter_defaults1,
    m0: 3.0,
}
args1 = eval(str(symbols[1:].xreplace(parameter_defaults1)))
args2 = eval(str(symbols[1:].xreplace(parameter_defaults2)))

epsilon = 1e-5
x = np.linspace(0, 8, num=300)
y = np.linspace(epsilon, 1, num=100)
X, Y = np.meshgrid(x, y)
Zn = X - Y * 1j
Zp = X + Y * 1j

T1n_res1 = T_I_func(Zn**2, *args1)
T1p_res1 = T_I_func(Zp**2, *args1)

T2n_res1 = T_II_func(Zn**2, *args1)
T2p_res1 = T_II_func(Zp**2, *args1)

T3n_res1 = T_III_func(Zn**2, *args1)
T3p_res1 = T_III_func(Zp**2, *args1)

T4n_res1 = T_IV_func(Zn**2, *args1)
T4p_res1 = T_IV_func(Zp**2, *args1)

T1n_res2 = T_I_func(Zn**2, *args2)
T1p_res2 = T_I_func(Zp**2, *args2)

T2n_res2 = T_II_func(Zn**2, *args2)
T2p_res2 = T_II_func(Zp**2, *args2)

T3n_res2 = T_III_func(Zn**2, *args2)
T3p_res2 = T_III_func(Zp**2, *args2)

T4n_res2 = T_IV_func(Zn**2, *args2)
T4p_res2 = T_IV_func(Zp**2, *args2)

sheet_edges_res1 = {
    "I": (T1p_res1[0], T1n_res1[0]),
    "II": (T2p_res1[0], T2n_res1[0]),
    "III": (T3p_res1[0], T3n_res1[0]),
    "IV": (T4p_res1[0], T4n_res1[0]),
}


def drop_short_runs(mask: np.ndarray, min_length: int) -> np.ndarray:
    result = mask.copy()
    edges = np.flatnonzero(np.diff(np.r_[0, mask.astype(int), 0]))
    for start, stop in zip(edges[::2], edges[1::2], strict=True):
        if stop - start < min_length:
            result[start:stop] = False
    return result


def plot_matching_edges(
    axes, x, edges: dict, rtol=1e-3, atol=1e-3, min_length: int = 5
) -> list:
    # An edge segment at +i0 on sheet X and one at -i0 on sheet Y get the same color
    # where their values agree, so one can follow the line from one sheet to the
    # other. The +i0 edge is solid, the -i0 edge dashed, and unmatched parts gray.
    # Matches over fewer than min_length samples, such as near s=0 where all
    # amplitudes vanish, are coincidences and are ignored.
    colors = cycle(plt.rcParams["axes.prop_cycle"].by_key()["color"])
    handles = []
    unmatched = {
        (name, side): np.ones(x.shape, bool) for name in edges for side in "+-"
    }
    for upper, (T_upper, _) in edges.items():
        for lower, (_, T_lower) in edges.items():
            match = drop_short_runs(
                np.isclose(T_upper, T_lower, rtol=rtol, atol=atol), min_length
            )
            if not match.any():
                continue
            unmatched[upper, "+"] &= ~match
            unmatched[lower, "-"] &= ~match
            mask = match | np.r_[match[1:], False] | np.r_[False, match[:-1]]
            color = next(colors)
            label = Rf"$T_\mathrm{{{upper}}}(s+0i) = T_\mathrm{{{lower}}}(s-0i)$"
            ax_upper = axes[list(edges).index(upper)]
            ax_lower = axes[list(edges).index(lower)]
            ax_upper.plot(x, np.where(mask, T_upper.imag, np.nan), c=color, lw=2)
            ax_lower.plot(
                x, np.where(mask, T_lower.imag, np.nan), c=color, lw=2, ls="--"
            )
            handles.append(plt.Line2D([], [], c=color, lw=2, label=label))
    for (name, side), rest in unmatched.items():
        T_upper, T_lower = edges[name]
        T = T_upper if side == "+" else T_lower
        mask = rest & np.r_[rest[1:], True] & np.r_[True, rest[:-1]]
        ax = axes[list(edges).index(name)]
        ax.plot(
            x,
            np.where(mask, T.imag, np.nan),
            c="gray",
            lw=1,
            ls="-" if side == "+" else "--",
        )
    return handles


fig, axes = plt.subplots(figsize=(11, 6), ncols=4, sharey=True)
handles = plot_matching_edges(axes, x, sheet_edges_res1)
handles += [
    plt.Line2D([], [], c="black", ls="-", label=R"$s+0i$"),
    plt.Line2D([], [], c="black", ls="--", label=R"$s-0i$"),
    plt.Line2D([], [], c="gray", label="no match"),
]
for ax, name in zip(axes, sheet_edges_res1, strict=True):
    ax.set_title(Rf"$T_\mathrm{{{name}}}$")
    ax.set_xlabel(R"$\mathrm{Re}\,\sqrt{s}$")
    ax.set_ylim(-1, +1)
axes[0].set_ylabel(R"$\mathrm{Im}\,T(s)$ (a.u.)")
fig.legend(handles=handles, loc="lower center", ncols=3)
fig.tight_layout(rect=(0, 0.15, 1, 1))
plt.show()
_images/950835f09c065f8e476547ea0647cc8031cd96823a21b6d933fc42ae662bd433.svg

Complex plane (2D)#

It can be shown that if the resonance mass is above both thresholds the third sheet connects smoothly to the first sheet. If the resonance mass is above the first and below the second threshold the second sheet transitions smoothly into the first sheet.

Hide code cell source

# @title
fig, axes = plt.subplots(figsize=(12, 8), ncols=2, nrows=2, sharey=True)
ax1, ax2, ax3, ax4 = axes.flatten()

for ax in axes.flatten():
    ax.set_xlabel(R"$\mathrm{Re}\,\sqrt{s}$")
for ax in axes[:, 0]:
    ax.set_ylabel(R"$\mathrm{Im}\,\sqrt{s}$")

ax1.set_title("I and II")
ax2.set_title("I and III")
ax3.set_title("I and II")
ax4.set_title("I and III")

T_max = 2

style = dict(
    cmap=plt.cm.coolwarm,
    rasterized=True,
    vmin=-T_max,
    vmax=+T_max,
)
mesh = ax1.pcolormesh(X, Y, T1p_res1.imag, **style)
ax1.pcolormesh(X, -Y, T2n_res1.imag, **style)
ax2.pcolormesh(X, +Y, T1p_res1.imag, **style)
ax2.pcolormesh(X, -Y, T3n_res1.imag, **style)
ax3.pcolormesh(X, +Y, T1p_res2.imag, **style)
ax3.pcolormesh(X, -Y, T2n_res2.imag, **style)
ax4.pcolormesh(X, +Y, T1p_res2.imag, **style)
ax4.pcolormesh(X, -Y, T3n_res2.imag, **style)

s_thr1 = parameter_defaults1[ma1] + parameter_defaults1[mb1]
s_thr2 = parameter_defaults1[ma2] + parameter_defaults1[mb2]
linestyle = dict(ls="dotted", lw=1)
for ax in axes.flatten():
    ax.axhline(0, c="black", **linestyle)
    ax.axvline(s_thr1, c="C0", **linestyle, label=R"$\sqrt{s_\mathrm{thr1}}$")
    ax.axvline(s_thr2, c="C1", **linestyle, label=R"$\sqrt{s_\mathrm{thr2}}$")
linestyle = dict(c="r", ls="dotted", label=R"$m_\mathrm{res}$")
for ax in axes[0]:
    ax.axvline(parameter_defaults1[m0], **linestyle)
for ax in axes[1]:
    ax.axvline(parameter_defaults2[m0], **linestyle)
ax2.legend()

fig.text(0.5, 0.93, R"$s_{thr1}<s_{thr2}<m_{res}$", ha="center", fontsize=18)
fig.text(0.5, 0.46, R"$s_{thr1}<m_{res}<s_{thr2}$", ha="center", fontsize=18)
fig.subplots_adjust(wspace=1)
cax = fig.add_axes([0.92, 0.15, 0.02, 0.7])
cbar = fig.colorbar(mesh, cax=cax)
cbar.ax.set_title(R"$\mathrm{Im} T(s)$")

fig.tight_layout(rect=[0, 0.03, 0.9, 0.95])

fig.show()
_images/3a639d6e36ad5324cfb32e023459fe25fbce2827eabb0569ac4d429df6b01d1b.svg

Riemann sheets (3D)#

Hide code cell content

# @title
def sty(sheet_name: str) -> dict:
    sheet_color = sheet_colors[sheet_name]
    n_lines = 16
    return dict(
        cmin=-vmax,
        cmax=+vmax,
        colorscale=[[0, "rgb(0, 0, 0)"], [1, sheet_color]],
        contours=dict(
            x=dict(
                show=True,
                start=x.min(),
                end=x.max(),
                size=(x.max() - x.min()) / n_lines,
                color="black",
            ),
            y=dict(
                show=True,
                start=-y.max(),
                end=+y.max(),
                size=(y.max() - y.min()) / (n_lines // 2),
                color="black",
            ),
        ),
        name=sheet_name,
        opacity=0.4,
        showscale=False,
    )


vmax = 2.0
project = np.imag
sheet_colors = {
    "T1 (physical)": "blue",
    "T2 (unphysical)": "red",
    "T3 (unphysical)": "green",
    "T4 (unphysical)": "yellow",
}


def sheet_edges(
    x: np.ndarray,
    T_upper: np.ndarray,
    T_lower: np.ndarray,
    upper_color: str,
    lower_color: str,
    upper_name: str,
    lower_name: str,
    match_color: str = "magenta",
    sign: float = +1,
) -> list[go.Scatter3d]:
    # The edge at +i0 is solid and the edge at -i0 is dashed. Where both sheets have
    # the same complex value, one can pass from one sheet to the other, so both edges
    # get the same color there.
    match = np.isclose(T_upper, T_lower, rtol=1e-3, atol=1e-3)
    traces = []
    for T, color, dash, name in [
        (T_upper, upper_color, "solid", f"{upper_name} at +i0"),
        (T_lower, lower_color, "dash", f"{lower_name} at -i0"),
    ]:
        z = sign * project(T)
        for selection, c, label in [
            (match, match_color, f"{name} (sheets connect)"),
            (~match, color, name),
        ]:
            mask = (
                selection | np.r_[selection[1:], False] | np.r_[False, selection[:-1]]
            )
            traces.append(
                go.Scatter3d(
                    x=x,
                    y=np.zeros_like(x),
                    z=np.where(mask, z, np.nan),
                    line=dict(color=c, dash=dash, width=6),
                    mode="lines",
                    name=label,
                    showlegend=False,
                )
            )
    return traces

Hide code cell source

# @title
Sp_I_res1 = go.Surface(x=X, y=+Y, z=T1p_res1.imag, **sty("T1 (physical)"))
Sn_II_res1 = go.Surface(x=X, y=-Y, z=T2n_res1.imag, **sty("T2 (unphysical)"))
Sn_III_res1 = go.Surface(x=X, y=-Y, z=T3n_res1.imag, **sty("T3 (unphysical)"))

Sp_I_res2 = go.Surface(x=X, y=+Y, z=T1p_res2.imag, **sty("T1 (physical)"))
Sn_II_res2 = go.Surface(x=X, y=-Y, z=T2n_res2.imag, **sty("T2 (unphysical)"))
Sn_III_res2 = go.Surface(x=X, y=-Y, z=T3n_res2.imag, **sty("T3 (unphysical)"))

thr1_filter = x >= s_thr1
thr2_filter = x >= s_thr2

line_kwargs = dict(
    line=dict(color="yellow", width=8),
    mode="lines",
    name="Lineshape",
)
lineshape_res1_z = project(T1p_res1[0])
lineshape_res2_z = project(T1p_res2[0])
lineshape_res1 = go.Scatter3d(
    x=x[thr1_filter],
    y=np.zeros(thr1_filter.shape),
    z=lineshape_res1_z[thr1_filter],
    **line_kwargs,
)
lineshape_res2 = go.Scatter3d(
    x=x[thr1_filter],
    y=np.zeros(thr1_filter.shape),
    z=lineshape_res2_z[thr1_filter],
    **line_kwargs,
)

point_kwargs = dict(
    hoverinfo="text",
    marker=dict(color=DEFAULT_PLOTLY_COLORS[:2], size=6),
    mode="markers",
    name="Thresholds",
    text=["threshold 1", "threshold 2"],
)
thr_points_res1 = go.Scatter3d(
    x=[s_thr1, s_thr2],
    y=[0, 0],
    z=[lineshape_res1_z[thr1_filter][0], lineshape_res1_z[thr2_filter][0]],
    **point_kwargs,
)
thr_points_res2 = go.Scatter3d(
    x=[s_thr1, s_thr2],
    y=[0, 0],
    z=[lineshape_res2_z[thr1_filter][0], lineshape_res2_z[thr2_filter][0]],
    **point_kwargs,
)

plotly_fig = make_subplots(
    rows=2,
    cols=2,
    horizontal_spacing=0.01,
    vertical_spacing=0.05,
    specs=[
        [{"type": "surface"}, {"type": "surface"}],
        [{"type": "surface"}, {"type": "surface"}],
    ],
    subplot_titles=[
        "thr₁ < thr₂ < mᵣ",
        "thr₁ < mᵣ < thr₂",
    ],
)

# thr₁ < thr₂ < mᵣ
selector = dict(col=1, row=1)
plotly_fig.add_trace(Sp_I_res1, **selector)
plotly_fig.add_trace(Sn_III_res1, **selector)
plotly_fig.add_trace(lineshape_res1, **selector)
for edge in sheet_edges(x, T1p_res1[0], T3n_res1[0], "blue", "green", "T1", "T3"):
    plotly_fig.add_trace(edge, **selector)
plotly_fig.add_trace(thr_points_res1, **selector)
selector = dict(col=1, row=2)
plotly_fig.add_trace(Sp_I_res1, **selector)
plotly_fig.add_trace(Sn_II_res1, **selector)
plotly_fig.add_trace(lineshape_res1, **selector)
for edge in sheet_edges(x, T1p_res1[0], T2n_res1[0], "blue", "red", "T1", "T2"):
    plotly_fig.add_trace(edge, **selector)
plotly_fig.add_trace(thr_points_res1, **selector)

# thr₁ < mᵣ < thr₂
selector = dict(col=2, row=1)
plotly_fig.add_trace(Sp_I_res2, **selector)
plotly_fig.add_trace(Sn_II_res2, **selector)
plotly_fig.add_trace(lineshape_res2, **selector)
for edge in sheet_edges(x, T1p_res2[0], T2n_res2[0], "blue", "red", "T1", "T2"):
    plotly_fig.add_trace(edge, **selector)
plotly_fig.add_trace(thr_points_res2, **selector)
selector = dict(col=2, row=2)
plotly_fig.add_trace(Sp_I_res2, **selector)
plotly_fig.add_trace(Sn_III_res2, **selector)
plotly_fig.add_trace(lineshape_res2, **selector)
for edge in sheet_edges(x, T1p_res2[0], T3n_res2[0], "blue", "green", "T1", "T3"):
    plotly_fig.add_trace(edge, **selector)
plotly_fig.add_trace(thr_points_res2, **selector)

plotly_fig.update_layout(
    hoverlabel_namelength=-1,
    height=600,
    margin=dict(l=0, r=0, t=20, b=0),
    showlegend=False,
)

plotly_fig.update_scenes(
    camera_center=dict(z=-0.1),
    camera_eye=dict(x=1.4, y=1.4, z=1.4),
    xaxis_range=(2.0, 5.0),
    xaxis_title_text="Re √s",
    yaxis_title_text="Im √s",
    zaxis_title_text="Im T(s)",
    zaxis_range=[-vmax, +vmax],
)
plotly_fig.show()

Complex plane widget#

Hide code cell source

# @title
sliders = dict(
    g01=w.FloatSlider(
        description=R"$g^{0}_1$",
        value=0.5,
        min=-2,
        max=+2,
    ),
    g02=w.FloatSlider(
        description="$g^{0}_2$",
        value=0.5,
        min=-2,
        max=+2,
    ),
    m0=w.FloatSlider(
        description="$m_0$",
        value=4,
        min=0,
        max=+6,
    ),
    T_max=w.FloatSlider(
        description=R"$T_\mathrm{max}$",
        value=1.0,
        min=0.1,
        max=6.0,
        step=0.1,
    ),
)


fig, axes = plt.subplots(
    figsize=(10.2, 5.5),
    ncols=2,
    nrows=2,
    sharex=True,
    gridspec_kw={"height_ratios": [1, 2]},
)
fig.canvas.toolbar_visible = False
fig.canvas.header_visible = False
fig.canvas.footer_visible = False
ax1d1, ax1d2, ax2d1, ax2d2 = axes.flatten()

for ax in axes[1]:
    ax.set_xlabel(R"$\mathrm{Re}\,\sqrt{s}$")
ax1d1.set_ylabel("Intensity (a.u.)")
ax2d1.set_ylabel(R"$\mathrm{Im}\,s$")

ax1d1.set_title("I and II")
ax1d2.set_title("I and III")

R_color = "C4"
T1_color = "C0"
T2_color = "C3"
T3_color = "C2"


LINES = None
MESH = None
style = dict(
    cmap=plt.cm.coolwarm,
    rasterized=True,
)


def plot(m0, g01, g02, T_max):
    global LINES, MESH
    local_args = args1[:-3] + (m0, g01, g02)
    T1p_res1 = T_I_func(Zp**2, *local_args)
    T2n_res1 = T_II_func(Zn**2, *local_args)
    T3n_res1 = T_III_func(Zn**2, *local_args)
    T1y = np.abs(T1p_res1[0]) ** 2
    T2y = np.abs(T2n_res1[0]) ** 2
    T3y = np.abs(T3n_res1[0]) ** 2
    if MESH is None and LINES is None:
        LINES = [
            ax1d1.axvline(m0, c=R_color, ls="dashed"),
            ax1d2.axvline(m0, c=R_color, ls="dashed"),
            ax2d1.axvline(m0, c=R_color, ls="dashed", label=R"$m_\mathrm{res}$"),
            ax2d2.axvline(m0, c=R_color, ls="dashed", label=R"$m_\mathrm{res}$"),
            ax1d1.plot(x, T1y, c=T1_color, label=R"$\left|T_\mathrm{I}\right|^2$")[0],
            ax1d1.plot(
                x, T2y, c=T2_color, label=R"$\left|T_\mathrm{II}\right|^2$", ls="dotted"
            )[0],
            ax1d2.plot(x, T1y, c=T1_color, label=R"$\left|T_\mathrm{I}\right|^2$")[0],
            ax1d2.plot(
                x,
                T3y,
                c=T3_color,
                label=R"$\left|T_\mathrm{III}\right|^2$",
                ls="dotted",
            )[0],
        ]
        MESH = [
            ax2d1.pcolormesh(X, Y, T1p_res1.imag, **style),
            ax2d1.pcolormesh(X, -Y, T2n_res1.imag, **style),
            ax2d2.pcolormesh(X, +Y, T1p_res1.imag, **style),
            ax2d2.pcolormesh(X, -Y, T3n_res1.imag, **style),
        ]
    else:
        MESH[0].set_array(T1p_res1.imag)
        MESH[1].set_array(T2n_res1.imag)
        MESH[2].set_array(T1p_res1.imag)
        MESH[3].set_array(T3n_res1.imag)
        LINES[0].set_xdata(m0)
        LINES[1].set_xdata(m0)
        LINES[2].set_xdata(m0)
        LINES[3].set_xdata(m0)
        LINES[4].set_ydata(T1y)
        LINES[5].set_ydata(T2y)
        LINES[6].set_ydata(T1y)
        LINES[7].set_ydata(T3y)
    for mesh in MESH:
        mesh.set_clim(-T_max, +T_max)
    for ax in axes[0]:
        ax.set_ylim(0, max(T1y) * 1.05)
    fig.canvas.draw()


for ax in axes[:, 1]:
    ax.set_yticks([])
for ax in axes[1]:
    ax.axhline(0, c="black", ls="dotted", lw=1)
for ax in axes[0]:
    ax.axvline(s_thr1, c="C0", ls="dotted", lw=1)
    ax.axvline(s_thr2, c="C1", ls="dotted", lw=1)
for ax in axes[1]:
    ax.axvline(s_thr1, c="C0", label=R"$\sqrt{s_\mathrm{thr1}}$", ls="dotted", lw=1)
    ax.axvline(s_thr2, c="C1", label=R"$\sqrt{s_\mathrm{thr2}}$", ls="dotted", lw=1)
ax2d1.text(0.5, +0.7, R"$T_\mathrm{I}$", color=T1_color, size=20)
ax2d1.text(0.5, -0.75, R"$T_\mathrm{II}$", color=T2_color, size=20)
ax2d2.text(0.5, +0.7, R"$T_\mathrm{I}$", color=T1_color, size=20)
ax2d2.text(0.5, -0.75, R"$T_\mathrm{III}$", color=T3_color, size=20)

output = w.interactive_output(plot, controls=sliders)
UI = w.VBox(list(sliders.values()))
fig.tight_layout()
ax1d1.legend()
ax1d2.legend()
ax2d2.legend()
display(output, UI)