Skip to content

Commit 647d329

Browse files
committed
sagemathgh-40738: Fix ExteriorAlgebra multiplication over SR
1 parent 4cdd703 commit 647d329

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/sage/algebras/clifford_algebra_element.pyx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,21 @@ 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+
TESTS::
447+
448+
Check that multiplication with symbolic coefficients is handled correctly (gh-40738)::
449+
450+
sage: from sage.all import ExteriorAlgebra, SR, var
451+
sage: L.<a, b> = ExteriorAlgebra(SR)
452+
sage: x, y = var('x y')
453+
sage: x * (y * b)
454+
x*y*b
455+
sage: (x * a) * (y * b)
456+
x*y*a*b
445457
"""
446458
cdef Parent P = self._parent
459+
cdef R = P.base_ring()
447460
zero = P._base.zero()
448461
cdef dict d
449462
cdef ExteriorAlgebraElement rhs = <ExteriorAlgebraElement> other
@@ -514,7 +527,7 @@ cdef class ExteriorAlgebraElement(CliffordAlgebraElement):
514527
if tot_cross % 2:
515528
cr = -cr
516529

517-
val = d.get(t, zero) + cl * cr
530+
val = d.get(t, zero) + R(cl) * R(cr)
518531
if not val:
519532
del d[t]
520533
else:

0 commit comments

Comments
 (0)