M2
M2 copied to clipboard
Add scalar division methods
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