|
40 | 40 | "source": [ |
41 | 41 | "import warnings\n", |
42 | 42 | "\n", |
| 43 | + "import jax.numpy as jnp\n", |
43 | 44 | "import matplotlib.pyplot as plt\n", |
44 | | - "import numpy as np\n", |
45 | 45 | "import sympy as sp\n", |
46 | 46 | "from IPython.display import Math\n", |
47 | 47 | "from matplotlib_inline.backend_inline import set_matplotlib_formats\n", |
|
166 | 166 | "cell_type": "markdown", |
167 | 167 | "metadata": {}, |
168 | 168 | "source": [ |
169 | | - "The general form of the Chew--Mandelstam dispersion integral is the following:" |
| 169 | + "The general form of the Chew--Mandelstam dispersion integral is the following:\n", |
| 170 | + "\n", |
| 171 | + ":::{margin}\n", |
| 172 | + "We set the {attr}`.ChewMandelstamIntegral.algorithm` to {func}`quadax.quadgk` for fast numerical evaluation over the complex plane. For higher precision close the the physical axis (at the cost of performance), choose {func}`quadax.romberg` instead. See also {doc}`integration-algorithms`.\n", |
| 173 | + "::::" |
170 | 174 | ] |
171 | 175 | }, |
172 | 176 | { |
|
176 | 180 | "outputs": [], |
177 | 181 | "source": [ |
178 | 182 | "s, m1, m2, L = sp.symbols(\"s, m1, m2, L\", nonnegative=True)\n", |
179 | | - "integral_expr = ChewMandelstamIntegral(s, m1, m2, L)\n", |
| 183 | + "integral_expr = ChewMandelstamIntegral(\n", |
| 184 | + " s, m1, m2, L, algorithm=\"quadax.quadgk\", configuration={\"order\": 61}\n", |
| 185 | + ")\n", |
180 | 186 | "integral_expr.doit(deep=False)" |
181 | 187 | ] |
182 | 188 | }, |
|
274 | 280 | "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. For the 2 channel one gets:\n", |
275 | 281 | "\n", |
276 | 282 | "$$\n", |
277 | | - "\\begin{eqnarray}\n", |
| 283 | + "\\begin{aligned}\n", |
278 | 284 | "\\operatorname{Disc}_{\\mathrm{I,II}} \\varSigma_\\ell(s)\n", |
279 | | - "&=& 2 i\\left[\\begin{array}{rr}\\rho_1 n_{\\ell,1}^2(s) & 0 \\\\ 0 & 0 \\end{array}\\right], \\\\\n", |
| 285 | + "\\; &= \\; 2 i\\begin{pmatrix}\\rho_1(s) \\, n_{\\ell,1}^2(s) & 0 \\\\ 0 & 0 \\end{pmatrix}, \\\\\n", |
280 | 286 | "\\operatorname{Disc}_{\\mathrm{I,III}} \\varSigma_\\ell(s)\n", |
281 | | - "&=& 2 i\\left[\\begin{array}{rr}\\rho_1 n_{\\ell,1}^2(s) & 0 \\\\ 0 & \\rho_2 n_{\\ell,2}^2(s) \\end{array}\\right], \\\\\n", |
| 287 | + "\\; &= \\; 2 i\\begin{pmatrix}\\rho_1(s) \\, n_{\\ell,1}^2(s) & 0 \\\\ 0 & \\rho_2(s) \\, n_{\\ell,2}^2(s) \\end{pmatrix}, \\\\\n", |
282 | 288 | "\\operatorname{Disc}_{\\mathrm{I,IV}} \\varSigma_\\ell(s)\n", |
283 | | - "&=& 2 i\\left[\\begin{array}{rr}0 & 0 \\\\ 0& \\rho_2 n_{\\ell,2}^2(s) \\end{array}\\right].\n", |
284 | | - "\\end{eqnarray}\n", |
| 289 | + "\\; &= \\; 2 i\\begin{pmatrix}0 & 0 \\\\ 0& \\rho_2(s) \\, n_{\\ell,2}^2(s) \\end{pmatrix}.\n", |
| 290 | + "\\end{aligned}\n", |
285 | 291 | "$$" |
286 | 292 | ] |
287 | 293 | }, |
|
431 | 437 | "integral_p_wave_func = sp.lambdify(\n", |
432 | 438 | " [s, m1, m2, integral_expr.epsilon],\n", |
433 | 439 | " integral_expr.subs(L, L_val).doit(),\n", |
| 440 | + " modules=\"jax\",\n", |
434 | 441 | ")" |
435 | 442 | ] |
436 | 443 | }, |
|
477 | 484 | }, |
478 | 485 | "outputs": [], |
479 | 486 | "source": [ |
480 | | - "x = np.linspace(0, 6, num=150)\n", |
481 | | - "y = np.linspace(1e-3, 1, num=40)\n", |
482 | | - "X, Y = np.meshgrid(x, y)\n", |
| 487 | + "x = jnp.linspace(0, 6, num=200)\n", |
| 488 | + "y = jnp.linspace(5e-3, 1, num=60)\n", |
| 489 | + "X, Y = jnp.meshgrid(x, y)\n", |
483 | 490 | "Zn = X - Y * 1j\n", |
484 | 491 | "Zp = X + Y * 1j" |
485 | 492 | ] |
|
581 | 588 | }, |
582 | 589 | "outputs": [], |
583 | 590 | "source": [ |
584 | | - "x = np.linspace(2.2, 8, num=100)\n", |
| 591 | + "x = jnp.linspace(2.2, 8, num=100)\n", |
585 | 592 | "ε_offset = 1e-2\n", |
586 | 593 | "cn = x - ε_offset * 1j\n", |
587 | 594 | "cp = x + ε_offset * 1j\n", |
|
619 | 626 | "plt.show()" |
620 | 627 | ] |
621 | 628 | }, |
622 | | - { |
623 | | - "cell_type": "markdown", |
624 | | - "metadata": {}, |
625 | | - "source": [ |
626 | | - ":::{caution}\n", |
627 | | - "The integral does not appear to be numerically stable (see [ComPWA/ampform#487](https://github.com/ComPWA/ampform/issues/487)), as a significant imaginary offset from the real axis ($\\epsilon = 10^{-2}i$) is required to get rid of the instability fluctuations.\n", |
628 | | - ":::" |
629 | | - ] |
630 | | - }, |
631 | 629 | { |
632 | 630 | "cell_type": "markdown", |
633 | 631 | "metadata": {}, |
|
655 | 653 | }, |
656 | 654 | "outputs": [], |
657 | 655 | "source": [ |
658 | | - "y = np.linspace(1e-8, 1, num=100)\n", |
| 656 | + "y = jnp.linspace(1e-4, 1, num=80)\n", |
659 | 657 | "for s_value in (3.1, 3.7):\n", |
660 | 658 | " Jn = s_value - y * 1j\n", |
661 | 659 | " Jp = s_value + y * 1j\n", |
|
0 commit comments