## MINUS Subtraction Operator

Section: Mathematical Operators

### Usage

Subtracts two numerical arrays (elementwise). There are two forms for its use, both with the same general syntax:

      y = a - b

where `a` and `b` are `n`-dimensional arrays of numerical type. In the first case, the two arguments are the same size, in which case, the output `y` is the same size as the inputs, and is the element-wise difference of `a` and `b`. In the second case, either `a` or `b` is a scalar, in which case `y` is the same size as the larger argument, and is the difference of the scalar to each element of the other argument. The rules for manipulating types has changed in FreeMat 4.0. See `typerules` for more details.

### Function Internals

There are three formulae for the subtraction operator, depending on the sizes of the three arguments. In the most general case, in which the two arguments are the same size, the output is computed via:

If `a` is a scalar, then the output is computed via

On the other hand, if `b` is a scalar, then the output is computed via

### Examples

Here are some examples of using the subtraction operator. First, a straight-forward usage of the minus operator. The first example is straightforward:

    --> 3 - 8

    ans =
     -5

Next, we subtract a vector of values from a scalar:

    --> 3.1 - [2,4,5,6,7]

    ans =
        1.1000   -0.9000   -1.9000   -2.9000   -3.9000

With complex values

    --> a = 3 - 4*i

    a =
       3.0000 -  4.0000i

    --> b = a - 2

    b =
       1.0000 -  4.0000i

Finally, the element-wise version:

    --> a = [1,2;3,4]

    a =
     1 2
     3 4

    --> b = [2,3;6,7]

    b =
     2 3
     6 7

    --> c = a - b

    c =
     -1 -1
     -3 -3