Symbolic modulus after division

**In a future release, mod will no longer find the modulus for each
coefficient of a symbolic polynomial. Instead, mod(a,b) will return
an unevaluated symbolic expression if a is a polynomial and
b is a real number. To find the modulus for each coefficient of
the polynomial a, use [c,t] = coeffs(a);
sum(mod(c,b).*t).**

Find the modulus after division in case both the dividend and divisor are integers.

Find the modulus after division for these numbers.

[mod(sym(27), 4), mod(sym(27), -4), mod(sym(-27), 4), mod(sym(-27), -4)]

ans = [ 3, -1, 1, -3]

Find the modulus after division in case the dividend is a rational number, and divisor is an integer.

Find the modulus after division for these numbers.

[mod(sym(22/3), 5), mod(sym(1/2), 7), mod(sym(27/6), -11)]

ans = [ 7/3, 1/2, -13/2]

Find the modulus after division in case the
dividend is a polynomial expression, and divisor is an integer. If
the dividend is a polynomial expression, then `mod`

finds
the modulus for each coefficient.

Find the modulus after division for these polynomial expressions.

syms x mod(x^3 - 2*x + 999, 10)

ans = x^3 + 8*x + 9

mod(8*x^3 + 9*x^2 + 10*x + 11, 7)

ans = x^3 + 2*x^2 + 3*x + 4

For vectors and matrices, `mod`

finds
the modulus after division element-wise. Nonscalar arguments must
be the same size.

Find the modulus after division for the elements of these two matrices.

A = sym([27, 28; 29, 30]); B = sym([2, 3; 4, 5]); mod(A,B)

ans = [ 1, 1] [ 1, 0]

Find the modulus after division for the elements of matrix `A`

and
the value `9`

. Here, `mod`

expands `9`

into
the `2`

-by-`2`

matrix with all elements
equal to `9`

.

mod(A,9)

ans = [ 0, 1] [ 2, 3]

Calling

`mod`

for numbers that are not symbolic objects invokes the MATLAB^{®}`mod`

function.All nonscalar arguments must be the same size. If one input arguments is nonscalar, then

`mod`

expands the scalar into a vector or matrix of the same size as the nonscalar argument, with all elements equal to the corresponding scalar.