﻿ Detailed Modulus Discussion
25 May, 2013, 07:10:16
 Welcome, Guest. Please login or register. 1 Hour 1 Day 1 Week 1 Month Forever Login with username, password and session length
 home news downloads projects tutorials misc forums rules new posts irc about Login Register
 OmnomIRC You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

 Pages: [1]   Go Down
 Author Topic: Detailed Modulus Discussion -  (Read 319 times) 0 Members and 1 Guest are viewing this topic.
Jonius7
aka jhgenius
LV10 31337 u53r (Next: 2000)

Offline

Gender:
Last Login: 20 May, 2013, 06:58:52
Date Registered: 03 September, 2010, 02:50:11
Location: Gold Coast, Australia
Posts: 1743

Topic starter
Total Post Ratings: +50

 « on: 28 March, 2012, 15:04:29 » +2

Hi everyone,
This is a follow up to the 15Puzzle thread
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 ):
 1234567891011121314151617181920212223242526272829303132333435 [05:43:41] <+OmnomIRC> (O) Yeah, are you familiar with modulo? [05:44:28] <+OmnomIRC> (O) 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) 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) Ah, okay [05:47:12] <+OmnomIRC> (O) So, say you divide a number by 2 and you drop the decimal [05:47:39] <+OmnomIRC> (O) When you multiply by 2, you have the highest number up to A that is divisible by 2 [05:47:48] <+OmnomIRC> (O) Oh I've got it I think [05:47:56] <+OmnomIRC> (O) :D [05:48:06] <+OmnomIRC> (O) I'll draw a diagram and post it somewhere [05:48:22] <+OmnomIRC> (O) *cough* posting addiction *cough* ? [05:48:42] <+OmnomIRC> (O) Oh. Everyone's been noticing lol [05:48:46] <+OmnomIRC> (O) Its not an addiction till you have >500 a month :P [05:49:09] <+OmnomIRC> (O) Anywho, by definition, A=2N+B [05:49:12] <+OmnomIRC> (O) well yes and no. [05:49:15] <+OmnomIRC> (O) For some N and B [05:49:19] <+OmnomIRC> (O) depends how long you get addicted ruler [05:49:39] <+OmnomIRC> (O) Yeah [05:50:06] <+OmnomIRC> (O) So (A-2N)=B [05:50:16] <+OmnomIRC> (O) Jonius7true [05:50:19] <+OmnomIRC> (O) we find N by doing floor(A/2) :3 [05:50:33] <+OmnomIRC> (O)* Xeda112358 <3 math [05:51:12] <+OmnomIRC> (O) 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) yes [05:52:07] <+OmnomIRC> (O) yay. I really needed to understand that somehow. [05:54:06] <+OmnomIRC> (O) are modulo and modulus the same? [05:54:43] <+OmnomIRC> (O) Pretty much [05:55:04] <+OmnomIRC> (O) I just say "mod" [05:55:19] <+OmnomIRC> (O) like "a mod b" [05:59:46] <+OmnomIRC> (O) I like modulus over modulo because I have seen it more often, but yeah, mod is good for shorthand [06:00:17] <+OmnomIRC> (O) or... [06:00:28] <+OmnomIRC> (O) 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) meh modulus and modulo are different [06:37:53] <+OmnomIRC> (O) 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
 Modulus.png (80.58 KB, 1939x1651 - viewed 81 times.) « Last Edit: 28 March, 2012, 15:07:20 by Jonius7 » Logged

 Userbars.com is down?+9001 Intermediate TI-nspire Basic ProgrammerProgrammed some CASIO Basic in the pastDJ_O Music Discographist Userbars for these coming... in the process
My Released and Announced Projects (Updated 2013/01/29)
TI-nspire BASIC
TI-nspire Hold 'em | Health Bar | Scissors Paper Rock | Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled)

TI-nspire Lua
Numstrat | TI-nspire Hold 'em Lua | Terraria (coming soon)
Axe Parser
Doodle God (stalled while I go and learn some Axe)

Spoiler for Other Stuff:
Hello! Do you want to show your affection for my website, HonestDownloads? Then here is a userbar I specially created earlier just for HonestDownloads users!

