From: "Florian G. Pflug" Date: 2001-07-30T09:48:22+09:00 Subject: [ruby-talk:18773] Re: Numbers classes.. Rational number? [was: Ruby as opposed to Python?] On Mon, Jul 30, 2001 at 08:10:04AM +0900, MikkelFJ wrote: > > This seems bad, or do you have a weird definition of multiplication > > and division that makes it work out? I always thought even the > > integers mod something were a ring and not a field. Rational support > > seems like the only sane option. integers mod x are a field when x is a prime number, otherwise its a ring. when you take N (the integers) mod a prime number, the multiplicative inverse of all (resulting) numbers exists, and therefore it is a field. You than define the divison as the inverse of the multiplication - thus the results are different from "normal" divison. e.g: Integers mod 5 gives the numbers 0 1 2 3 4 and: 2*3 = 1 (because 2*3 would give 6, and 6 mod 5 = 1) therefore 2 is the multiplicative inverse of 3 (and vice versa). This makes 2 = 1/3, or 3 = 1/2 All in the field of integers mod 5 of course. On the other hand, of you take the integers mod 4, this gives you the numbers 0 1 2 3 now 2 doesn't have a multiplicative inverse, because there is no element of the set which would give the result "1" when multiplied with 2. 0*2 = 0 1*2 = 2 2*2 = 0 3*2 = 2 This (and that there can be two non-zero numbers which have the product "0") mean that the integers mod 4 are not a field ('cause every element of a field must have a multiplicative inverse). greetings, Florian Pflug PS: I hope you understand what I mean with "multiplicative inverse". I have _absolutly_ no idea how this is called in english - it's "multiplikatives inverses" in german, and I tried to translate it ;-))