Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Integration of Modular Arithmetic Functions

  1. Jul 6, 2011 #1
    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):
    [itex]\int mod (x,a) dx=\frac{a(x-mod (x,a))+mod (x,a)^2}{2}+c[/itex]
    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. jcsd
  3. Jul 6, 2011 #2
    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.
  4. Jul 15, 2011 #3
    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.
  5. Jul 17, 2011 #4
    If you ignore negative a's and x's, then [itex]f(x) = \{^{a-x \; \mbox{if} \; x \le a}_{a \; \mbox{if} \; x > a}[/itex]. The easy way to integrate that, is to just integrate each piece of the piecewise.
  6. Dec 30, 2012 #5
    but modular arithmetic can be pseudo continuous if the mod is prime, because every unit has an inverse.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook