Skip to content

Commit

Permalink
FIX: adjust simplification code for SymPy v1.13
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Aug 5, 2024
1 parent 1d68af5 commit 0d88b51
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
6 changes: 3 additions & 3 deletions docs/usage/dynamics/k-matrix.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -642,9 +642,9 @@
"outputs": [],
"source": [
"# reformulate terms\n",
"denominator, nominator = k_matrix.args\n",
"term1 = nominator.args[0] * denominator\n",
"term2 = nominator.args[1] * denominator\n",
"*rest, denominator, nominator = k_matrix.args\n",
"term1 = nominator.args[0] * denominator * sp.Mul(*rest)\n",
"term2 = nominator.args[1] * denominator * sp.Mul(*rest)\n",
"k_matrix = term1 + term2\n",
"k_matrix"
]
Expand Down
11 changes: 4 additions & 7 deletions tests/dynamics/test_kmatrix.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
from __future__ import annotations

import re
from typing import TYPE_CHECKING

import pytest
import sympy as sp

from ampform.dynamics.kmatrix import NonRelativisticKMatrix
from symplot import rename_symbols, substitute_indexed_symbols

if TYPE_CHECKING:
import sympy as sp


class TestNonRelativisticKMatrix:
@pytest.mark.parametrize(
Expand All @@ -35,9 +32,9 @@ def test_interference_single_channel(self):
expr = substitute_indexed_symbols(expr)
expr = _remove_residue_constants(expr)
expr = _rename_widths(expr)
denominator, nominator = expr.args
term1 = nominator.args[0] * denominator
term2 = nominator.args[1] * denominator
*rest, denominator, nominator = expr.args
term1 = nominator.args[0] * denominator * sp.Mul(*rest)
term2 = nominator.args[1] * denominator * sp.Mul(*rest)
assert str(term1 / term2) == R"m1*w1*(m2**2 - s)/(m2*w2*(m1**2 - s))"


Expand Down

0 comments on commit 0d88b51

Please sign in to comment.