Hauptübersicht

Klasse Mod

Klasse Mod
Elemente der Restklassenringe Z[m]
Mod(n, m) liefert Element n des Restklassenrings Z[m]
Die Objekte können mit arithmetischen Operatoren verknüpft werden.
Einige Operationen sind nur definiert, wenn Z[m] ein Körper ist (<==> m ist Primzahl)
Siehe auch Mod

Übersicht:

Konstruktor

Mod (n, m)

Operatoren

OperatorBedeutung
abs(x)
x + yAddition
x / y
x == y with other Mod object or 0
int(x)
x * y a * b à a.__mul__(b), if a is of type Mod b.__rmul__(a), otherwise
x != y with other Mod object or 0
-x -a à a.__neg__()
str(x)
x - y a - b à a.__sub__(b), if a is of type Mod b.__rsub__(a), otherwise
x / y a / b à a.__div__(b), if a is of type Mod b.__rdiv__(a), otherwise

Objektmethoden

MethodeBedeutung
copy ()unabhängige Kopie von A
inverse ()Multiplikatives Inverses
operators ()Nur zur Dokumentation

Konstruktor

Mod

Konstruktor

Aufruf: Mod(n, m)


Operatoren

abs(x)

Absolute value

Aufruf: abs(x)

Beschreibung:


x + y

a.__add__(b)

Aufruf: x + y

Beschreibung:
Addition
Also operator notation: a + b
Instead of a = a + b you can write a += b.


Aufruf:


x / y

Aufruf: x / y


x == y

Test for equality (operator ==)

Aufruf: x == y

Beschreibung:
with other Mod object or 0


int(x)

Aufruf: int(x)


x * y

Multiplication:

Aufruf: x * y

Beschreibung:
a * b à a.__mul__(b), if a is of type Mod b.__rmul__(a), otherwise


x != y

Test for unequality (Operator !=)

Aufruf: x != y

Beschreibung:
with other Mod object or 0


-x

Unary Operator -

Aufruf: -x

Beschreibung:
-a à a.__neg__()


str(x)

Object representation as string

Aufruf: str(x)

Beschreibung:


x - y

Subtraction:

Aufruf: x - y

Beschreibung:
a - b à a.__sub__(b), if a is of type Mod b.__rsub__(a), otherwise


x / y

exact division:

Aufruf: x / y

Beschreibung:
a / b à a.__div__(b), if a is of type Mod b.__rdiv__(a), otherwise


Objektmethoden

copy

A.copy()

Aufruf: self.copy()

Beschreibung:
unabhängige Kopie von A


inverse

p.inverse()

Aufruf: self.inverse()

Beschreibung:
Multiplikatives Inverses
Nur in Körpern definiert. Deshalb muss der Modul Primzahl sein!


operators

Mod.operators()

Aufruf: self.operators()

Beschreibung:
Nur zur Dokumentation
Die Klasse Mod erlaubt folgende Operatoren:

Op.FunktionBeispiele
+Additiona + b; a += b
-Subtraktiona - b; a -= b
*Multiplikationa * b; a *= b
/Division (nur in Körpern, d.h. Primzahlmodul)a / b; a /= b
%Modulo (nur in Körpern, d.h. Primzahlmodul)a & b; a &= b
-unäres Minus-a
Diese Methode dient nur zur Dokumentation. Sie hat keine Wirkung.