# Integration of Modular Arithmetic Functions

1. Jul 6, 2011

### Igora

Hello, I have been searching and can't seem to find anything on the topic of integrating modular arithmetic functions. So far I have created an equation for a function in the form of f(x)=mod(x,a):
$\int mod (x,a) dx=\frac{a(x-mod (x,a))+mod (x,a)^2}{2}+c$
But, now I am investigating how to integrate a modular arithmetic function of the reverse: mod(a,x). Does anybody have any ideas or information on the topic?

2. Jul 6, 2011

### SteveL27

How do you define mod for non-integer x?

One reason there's not much literature on this (besides mod only being defined for integers) is that mod is not a binary operation in math, it's an equivalence relation. It's only in programming languages that we see 5 mod 3 = 2.

In math we would say that 5 = 2 (mod 3), but we would also say that 5 = -4 (mod 3). So you can only make mod into a function if you say that n mod a is the least positive member of the set of integers congruent to n mod a. In math it's rare to use that formulation.

3. Jul 15, 2011

### nickalh

Also, integrals only operate on continuous functions.

mod usually operates on integers or natural numbers. f(n):natural numbers-> real numbers is by definition not a continuous function.

There are a few ways to extend the modulo operation to the real numbers. The greatest integer function or floor function is one natural way.

a newMod b =floor(a) ( mod floor(b) )
But as the floor function is very much like a staircase, it's not particularly useful in this context.

4. Jul 17, 2011

### TylerH

If you ignore negative a's and x's, then $f(x) = \{^{a-x \; \mbox{if} \; x \le a}_{a \; \mbox{if} \; x > a}$. The easy way to integrate that, is to just integrate each piece of the piecewise.

5. Dec 30, 2012

### zachcoleman

but modular arithmetic can be pseudo continuous if the mod is prime, because every unit has an inverse.