Sponsored links: Algebra eBooks
 

Help Index

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

The Maxima on-line user's manual

Algebra Calculator

Search:

Mod Calculator

Mod

Function: mod (<x>, <y>) If <x> and <y> are real numbers and <y> is nonzero, return <x> - <y> * floor(<x> / <y>). Further for all real <x>, we have mod (<x>, 0) = <x>. For a discussion of the definition mod (<x>, 0) = <x>, see Section 3.4, of "Concrete Mathematics," by Graham, Knuth, and Patashnik. The function mod (<x>, 1) is a sawtooth function with period 1 with mod (1, 1) = 0 and mod (0, 1) = 0.

p:47;
q:59;
n:p*q;
phi_n: (p-1)*(q-1);
e:79;
gcd(e,phi_n);
d:inv_mod(e,phi_n);
m:65;
c:power_mod(m,e,n);
power_mod(c,d,n);

To find the principal argument (a number in the interval (-%pi, %pi]) of a complex number, use the function <x> |-> %pi - mod

     (%pi - <x>, 2*%pi), where <x> is an argument.

When <x> and <y> are constant expressions (10 * %pi, for example), mod uses the same big float evaluation scheme that floor and ceiling uses. Again, its possible, although unlikely, that mod could return an erroneous value in such cases.

For nonnumerical arguments <x> or <y>, mod knows several simplification rules:

          (%i1) mod (x, 0);
          (%o1)                           x
          (%i2) mod (a*x, a*y);
          (%o2)                      a mod(x, y)
          (%i3) mod (0, x);
          (%o3)                           0

There are also some inexact matches for mod. Try ?? mod to see them.

(%o1)                                true
(%i2) 

Mod Example

Related Examples

mod

mod(1473513^1051235,2...

Calculate

mod

mod(18^5,25);

Calculate

mod

mod(23,7);

Calculate

mod-power_mod

power_mod(4054941,157...

Calculate

mod

mod(137^2,323);

Calculate

mod

mod(304^301,437);

mod(0^301,437);

mod(34^301,437);

Calculate

mod

mod(-8,5);

Calculate

mod

mod (4, 0);

mod (a*x, a*y);

mod (0, 9);

Calculate

mod-power_mod

power_mod(9, 9^9, 10);

Calculate

mod

mod(4344,23);

Calculate