-
Notifications
You must be signed in to change notification settings - Fork 6
FEAT: implement general Chew–Mandelstam function #480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
adressed by 733a192 |
7ba935b to
dd59569
Compare
dd59569 to
62af95b
Compare
ee552b2 to
33f9158
Compare
aaa4358 to
4f3bf42
Compare
| @unevaluated | ||
| class PhaseSpaceFactorPWave(sp.Expr): | ||
| r"""Phase space factor using `ChewMandelstamIntegral` for :math:`L=1`. | ||
| This `PhaseSpaceFactor` uses the numerical dispersion integral implemented in | ||
| `ChewMandelstamIntegral`. As such, you have to be careful when lambdifying this | ||
| function and evaluating this over an array. In many cases, you want to wrap the | ||
| resulting lambdified numerical function with :func:`numpy.vectorize`. | ||
| >>> import numpy as np | ||
| >>> from ampform.dynamics.phasespace import PhaseSpaceFactorPWave | ||
| >>> s, m1, m2 = sp.symbols("s m_1 m_2") | ||
| >>> rho_expr = PhaseSpaceFactorPWave(s, m1, m2) | ||
| >>> rho_func = sp.lambdify((s, m1, m2), rho_expr.doit()) | ||
| >>> rho_func = np.vectorize(rho_func) | ||
| >>> s_values = np.linspace(0.1, 4.0, num=4) | ||
| >>> rho_func(s_values, 0.14, 0.98).real | ||
| array([-4.08315014e-07, 8.05561163e-03, 2.65015019e-01, 5.43083429e-01]) | ||
| """ | ||
|
|
||
| s: Any | ||
| m1: Any | ||
| m2: Any | ||
| name: str | None = argument(default=None, sympify=False) | ||
|
|
||
| def evaluate(self) -> sp.Expr: | ||
| s, m1, m2 = self.args | ||
| chew_mandelstam = ChewMandelstamIntegral(s, m1, m2, L=1, epsilon=1e-5) | ||
| return -sp.I * chew_mandelstam | ||
|
|
||
| def _latex_repr_(self, printer: LatexPrinter, *args) -> str: | ||
| s_symbol = self.args[0] | ||
| s_latex = printer._print(s_symbol) | ||
| subscript = _indices_to_subscript(determine_indices(s_symbol)) | ||
| name = R"\rho^\mathrm{CM}_1" + subscript if self.name is None else self.name | ||
| return Rf"{name}\left({s_latex}\right)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a check whether a wrapped dispersion integral works, plus a bit of documentation with regard to vectorisation. We have to find a solution for the fact though that the PhaseSpaceFactorProtocol only allows for the keyword arguments s, m1, and m2.

labtask for Poe the Poet policy#543jupyterlab-quickopeninjupyterdependency group policy#544BreakupMomentumand related classes toampform.kinematics.phasespaceTip
Preview here:
https://ampform--480.org.readthedocs.build/480/usage/dynamics/analytic-continuation.html#dispersion-integral