To add it to your signature just copy and paste the code below into your sig and you'll become an instant supporter of my website!
 1 [URL=http://www.jhgenius01.webs.com][IMG]http://s1.bild.me/bilder/060112/3684792HDuserbaruser.png[/IMG][/URL]
Spoiler for My TI-nspire Basic Programs (Updated 2012/04/15):
***List of Programs in the TI-nspire Stadium***
Group Release 2012/04/07 on omnimaga.org

Games
Noteable Release    ticalc.org Release Development/Not Publicly Released
2010/05/08 TI-nspire Hold 'em
2012/04/07 v1.1.2   2012/04/10 v1.1.3  2012/04/14 v1.2.1
2010/08/03 Cosmic Legions
2012/04/07 v0.2.2.2 (1st Release)
2010/08/12 Battle of 16s
2012/04/07 v0.2.7
2010/09/10 Health Bar
2012/04/07 v1.2     2012/04/02 v1.0
2010/12/04 sTIck RPG
2012/04/07 v0.1.5.2
2011/01/09 Monopoly
2012/04/07 v0.16    (1st Release)
2012/04/09 Scissors Paper Rock
2012/04/14 v0.8.1

Miscellaneous
2010/11/07 中文 (Chinese) Demonstration
2012/04/07 v1.3     (1st Release)

Potential/Minor Programs
2010/09/26 Shanghai Metro
2012/04/07 v0.2     (1st Release)
2010/12/22 TI-nspire Programming Tutorials
2012/04/07 v0.1     (1st Release)
2010/12/28 Casino Games
Was not released.
2012/04/07 v0.0.4   (1st Release)
2012/03/22 Hierarchy
2012/04/07 v0.01

Demo Programs (some may become Potential Programs)
2010/06/23 Monopoly (Board)
2012/04/07 Prototype
2010/07/14 Strategy Battle
2012/04/07 v0.12
2010/10/05 JRPG
2012/04/07 v0.2
2010/11/02 PlotGrid
2012/04/07 v0.2
2010/11/24 civilizaTIon™
2012/04/07 v0.11

Purely Informational
2011/01/05 TI-nspire Stadium Changelog
2012/04/07 v2
Created to list significant releases of my programs. A page similar to this List of Programs in the TI-nspire Stadium was included in the documentation of most of my programs until sometime in Late 2011/Early 2012.

All games and programs coded in TI-nspire Basic.
© 2010-2012 Jason Ho.
Last Updated 14 April 2012

jhgenius01.webs.com
Will be moving! Stay tuned for updates.
Spoiler for Progress of Doodle God Axe:
2011/12/21 4% - Progress Suspended, ideas of graphical sprites still uncertain
Spoiler for Other Other You Know What Other Stuff I'm Talking About Stuff Stuff (Updated 2012/01/17):
Xeda112358
Xombie. I am it.
Coder Of Tomorrow
LV12 Extreme Poster (Next: 5000)

Offline

Last Login: 23 May, 2013, 22:01:23
Date Registered: 31 October, 2010, 08:46:36
Location: Land of Little Cubes and Tea, NY
Posts: 3760

Total Post Ratings: +610

 « Reply #1 on: 28 March, 2012, 16:11:04 » 0

I like the visual o.o
 Logged

Latest update (possibly incomplete)
My pastebin
Spoiler for FileSyst:
FileSyst is an application that provides a folder and filesystem for the TI-83+/84+ calculators. It is designed to be easy to access and use in BASIC, and it can be used to access game files and save data, or to create a command prompt, among other things:

Spoiler for Graphiti:
This is a graph explorer for graph theory. It will require lots of work to finish. Currently you can:
Add edges (direction not shown, but they are directed)
Arrange vertices in a circle (in the future, you will be able to define levels of rings and the number of nodes in each)
Create complete graphs quickly

Plans:
Deleting edges
Multiple graphs support
Arrows for directed graphs
Planarity testing
Matrix operations
Weighted edges
Chromatic polynomials
Chromatic numbers

Spoiler for Stats:

Samocal             [o---------]
Virtual Processor   [o---------]
EnG                 [oo--------]
Grammer             [ooo-------]
AsmComp             [ooo-------]
Partex              [oooo------]
BatLib              [oooooooo--]
Grammer82           [----------]
Grammer68000        [----------]

Pseudonyms:  Zeda, Xeda, Thunderbolt
Languages:   English, français
Programming: z80 Assmebly
Grammer
TI-BASIC (83/84/+/SE, 89/89t/92)
Known For:   -Creator of the Grammer programming language
(Winning program of zContest2011)
-BatLib- One of the most feature packed libraries for BASIC programmers available
with over 100 functions and a simple programming language
-Learning to program z80 in hexadecimal before using an assembler (no computer was
available!)
╔═╦╗░╠═╬╣▒║ ║║▓╚═╩╝█

Eiyeron
LV7 Elite (Next: 700)

Offline

Gender:
Last Login: 07 January, 2013, 20:29:04
Date Registered: 09 August, 2011, 16:51:22
Location: Err 404.
Posts: 552

Total Post Ratings: +18

 « Reply #2 on: 28 March, 2012, 17:59:50 » 0

So BIG!
A bit too much to read it entilery wihout scrolling
 Logged

Xeda112358
Xombie. I am it.
Coder Of Tomorrow
LV12 Extreme Poster (Next: 5000)

Offline

Last Login: 23 May, 2013, 22:01:23
Date Registered: 31 October, 2010, 08:46:36
Location: Land of Little Cubes and Tea, NY
Posts: 3760

Total Post Ratings: +610

 « Reply #3 on: 28 March, 2012, 18:01:58 » 0

Open it in another tab and it will scale to fit
 Logged

Latest update (possibly incomplete)
My pastebin
Spoiler for FileSyst:
FileSyst is an application that provides a folder and filesystem for the TI-83+/84+ calculators. It is designed to be easy to access and use in BASIC, and it can be used to access game files and save data, or to create a command prompt, among other things:

Spoiler for Graphiti:
This is a graph explorer for graph theory. It will require lots of work to finish. Currently you can:
Add edges (direction not shown, but they are directed)
Arrange vertices in a circle (in the future, you will be able to define levels of rings and the number of nodes in each)
Create complete graphs quickly

Plans:
Deleting edges
Multiple graphs support
Arrows for directed graphs
Planarity testing
Matrix operations
Weighted edges
Chromatic polynomials
Chromatic numbers

Spoiler for Stats:

Samocal             [o---------]
Virtual Processor   [o---------]
EnG                 [oo--------]
Grammer             [ooo-------]
AsmComp             [ooo-------]
Partex              [oooo------]
BatLib              [oooooooo--]
Grammer82           [----------]
Grammer68000        [----------]

Pseudonyms:  Zeda, Xeda, Thunderbolt
Languages:   English, français
Programming: z80 Assmebly
Grammer
TI-BASIC (83/84/+/SE, 89/89t/92)
Known For:   -Creator of the Grammer programming language
(Winning program of zContest2011)
-BatLib- One of the most feature packed libraries for BASIC programmers available
with over 100 functions and a simple programming language
-Learning to program z80 in hexadecimal before using an assembler (no computer was
available!)
╔═╦╗░╠═╬╣▒║ ║║▓╚═╩╝█

harold
LV4 Regular (Next: 200)

Offline

Last Login: Yesterday at 22:07:09
Date Registered: 17 July, 2011, 19:56:06
Posts: 117

Total Post Ratings: +25

 « Reply #4 on: 28 March, 2012, 19:58:00 » 0

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.
 Logged

Want to play logic puzzels? Binary Puzzle is FREE!
Blog about bitmath: bitmath.blogspot.nl
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)

