Omnimaga
Calculator Community => TI Calculators => General Calculator Help => Topic started by: Jonius7 on March 28, 2012, 09:04:29 am
-
Hi everyone,
This is a follow up to the 15Puzzle thread
http://ourl.ca/15678#quickreply
where I asked to clarify what % meant (modulo)
I was aware that % might mean modulo, however someone's equation for modulo was confusing me a bit.
% Stands for modulo (though it can have other uses too)
a % b == a - math.floor(a/b)*b
Luckily Xeda helped me out a bit (and also ruler in the background :P):
[05:43:41] <+OmnomIRC> (O)<Xeda112358> Yeah, are you familiar with modulo?
[05:44:28] <+OmnomIRC> (O)<Xeda112358> It is the remainder after a division, so when you do A-2floor(A/2), you get the remainder after dividing by 2
[05:46:41] <+OmnomIRC> (O)<Jonius7> I know it's the remainder, however need to work out how A-2floor(A/2) works out to be the remainder
[05:46:55] <+OmnomIRC> (O)<Xeda112358> Ah, okay
[05:47:12] <+OmnomIRC> (O)<Xeda112358> So, say you divide a number by 2 and you drop the decimal
[05:47:39] <+OmnomIRC> (O)<Xeda112358> When you multiply by 2, you have the highest number up to A that is divisible by 2
[05:47:48] <+OmnomIRC> (O)<Jonius7> Oh I've got it I think
[05:47:56] <+OmnomIRC> (O)<Xeda112358> :D
[05:48:06] <+OmnomIRC> (O)<Jonius7> I'll draw a diagram and post it somewhere
[05:48:22] <+OmnomIRC> (O)<Xeda112358> *cough* posting addiction *cough* ?
[05:48:42] <+OmnomIRC> (O)<Jonius7> Oh. Everyone's been noticing lol
[05:48:46] <+OmnomIRC> (O)<ruler501> Its not an addiction till you have >500 a month :P
[05:49:09] <+OmnomIRC> (O)<Xeda112358> Anywho, by definition, A=2N+B
[05:49:12] <+OmnomIRC> (O)<Jonius7> well yes and no.
[05:49:15] <+OmnomIRC> (O)<Xeda112358> For some N and B
[05:49:19] <+OmnomIRC> (O)<Jonius7> depends how long you get addicted ruler
[05:49:39] <+OmnomIRC> (O)<Jonius7> Yeah
[05:50:06] <+OmnomIRC> (O)<Xeda112358> So (A-2N)=B
[05:50:16] <+OmnomIRC> (O)<ruler501> Jonius7true
[05:50:19] <+OmnomIRC> (O)<Xeda112358> we find N by doing floor(A/2) :3
[05:50:33] <+OmnomIRC> (O)* Xeda112358 <3 math
[05:51:12] <+OmnomIRC> (O)<Jonius7> The A-2floor(A/2) works out the difference between the actual number and the floor of the quotient *multiplied by the floor of the quotient or something rather
[05:51:24] <+OmnomIRC> (O)<Xeda112358> yes
[05:52:07] <+OmnomIRC> (O)<Jonius7> yay. I really needed to understand that somehow.
[05:54:06] <+OmnomIRC> (O)<Jonius7> are modulo and modulus the same?
[05:54:43] <+OmnomIRC> (O)<Xeda112358> Pretty much
[05:55:04] <+OmnomIRC> (O)<Xeda112358> I just say "mod"
[05:55:19] <+OmnomIRC> (O)<Xeda112358> like "a mod b"
[05:59:46] <+OmnomIRC> (O)<Jonius7> I like modulus over modulo because I have seen it more often, but yeah, mod is good for shorthand
[06:00:17] <+OmnomIRC> (O)<Jonius7> or...
[06:00:28] <+OmnomIRC> (O)<Jonius7> Maybe modulus is the function, but modulo is the symbol
[06:00:45] <+OmnomIRC> (O)* Xeda112358 has to go to class D:
[06:32:11] <+OmnomIRC> (O)<Jonius7> meh modulus and modulo are different
[06:37:53] <+OmnomIRC> (O)<Jonius7> modulo is the whole function, whereas modulus refers to the remainder
Thanks to Xeda for that!
Also I said I would make a diagram and put it up here, so see how it goes!
I did want to put another diagram overall for the modulus but haven't done that yet.
EDIT: the diagram's a bit big. It's best to view it in a new tab :)
-
I like the visual o.o
-
So BIG!
A bit too much to read it entilery wihout scrolling :/
-
Open it in another tab and it will scale to fit :)
-
Wowow wait. The modulus is not the remainder. It often is, but not when negative numbers are involved. The modulus has the sign of the divisor, the remainder has the sign of the dividend.
-
Yeah I would make the image smaller if I was you. Maximum 900 pixels width preferably.
-
Hmm, in mathematics, when we look at -1 mod 5, that is 4, not sure if that helps...
-
Wowow wait. The modulus is not the remainder. It often is, but not when negative numbers are involved. The modulus has the sign of the divisor, the remainder has the sign of the dividend.
The given formula works for that. To use the example in Xeda's most recent post:
In -1 mod 5, -1 is the dividend and 5 the divisor. Then, -1 mod 5 = -1 - floor(-1/5)*5 = -1 - (-1)*5 = -1 - -5 = -1 + 5 = 4.
But the use of the word "remainder" in the quoted explanation is somewhat misleading, yes. As most of the time people are working with positive numbers, though, it's not that bad.
-
Sorry if I made some mistakes. I am still not 100% certain about both the modulo and modulus.
Also it is big, which is why I said view in a new tab, but shall scale it down when I next update it.