DOTLEFTDIVIDE Element-wise Left-Division Operator
Section: Mathematical Operators
Usage
Divides two numerical arrays (elementwise) - gets its name from the fact that the divisor is on the left. 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
division of b
by a
. 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 division of the scalar with 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 dot-left-divide 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 dot-left-divide operator. First, a straight-forward usage of the.\\
operator. The first example
is straightforward:
--> 3 .\ 8 ans = 2.6667
We can also divide complex arguments:
--> a = 3 + 4*i a = 3.0000 + 4.0000i --> b = 5 + 8*i b = 5.0000 + 8.0000i --> c = b .\ a c = 0.5281 - 0.0449i
We can also demonstrate the three forms of the dot-left-divide operator. First 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 = 2.0000 1.5000 2.0000 1.7500
Then the scalar versions
--> c = a .\ 3 c = 3.0000 1.5000 1.0000 0.7500 --> c = 3 .\ a c = 0.3333 0.6667 1.0000 1.3333