Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: Modulo of fraction?

by shemp (Deacon)
on Jun 27, 2005 at 23:45 UTC ( [id://470419]=note: print w/replies, xml ) Need Help??


in reply to Re: Modulo of fraction?
in thread Modulo of fraction?

This becomes a battle of semantics. Mostly one only sees modulo arithmetic defined for integers, where the modulus needs to be a positive integer. But there are definely analogous systems that deal with fractions, and i suppose that they can be extended to reals, although taking the modulus of something (mod pi) seems pretty weird to me.

But as a mathematician, as long as the system definition is consistent, there shouldnt be any problem.

I do recall in an old (1950's) number theory book that got from a clearance rack (old crap free for the taking) from my universities math department (which i still posess), it is left as an exercise to extend modular arithmetic to include fractions. Ouch!, but such things are feasible.

I should read the link you cited, but am way too busy right now.

Replies are listed 'Best First'.
Re^3: Modulo of fraction?
by CountZero (Bishop) on Jun 28, 2005 at 09:10 UTC
    ... although taking the modulus of something (mod pi) seems pretty weird ...
    Not only weird but for such transcendental numbers as pi or e I can imagine that the result is undefined!

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

      On the contrary, mathematics makes use of "modulo 2π" (that's "2 pi") somewhat often. In particular, in discussing Fourier series, you consider functions defined on the circle, which is often thought of as the reals R modulo 2π. Most of the suggested fraction modulus functions here do the right thing.

      The "niceness" of integer moduli is that the following is true: (($a % $m) + ($b % $m)) % $m == ($a + $b) % $m and (($a % $m) * ($b % $m)) % $m == ($a * $b) % $m. However, even for non-integer moduli, the former is true.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://470419]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2024-04-23 08:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found