Table of Contents

Div

One can divide a matrix by a number, but also a number by a matrix or a matrix by a matrix. A matrix divided by a number is done element wise. A number divided by a matrix yields the matrix inverse and a matrix divided by a matrix yields the product of the first matrix times the matrix inverse of the second matrix.

Example M / c

Input

Example.Quanty
A = Matrix.New({{1,2},{3,4}})
B = A / 2
print(B)

Result

{ {  0.5    ,  1      } ,
  {  1.5    ,  2      } }

Example c / M

Input

Example.Quanty
A = Matrix.New({{1,2},{3,4}})
B = 2 / A
print(B)

Result

{ { -4      ,  2      } ,
  {  3      , -1      } }

and

Input

Example.Quanty
A = Matrix.New({{1,2},{3,4}})
B = 2 / A
print(B * A)

Result

{ {  2      ,  0      } ,
  {  0      ,  2      } }

Example M1 / M2

Input

Example.Quanty
A = Matrix.New({{1,2},{3,4}})
B = Matrix.New({{5,6},{7,8}})
C = B / A
print(C)

Result

{ { -1      ,  2      } ,
  { -2      ,  3      } }

Table of contents