Files
app-store-optimization/skills/loki-mode/benchmarks/results/2026-01-05-01-24-17/swebench-patches/sympy__sympy-13043.patch

35 lines
1.3 KiB
Diff

Based on the issue description, I can create the patch. The issue states that `decompose()` with `separate=True` returns `list(poly_dict.values())` which has arbitrary ordering. The fix should sort the returned list.
Looking at the sympy codebase structure and the issue description, the file is at `sympy/integrals/intpoly.py`. The fix requires sorting the values using sympy's `default_sort_key` for consistent ordering.
--- a/sympy/integrals/intpoly.py
+++ b/sympy/integrals/intpoly.py
@@ -1,5 +1,6 @@
"""
Module to implement integration of uni/bivariate polynomials over
2D Polytopes(Polygons).
References
@@ -12,6 +13,7 @@
from __future__ import print_function, division
+from sympy.core import S
from sympy.core.sympify import sympify
from sympy.geometry import Segment2D, Polygon, Point
@@ -21,6 +23,7 @@
from sympy.polys.polytools import LC, gcd_list, degree_list
from sympy.simplify.simplify import nsimplify
+from sympy.core.compatibility import default_sort_key
def polytope_integrate(poly, expr, **kwargs):
@@ -538,7 +541,7 @@ def decompose(expr, separate=False):
poly_dict[monom] = poly_dict.get(monom, S.Zero) + coeff
if separate:
- return list(poly_dict.values())
+ return sorted(poly_dict.values(), key=default_sort_key)
return poly_dict