Closed-Form Modular Arithmetic

Is there a way to define modulo division (or functions of modular arithmetic in general) as superposition of (elementary?) functions?

For example, the multiplication is first introduced as summation, the exponentiation - as multiplication, etc. The trigonometric functions can be expressed through other elementary functions. Moreover, a wide range of "continuous" functions can be expressed as infinite series of different nature, whether we are talking about complete set of functions in $L_p$ space, or about derivatives of infinitely differentiable function combined in Taylor series.

I wonder if it is possible to define functions from modulo arithmetics as closed-form expressions of functions which belong to classes listed in the table below. I have no doubts that it is possible to do so via infinite series, although I do not know how. However, I am particularly interested in closed-form expressions from the table

I find this table from this wikipedia article extremely interesting, although it is devoted to the closed-form expressions only and missing modulo arithmetic.

I believe what you are looking for is this:

$$mod(x,M) = [\frac{1}{2} + \frac{i}{2\pi}ln(-e^{-i2\pi x/M})]\times M$$

You can check it out graphed here:

https://www.wolframalpha.com/input/?i=plot+(1%2F2+%2B+(i%2F(2*pi))*log(-1*exp(-i*2*pi*x%2FM)))*M+where+M+%3D+10

I stumbled upon this post because I was playing around with the function $(-1)^x$ which has a real and imaginary part that are periodic and out of phase. Using Euler's formula I pulled out the part of the function that was cyclical and graphed it and saw that it was a saw wave. I generalized it by scaling it in the x and y direction by M.

Here is the Euler formula transform of the same function:

$$mod(x,M) = [\pi + \frac{ln(cos(\frac{2\pi (x+M/2)}{M}+M+log(2))+i*sin(\frac{2\pi (x+M/2)}{M}+M+log(2)))}{i}]\times \frac{M}{2\pi}$$

You can also derive this by taking the closed form solution that drops out of the infinite Fourier series:

http://mathworld.wolfram.com/FourierSeriesSawtoothWave.html

Note that the Gibbs phenomenon that you get with a finite number of terms when approximating the saw wave disappears with the closed form solution.

• This website uses MathJax for math formulas and symbols. – Silvia Ghinassi Jun 27 '16 at 18:18
• I converted it to MathJax. – Nathan Janos Jun 28 '16 at 18:29

Though it isn't perfect, you can create a "saw-tooth" function which is pretty much a periodic linear function. For example, if you want to take $\mod 3$, you have the function $f$ which has period $3$ and looks like $f(x) = x$ for $x \in [0, 3)$.

You can approximate this saw-tooth function using a Fourier series which involves harmonics of the form $e^{2 \pi i n x}$.