Contents Previous Next Subchapters

Element-By-Element Division
Syntax left value / right value
See Also matrix division , addition , subtraction , multiplication

Description
Element-by-element division of the left value by the right where the two values that are integer, real, double-precision, or complex. (One, but not both, of the values may be logical.)

Tutorial

Integer Division
If both values are integers, O-Matrix will drop the fractional parts of the resulting matrix. If you enter
     5 / 2
O-Matrix will respond
     2
If you enter
     -5 / 2
O-Matrix will respond
     -2

Floating Point Division
If one of the values is real, double-precision or complex, the result will contain the fractional part. If you enter
     5 / 2.
O-Matrix will respond
     2.5

Dividing Matrices
If you enter
     x = {[2, 4, 6], [8, 10, 12]}
     y = {[2, 2, 2], [2, 2, 2]}
     x / y
O-Matrix will print
     {
     [ 1 , 2 , 3 ]
     [ 4 , 5 , 6 ]
     }

Dividing Scalars by Matrices
If the left value is a scalar and the right value is a matrix, O-Matrix will divide the scalar by each element of the matrix. Entering
     x = {[1, 2, 3], [4, 5, 6]}
     60 / x
will result in
     {
     [ 60 , 30 , 20 ]
     [ 15 , 12 , 10 ]
     }

Dividing Matrices by Scalars
If the left value is a matrix and the right value is a scalar, O-Matrix will divide each element of the matrix by the scalar. Entering
     x = {[2, 4, 6], [8, 10, 12]}
     x / 2
will result in
     {
     [ 1 , 2 , 3 ]
     [ 4 , 5 , 6 ]
     }

Reference
If the value types do not agree, O-Matrix will coerce the values as detailed in the coercion table.