Contents Previous Next Subchapters Current Chapters-> positive negative addition coercion subtraction multiplication division equality ordered logicalOperator matrixMultiplication matrixDivision exponentiation transpose norm stringEquality stringOrdered sequence operationOrder Parent Chapters-> Omatrix6 expression subtraction Search Tools-> contents reference index search

Subtraction
 Syntax left value` - `right value See Also addition , multiplication , division

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

Tutorial

Subtracting Scalars
If you enter ```      1 - 2 ``` O-Matrix will respond ```      -1 ```
Subtracting Matrices
If you enter ```      x = {[1, 2, 3], [4, 5, 6]}      y = {[1, 1, 1], [1, 1, 1]}      x - y ``` O-Matrix will print ```      {      [ 0 , 1 , 2 ]      [ 3 , 4 , 5 ]      } ```
Subtracting Scalars from Matrices
If the left value is a matrix and the right value is a scalar, O-Matrix will subtract the scalar from each element of the matrix. Entering ```      x = {[1, 2, 3], [4, 5, 6]}      x - 1 ``` will result in ```      {      [ 0 , 1 , 2 ]      [ 3 , 4 , 5 ]      } ```
Subtracting Matrices from Scalars
If the left value is a scalar and the right value is a matrix, O-Matrix will subtract each element of the matrix from the scalar. Entering ```      x = {[1, 2, 3], [4, 5, 6]}      1 - x ``` will result in ```      {      [ 0 , -1 , -2 ]      [ -3 , -4 , -5 ]      } ```
Reference
If the value types do not agree, O-Matrix will coerce the values as detailed in the coercion table.