technically, you'd need some restriction on your z, otherwise z + y is just as good a solution, for n = n - 1.
And besides, why would you ever want to look at things mod 0? - if it ever happens, it's probably an error, so might as well report it.
Also, how do you define the restriction for other additive groups? For vectors you could look at the norm - but that's a consequence of the very very natural and useful multiplication between vectors, ie dot product... | [reply] |
The restriction in other rings is indeed that
z = x % y such that
(norm(z) < y -- Update: corrected error spotted by ivancho) norm(z) < norm(y).
Of course, you have some freedom in how you define the norm.
The point is that, if you can define modulus and a norm in such
a way, then the ring is a principial ideal ring, and thus, a UFD.
(The proof goes this way: norm and remainder => gcd =>
all ideals are principial => every irreducible elements are prime =>
unique factorisation.)
This is one of the most common proofs you can prove
the Fundamental Theorem of arithmetic, that is, the
fact that every integer can be decomposed to the
product of primes.
#ifdef MATHMONKS
#endif
| [reply] [d/l] [select] |
oooh, heavyweight maths, delicious.. ++
just want to point out a couple of things - first, a minor ommission, at the top you want norm(z) < norm(y)
second, I was commenting on the impossibility to define that for general groups - looking at the cyclic group generated by y and its coset generated by x, there's no obvious element to be called 'the remainder'. When you go to rings, things are different, indeed.
my algebra is a little rusty by now, but I think you need your principal ideal ring to be an integral domain as well, before you get UFD ( ie, no Z_6 and the like ), this relating to your second paragraph.. Looking further down, I see that you talk about domains only, so fair enough, and we don't want to look at ugly non-domain PIRs anyway..
I think the issue with multivariate polynomials is that they are UFDs, but definitely not PIDs ( e.g. <x,y^2> ), but in any case, now I'm just getting depressed realizing how much I've forgotten, so I'll drop it here, and go back to my leaking recursive closures...
| [reply] |
From what I learned in school, modulo is simply defined as:
$rest = $number - ($number/$modulo);
That given, the error is perfectly justified when $module is 0.
According to PISA german schools are not the among the best anymore, but in this particular case, perl is with me. ;-)
Note: This doesn't take into account that perls modulo is an integer modulo.
Update:
oops. That should of course be (as ivancho states.): $rest = $number - (($number/$modulo) * $modulo);
Note to self: Don't post 5 minutes after waking up :-/
| [reply] [d/l] [select] |
you missed a '* $modulo', methinks...
Either that, or German schools have really gone downhill :-P
| [reply] |
| [reply] |