Offline

Gender:
Last Login: Today at 04:23:20
Date Registered: 25 August, 2008, 07:00:21
Posts: 50233

Total Post Ratings: +2615

 « Reply #5 on: 28 March, 2012, 20:32:53 » 0

Yeah I would make the image smaller if I was you. Maximum 900 pixels width preferably.
 Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Xeda112358
Xombie. I am it.
Coder Of Tomorrow
LV12 Extreme Poster (Next: 5000)

Offline

Last Login: 23 May, 2013, 22:01:23
Date Registered: 31 October, 2010, 08:46:36
Location: Land of Little Cubes and Tea, NY
Posts: 3760

Total Post Ratings: +610

 « Reply #6 on: 28 March, 2012, 20:33:48 » 0

Hmm, in mathematics, when we look at -1 mod 5, that is 4, not sure if that helps...
 Logged

Latest update (possibly incomplete)
My pastebin
Spoiler for FileSyst:
FileSyst is an application that provides a folder and filesystem for the TI-83+/84+ calculators. It is designed to be easy to access and use in BASIC, and it can be used to access game files and save data, or to create a command prompt, among other things:

Spoiler for Graphiti:
This is a graph explorer for graph theory. It will require lots of work to finish. Currently you can:
Add edges (direction not shown, but they are directed)
Arrange vertices in a circle (in the future, you will be able to define levels of rings and the number of nodes in each)
Create complete graphs quickly

Plans:
Deleting edges
Multiple graphs support
Arrows for directed graphs
Planarity testing
Matrix operations
Weighted edges
Chromatic polynomials
Chromatic numbers

Spoiler for Stats:

Samocal             [o---------]
Virtual Processor   [o---------]
EnG                 [oo--------]
Grammer             [ooo-------]
AsmComp             [ooo-------]
Partex              [oooo------]
BatLib              [oooooooo--]
Grammer82           [----------]
Grammer68000        [----------]

