Skip to content

Commit 5fa7c42

Browse files
author
Release Manager
committed
sagemathgh-40741: Fix-40738: Fix ExteriorAlgebra multiplication to preserve symbolic coefficients Fixes sagemath#40738 **Problem:** When multiplying elements of an `ExteriorAlgebra` over the Symbolic Ring (`SR`), symbolic coefficients were being dropped in certain cases, such as in the product `(x*a)*(y*b)`. **Solution:** This PR corrects the multiplication logic in `ExteriorAlgebraElement._mul_` by: 1. Defining `R = self.base_ring()` at the start of the method. 2. Explicitly coercing the coefficients to the base ring (`R(cl) * R(cr)`) before they are multiplied. This ensures that symbolic multiplication is handled correctly, preserving all coefficients as expected. --- ### ### Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created a new test for this change. - [ ] I have updated the documentation and checked the documentation preview. ### ### Hourglass - [ ] List all open PRs that this PR logically depends on. URL: sagemath#40741 Reported by: Hetarth Jodha Reviewer(s): Chenxin Zhong, Hetarth Jodha
2 parents 646af84 + e5bfd44 commit 5fa7c42

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/sage/algebras/clifford_algebra_element.pyx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,17 @@ cdef class ExteriorAlgebraElement(CliffordAlgebraElement):
442442
4*a*b*c*d + 4*a*b*c + 4*a*b*d + 4*a*c*d + 4*b*c*d
443443
+ 2*a*b + 2*a*c + 2*a*d + 2*b*c + 2*b*d + 2*c*d
444444
+ 2*a + 2*b + 2*c + 2*d + 1
445+
446+
sage: from sage.all import ExteriorAlgebra, SR, var
447+
sage: L.<a, b> = ExteriorAlgebra(SR)
448+
sage: x, y = var('x y')
449+
sage: x * (y * b)
450+
x*y*b
451+
sage: (x * a) * (y * b)
452+
x*y*a*b
445453
"""
446454
cdef Parent P = self._parent
455+
cdef R = P.base_ring()
447456
zero = P._base.zero()
448457
cdef dict d
449458
cdef ExteriorAlgebraElement rhs = <ExteriorAlgebraElement> other
@@ -514,7 +523,7 @@ cdef class ExteriorAlgebraElement(CliffordAlgebraElement):
514523
if tot_cross % 2:
515524
cr = -cr
516525

517-
val = d.get(t, zero) + cl * cr
526+
val = d.get(t, zero) + R(cl) * R(cr)
518527
if not val:
519528
del d[t]
520529
else:

0 commit comments

Comments
 (0)