Matrix multiplication order reversed when elements are from Weyl algebra
- Dominant language
- Macaulay2
- Stars
- 435
- Forks
- 297
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 11
Description
I am running the code below in Macaulay2.
```
load "Dmodules.m2"
R = QQ[x_11,x_12,x_21,x_22]
D = makeWeylAlgebra R
a = x_11*dx_21 + x_12*dx_22
b = x_22*dx_22 + 2
a*b
matrix{{a}} * matrix{{b}}
```
The code is very straightforward of course. I am multiplying two elements of the Weyl algebra. The output when I do a*b is
x_11x_22∂x_21∂x_22+x_12x_22∂x_22∂x_22+2x_11∂x_21+3x_12∂x_22,
whereas matrix{{a}} * matrix{{b}} gives
x_11x_22∂x_21∂x_22+x_12x_22∂x_22∂x_22+2x_11∂x_21+2x_12∂x_22.
Clearly, I am misunderstanding something because I expect the output of a*b when I do matrix{{a}}*matrix{{b}}, because that is what I get when I do it by hand. Should I be using some different syntax here?
`matrix{{b}} * matrix{{a}}`
gives x_11x_22∂x_21∂x_22+x_12x_22∂x_22∂x_22+2x_11∂x_21+3x_12∂x_22. This is consistent with other things I have observed. For instance, if I take a ideal I with elements in the weyl algebra, and compute a free resolution,
```
x = res I
x.dd_1 * x.dd_2
```
then I get 0. But when I do
`transpose(x.dd_2) * transpose(x.dd_1)`
I don't get 0. So somehow, when multiplying matrices with elements from a Weyl algebra, the order is reversed?
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the Weyl algebra examples using a*b and matrix{{a}} * matrix{{b}}, then compare the matrix product with the element product and the resolution identities shown in the issue. Determine which multiplication order is intended; done means both examples produce the expected algebraic result consistently.
Written by the indexing model from the issue text.
Assessment
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100