M2 icon indicating copy to clipboard operation
M2 copied to clipboard

Add scalar division methods

Open d-torrance opened this issue 1 year ago • 6 comments

I was using M2 to double-check some computations while grading calculus homework and was surprised to get the following error:

i1 : vector {1, 2, 3} / 4
stdio:1:17:(3): error: no method for binary operator / applied to objects:
                              3
            | 1 | (of class ZZ )
            | 2 |
            | 3 |
      /     4 (of class ZZ)

We add scalar division methods for vectors and matrices by numbers and ring elements. So afterward:

i1 : vector {1, 2, 3} / 4

o1 = | 1/4 |
     | 1/2 |
     | 3/4 |

       3
o1 : QQ

d-torrance avatar Oct 01 '24 15:10 d-torrance