This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Property representing a residue class

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


assume(x, (rem, class, <sub_set>))
is(ex, (rem, class, <sub_set>))
testtype(ex, (rem, class, <sub_set>))


Type::Residue(rem, class) represents the integers n for which n - rem is divisible by class.

The call assume(x, Type::Residue(rem, class)) marks the identifier x as an integer divisible by class with remainder rem.

The call is(ex, Type::Residue(rem, class)) derives, whether the expression ex is an integer divisible by class with remainder rem (or this property can be derived).

This type represents a property that can be used in assume and is.

Type::Even and Type::Odd are objects created by Type::Residue.

The call testtype(obj, Type::Residue(rem, class)) checks, whether obj is an integer and is divisible by class with remainder rem. If the optional argument sub_set is given, testtype checks additionally testtype(obj, sub_set).


Example 1

Type::Residue can be used in testtype:

testtype(6, Type::Residue(2, 4)),
testtype(13, Type::Residue(1, 20))

Example 2

x is assumed to be divisible by 3 with remainder 1:

assume(x, Type::Residue(1, 3))

Which properties has x + 2 got?

getprop(x + 2)

x is an integer, but it may be odd or not:

is(x, Type::Integer), is(x, Type::Odd)

This example restricts possible values of x to odd integers:

assume(x, Type::Residue(1, 4));
is(x, Type::Odd),
is((-1)^x < 0)



An identifier or a mathematical expression containing identifiers


Remainder as integer number between 0 and class - 1; an integer larger than class - 1 will be divided by class and rem gets the remainder of this division


The divider as positive integer


A subset of the integers (e.g., Type::PosInt); otherwise Type::Integer is used


An arithmetical expression


Any MuPAD® object

Return Values

See assume, is and testtype

See Also

MuPAD Functions

Was this topic helpful?