/

Division operator.

Syntax

expr_1/ expr_2

Operands

expr_1, expr_2
A pair of valid scalar, vector, or matrix expressions.

Example

Expression Result
5 / 2 2.5
{1, 2, 3} / (2 / 3) {1.5, 3, 4.5}
3 / {1, 2, 3} {3, 1.5, 1}
4 / { {1, 2}, {2, 4} } { {4, 2},{2, 1} }
{ {1, 2},{2, 4} } / 4 { {0.25,0.5}, {0.5, 1} }
{4, 5, 6} / {2, 1, 3} {2, 5, 2}

Comments

The division operator divides expr_1 by expr_2.

If expr_2 is a scalar, it must be nonzero. If expr_2 is a vector or matrix, each of its elements must be nonzero.

If expr_1 and expr_2 are scalars, the result is the quotient of the two scalars.

If a scalar is divided by a vector, the scalar is divided by each element of the vector. The result is a vector with the same number of elements as the original vector.

If a vector is divided by a scalar, each element of the vector is divided by the scalar. The result is a vector with the same number of elements as the original vector.

If a scalar is divided by a matrix, the scalar is divided by each element of the matrix. The result is a matrix with the same number of elements as the original matrix.

If a matrix is divided by a scalar, each element of the matrix is divided by the scalar. The result is a matrix with the same number of elements as the original matrix.

If expr_1 and expr_2 are vectors, the result is a vector containing the quotient of the corresponding elements from each vector. Both vectors must have the same number of elements. They must also both be row vectors or both be column vectors In either case, the result is a vector with the same number of elements as the two vectors.