Contents Previous Next Subchapters

Element-By-Element Multiplication
Syntax left value % right value
See Also matrix multiplication , addition , subtraction , division

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

Tutorial

Multiplying Scalars
If you enter
     6 % 2
O-Matrix will respond
     12

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

Multiplying Scalars by Matrices
If one value is a scalar and the other is a matrix, O-Matrix will multiply the scalar by each element of the matrix. Entering
     x = {[1, 2, 3], [4, 5, 6]}
     x % 2
will result in
     {
     [ 2 , 4 , 6 ]
     [ 8 , 10 , 12 ]
     }

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