Pseudonyms:  Zeda, Xeda, Thunderbolt
Languages:   English, français
Programming: z80 Assmebly
Grammer
TI-BASIC (83/84/+/SE, 89/89t/92)
Known For:   -Creator of the Grammer programming language
(Winning program of zContest2011)
-BatLib- One of the most feature packed libraries for BASIC programmers available
with over 100 functions and a simple programming language
-Learning to program z80 in hexadecimal before using an assembler (no computer was
available!)
╔═╦╗░╠═╬╣▒║ ║║▓╚═╩╝█

calcdude84se
Needs Motivation
Members
LV11 Super Veteran (Next: 3000)

Offline

Gender:
Last Login: 14 May, 2013, 16:12:14
Date Registered: 21 April, 2010, 04:20:59
Posts: 2207

Total Post Ratings: +62

 « Reply #7 on: 28 March, 2012, 23:21:58 » 0

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.
 Logged

"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
Bug me about PartesOS. I might just need reminding.
Jonius7
aka jhgenius
LV10 31337 u53r (Next: 2000)

Offline

Gender:
Last Login: 20 May, 2013, 06:58:52
Date Registered: 03 September, 2010, 02:50:11
Location: Gold Coast, Australia
Posts: 1743

Topic starter
Total Post Ratings: +50

 « Reply #8 on: 29 March, 2012, 01:01:32 » 0

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.
 Logged

 Userbars.com is down?+9001 Intermediate TI-nspire Basic ProgrammerProgrammed some CASIO Basic in the pastDJ_O Music Discographist Userbars for these coming... in the process
My Released and Announced Projects (Updated 2013/01/29)
TI-nspire BASIC
TI-nspire Hold 'em | Health Bar | Scissors Paper Rock | Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled)

TI-nspire Lua
Numstrat | TI-nspire Hold 'em Lua | Terraria (coming soon)
Axe Parser
Doodle God (stalled while I go and learn some Axe)

Spoiler for Other Stuff:
Hello! Do you want to show your affection for my website, HonestDownloads? Then here is a userbar I specially created earlier just for HonestDownloads users!

To add it to your signature just copy and paste the code below into your sig and you'll become an instant supporter of my website!
 1 [URL=http://www.jhgenius01.webs.com][IMG]http://s1.bild.me/bilder/060112/3684792HDuserbaruser.png[/IMG][/URL]
Spoiler for My TI-nspire Basic Programs (Updated 2012/04/15):
***List of Programs in the TI-nspire Stadium***
Group Release 2012/04/07 on omnimaga.org

Games
Noteable Release    ticalc.org Release Development/Not Publicly Released
2010/05/08 TI-nspire Hold 'em
2012/04/07 v1.1.2   2012/04/10 v1.1.3  2012/04/14 v1.2.1
2010/08/03 Cosmic Legions
2012/04/07 v0.2.2.2 (1st Release)
2010/08/12 Battle of 16s
2012/04/07 v0.2.7
2010/09/10 Health Bar
2012/04/07 v1.2     2012/04/02 v1.0
2010/12/04 sTIck RPG
2012/04/07 v0.1.5.2
2011/01/09 Monopoly
2012/04/07 v0.16    (1st Release)
2012/04/09 Scissors Paper Rock
2012/04/14 v0.8.1

Miscellaneous
2010/11/07 中文 (Chinese) Demonstration
2012/04/07 v1.3     (1st Release)

Potential/Minor Programs
2010/09/26 Shanghai Metro
2012/04/07 v0.2     (1st Release)
2010/12/22 TI-nspire Programming Tutorials
2012/04/07 v0.1     (1st Release)
2010/12/28 Casino Games
Was not released.
2012/04/07 v0.0.4   (1st Release)
2012/03/22 Hierarchy
2012/04/07 v0.01

Demo Programs (some may become Potential Programs)
2010/06/23 Monopoly (Board)
2012/04/07 Prototype
2010/07/14 Strategy Battle
2012/04/07 v0.12
2010/10/05 JRPG
2012/04/07 v0.2
2010/11/02 PlotGrid
2012/04/07 v0.2
2010/11/24 civilizaTIon™
2012/04/07 v0.11

Purely Informational
2011/01/05 TI-nspire Stadium Changelog
2012/04/07 v2
Created to list significant releases of my programs. A page similar to this List of Programs in the TI-nspire Stadium was included in the documentation of most of my programs until sometime in Late 2011/Early 2012.

All games and programs coded in TI-nspire Basic.
© 2010-2012 Jason Ho.
Last Updated 14 April 2012

jhgenius01.webs.com
Will be moving! Stay tuned for updates.
Spoiler for Progress of Doodle God Axe:
2011/12/21 4% - Progress Suspended, ideas of graphical sprites still uncertain
Spoiler for Other Other You Know What Other Stuff I'm Talking About Stuff Stuff (Updated 2012/01/17):
 Pages: [1]   Go Up