From 1b5dd63df3a9bb5c6a555d3735a8350bd43f1466 Mon Sep 17 00:00:00 2001 From: Vitor Shen <17490173+shenvitor@users.noreply.github.com> Date: Fri, 30 Aug 2024 17:11:13 +0200 Subject: [PATCH] first part of model implementation --- docs/lambda-k-pi/index.md | 2 +- docs/lambda-k-pi/manual-symbolic.ipynb | 257 +++++++++++++++++++++++++ docs/lambda-k-pi/manual.ipynb | 59 ------ 3 files changed, 258 insertions(+), 60 deletions(-) create mode 100644 docs/lambda-k-pi/manual-symbolic.ipynb delete mode 100644 docs/lambda-k-pi/manual.ipynb diff --git a/docs/lambda-k-pi/index.md b/docs/lambda-k-pi/index.md index 4195ed8..e0ee1b3 100644 --- a/docs/lambda-k-pi/index.md +++ b/docs/lambda-k-pi/index.md @@ -3,5 +3,5 @@ ```{toctree} ampform ampform-dpd -manual +manual-symbolic ``` diff --git a/docs/lambda-k-pi/manual-symbolic.ipynb b/docs/lambda-k-pi/manual-symbolic.ipynb new file mode 100644 index 0000000..b25c642 --- /dev/null +++ b/docs/lambda-k-pi/manual-symbolic.ipynb @@ -0,0 +1,257 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Amplitude model with `sympy`" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "In this notebook, we formulate the amplitude model for the $\\gamma p \\to K^+ \\pi^0 \\Lambda $ symbolically by adapting the model originally for the $\\gamma p \\to \\eta\\pi^0 p$ channel example as described in [Reaction and Models](reaction-model.md).\n", + "\n", + "The model we want to implement is" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "$$\n", + "\\begin{array}{rcl}\n", + "I &=& \\left|A^{12} + A^{23} + A^{31}\\right|^2 \\\\\n", + "A^{12} &=& \\frac{\\sum a_m Y_2^m (\\Omega_1)}{s_{12}-m^2_{K^{*+}_2}+im_{K^{*+}_2} \\Gamma_{K^{*+}_2}} \\\\\n", + "A^{23} &=& \\frac{\\sum b_m Y_1^m (\\Omega_2)}{s_{23}-m^2_{\\Sigma^*}+im_{\\Sigma^*} \\Gamma_{\\Sigma^*}} \\\\\n", + "A^{31} &=& \\frac{c_0}{s_{31}-m^2_{N^{*+}}+im_{N^{*+}} \\Gamma_{N^{*+}}} \\,,\n", + "\\end{array}\n", + "$$\n", + "\n", + "where $1=K^+$, $2=\\pi^0$, and $3=\\Lambda$." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "jupyter": { + "source_hidden": true + }, + "tags": [ + "hide-cell" + ] + }, + "outputs": [], + "source": [ + "from __future__ import annotations\n", + "\n", + "import logging\n", + "import os\n", + "import warnings\n", + "\n", + "import sympy as sp\n", + "\n", + "STATIC_PAGE = \"EXECUTE_NB\" in os.environ\n", + "\n", + "os.environ[\"TF_CPP_MIN_LOG_LEVEL\"] = \"3\"\n", + "logging.disable(logging.WARNING)\n", + "warnings.filterwarnings(\"ignore\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Model implementation" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "l_max = 2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### $A^{12}$" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "s12, m_Kstar2, Gamma_Kstar2, l12 = sp.symbols(r\"s_{12} m_{K^*_2} \\Gamma_{K^*_2} l_{12}\")\n", + "theta1, phi1 = sp.symbols(\"theta_1 phi_1\")\n", + "a = sp.IndexedBase(\"a\")\n", + "m = sp.symbols(\"m\", cls=sp.Idx)\n", + "A12 = sp.Sum(a[m] * sp.Ynm(l12, m, theta1, phi1), (m, -l12, l12)) / (\n", + " s12 - m_Kstar2**2 + sp.I * m_Kstar2 * Gamma_Kstar2\n", + ")\n", + "A12" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "A12_funcs = [\n", + " sp.lambdify(\n", + " [\n", + " s12,\n", + " *(a[j] for j in range(-l_max, l_max + 1)),\n", + " m_Kstar2,\n", + " Gamma_Kstar2,\n", + " theta1,\n", + " phi1,\n", + " ],\n", + " expr=A12.subs(l12, i).doit().expand(func=True),\n", + " )\n", + " for i in range(l_max + 1)\n", + "]\n", + "A12_funcs" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### $A^{23}$" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "s23, m_Sigma, Gamma_Sigma, l23 = sp.symbols(\n", + " r\"s_{23} m_{\\Sigma^{*+}} \\Gamma_{\\Sigma^{*+}} l_{23}\"\n", + ")\n", + "b = sp.IndexedBase(\"b\")\n", + "m = sp.symbols(\"m\", cls=sp.Idx)\n", + "theta2, phi2 = sp.symbols(\"theta_2 phi_2\")\n", + "A23 = sp.Sum(b[m] * sp.Ynm(l23, m, theta2, phi2), (m, -l23, l23)) / (\n", + " s23 - m_Sigma**2 + sp.I * m_Sigma * Gamma_Sigma\n", + ")\n", + "A23" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "A23_funcs = [\n", + " sp.lambdify(\n", + " [\n", + " s23,\n", + " *(b[j] for j in range(-l_max, l_max + 1)),\n", + " m_Sigma,\n", + " Gamma_Sigma,\n", + " theta2,\n", + " phi2,\n", + " ],\n", + " A23.subs(l23, i).doit().expand(func=True),\n", + " )\n", + " for i in range(l_max + 1)\n", + "]\n", + "A23_funcs" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### $A^{31}$" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "s31, m_Nstar, Gamma_Nstar = sp.symbols(r\"s_{31} m_{N^*} \\Gamma_{N^*}\")\n", + "c = sp.IndexedBase(\"c\")\n", + "theta3, phi3, l31 = sp.symbols(\"theta_3 phi_3 l_{31}\")\n", + "A31 = sp.Sum(c[m] * sp.Ynm(l31, m, theta3, phi3), (m, -l31, l31)) / (\n", + " s31 - m_Nstar**2 + sp.I * m_Nstar * Gamma_Nstar\n", + ")\n", + "A31" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "A31_funcs = [\n", + " sp.lambdify(\n", + " [\n", + " s31,\n", + " *(c[j] for j in range(-l_max, l_max + 1)),\n", + " m_Nstar,\n", + " Gamma_Nstar,\n", + " theta3,\n", + " phi3,\n", + " ],\n", + " A31.subs(l31, i).doit().expand(func=True),\n", + " )\n", + " for i in range(l_max + 1)\n", + "]\n", + "A31_funcs" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### $I = |A|^2 = |A^{12}+A^{23}+A^{31}|^2$" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "intensity_expr = sp.Abs(A12 + A23 + A31) ** 2\n", + "intensity_expr" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.5" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/docs/lambda-k-pi/manual.ipynb b/docs/lambda-k-pi/manual.ipynb deleted file mode 100644 index a89e8c3..0000000 --- a/docs/lambda-k-pi/manual.ipynb +++ /dev/null @@ -1,59 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Amplitude model with `sympy`" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "In this notebook, we formulate the amplitude model for the $\\gamma p \\to K^+ \\pi^0 \\Lambda $ symbolically by adapting the model originally for the $\\gamma p \\to \\eta\\pi^0 p$ channel example as described in [Reaction and Models](reaction-model.md).\n", - "\n", - "The model we want to implement is" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "$$\n", - "\\begin{array}{rcl}\n", - "I &=& \\left|A^{12} + A^{23} + A^{31}\\right|^2 \\\\\n", - "A^{12} &=& \\frac{\\sum a_m Y_2^m (\\Omega_1)}{s_{12}-m^2_{a_2}+im_{a_2} \\Gamma_{a_2}} \\\\\n", - "A^{23} &=& \\frac{\\sum b_m Y_1^m (\\Omega_2)}{s_{23}-m^2_{\\Delta^+}+im_{\\Delta^+} \\Gamma_{\\Delta^+}} \\\\\n", - "A^{31} &=& \\frac{c_0}{s_{31}-m^2_{N^*}+im_{N^*} \\Gamma_{N^*}} \\,,\n", - "\\end{array}\n", - "$$\n", - "\n", - "where $1=\\eta$, $2=\\pi^0$, and $3=p$.\n", - "\n", - "where $1=K^+$, $2=\\pi^0$, and $3=\\Lambda$." - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.12.5" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -}