# Documentation

### This is machine translation

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

# `Dom`::`IntegerMod`

Residue class rings modulo integers

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

## Syntax

### Domain Creation

`Dom::IntegerMod(`n`)`

### Element Creation

`Dom::IntegerMod(n)(`a`)`

## Description

### Domain Creation

`Dom::IntegerMod(n)` creates the residue class ring of integers modulo `n`.

`Dom::IntegerMod(n)` creates the integer residue class rings .

### Element Creation

`Dom::IntegerMod(n)(a)` creates the residue class of `a` modulo `n`.

## Superdomain

`Dom::BaseDomain`

## Categories

If `n` is prime, then `Cat::Field`, else `Cat::CommutativeRing`.

## Examples

### Example 1

We define the residue class ring of the integers ```mod 7```:

`Z7:= Dom::IntegerMod(7)`

Next, we create some elements:

`a:= Z7(1); b:= Z7(2); c:= Z7(3)`

We may use infix notation for arithmetical operations since the operators have been overloaded:

`a + b, a*b*c, 1/c, b/c/a/c`

`a` and `b` are squares while `c` is not:

`Z7::isSquare(a), Z7::isSquare(b), Z7::isSquare(c)`

Indeed, `c` is a generator of the group of units:

`Z7::order(a), Z7::order(b), Z7::order(c)`

## Parameters

 `n` Positive integer greater than 1 `a` Any integer or a rational number whose denominator is coprime to `n`

## Entries

 "characteristic" the characteristic of the residue class ring, `n` "one" the unit element, `1 mod n` "zero" the zero element, `0 mod n`

## Methods

expand all

#### Mathematical Methods

`_divide(element1, element2)`

`_invert(element)`

`_mult(element, …)`

`_negate(element)`

`_plus(element, …)`

`_power(element, power)`

`_subtract(element1, element2)`

Inherited from `Cat::Field`.

Inherited from `Cat::Field`.

Inherited from `Cat::Field`.

Inherited from `Cat::Field`.

Inherited from `Cat::Field`.

Inherited from `Cat::Field`.

Inherited from `Cat::Field`.

Inherited from `Cat::Field`.

Inherited from `Cat::Monoid`.

Inherited from `Cat::Field`.

Inherited from `Cat::Field`.

Inherited from `Cat::Field`.

`isSquare(element)`

`iszero(element)`

`ln(element, base)`

The result is `infinity` if `element` is not in the subgroup generated by `base`.

The result is `FAIL` if `base` is not a unit.

`order(element)`

The result is `FAIL` if `element` is not a unit.

#### Conversion Methods

`convert(number)`

The conversion fails if the denominator of `number` and the modulus `n` are not relatively prime.

`convert_to(element, d)`

`expr(element)`

#### Technical Methods

`print(element)`

`random()`

Inherited from `Cat::Field`.

Inherited from `Cat::Field`.