=== Binary Possibility Theory === === by: Job(AKA joppiesaus) === === http://joppiesaus.function1.nl === Well, as you may know, I wrote a program that calculates the max value of a binary number with specified bits / bytes. I did this for my own fun, but I learned many things from it. Also, I really don't know why I call it "The Binary Possibility Theory". It just sounds majestic, and it's probably because it has so much to do with Binary. I explain in every part what I thought and what I did. Here's a short list about what you can read here: - How it began - About Binary & Decimal numbers - Possibilitys possible calculating - More math! - More info ### How it began ### I don't know really. I had heard the word "Binary" somewhere. I was curious and went out to the internet. That's how I found out how to calculate Binary, converting it to and from Decimal, thought the practise really learned me everything. I didn't use any internet for the other things I've found out. I used this page: http://www.helpwithpcs.com/courses/binary-numbers.htm ### About Binary & Decimal numbers ### In each numeral system the place of the number decides its worth. In Binary there are only 2 values / number(bit). In Decimal there are 10 values / number. Binary: 0 1 = 2 options / number Decimal: 0 1 2 3 4 5 6 7 8 9 = 10 options / number You can say that Binary is just a flip-flop: It's on or off. Each Binary number we call a bit, a byte is 8 bits. You have in both numeral systems a formula that decides what that number is worth. Here are some examples of Binary numbers converted to decimal, and its max value, which is also the method I use to calculate the max value: Binary number: 1 0 1 1 Decimal result: 8 4 2 1 = 9 max value = 1 + 2 + 4 + 8 = 15 = 4^2 - 1 Binary number: 1 0 1 Decimal result: 4 2 1 = 5 max value = 1 + 2 + 4 = 7 = 3^2 - 1... Binary number: 1 0 Decimal result: 2 1 = 2 Max value = 1 + 2 = 3 = 2^2 - 1...?! As you can see, I check which flip-flops are on and I give them value by the place of the number, which is based on one and multiplied by 2 every place. Or, (number place)^2 When I made my program and I calculated some things for fun, I saw a stunning algorithm: The max value is nothing more than this: max value = number length^2 - 1, which is: max value = bits^2 - 1 ### Possibilitys possible calculating ### So I found out a quick way to calculate the max Binary value of a Binary number. I suddendly started thinking about glasses water. I thought: Glasses can be either full of water or be empty(of course, there are also other options). If I have two glasses, how many possible combinations can I get? I suddendly started thinking about Binary. They have much in comment: Two possible combinations: Either full or empty / on or off / 1 or 0. The Binary max value of 2 bit is 3, so I started couting... 4 combinations possible. Because no glasses is also an option! Now 3 glasses: The Binary max value of 3 bit is 7. Again I started couting... 8 combinations possible! But then I looked at my formula: bits^2 - 1. This time it's bits^2! Or to be more precise: possible combinations = glasses^2! Then I started thinking again. What if my glasses could also be half-full of water? This is what I had (kind of) in mind: 0 = empty 1 = half-full # = full One glass: 0 = 0 1 = 1 # = 2 ___ 3 possible combinations total = 3^1 Two glasses: 0 0 0 1 0 # 1 0 1 1 1 # # 0 # 1 # # ___ 9 possible combinations total = 3^2 Three glasses: 0 0 0 0 0 1 0 0 # 0 1 0 0 1 1 0 1 # 0 # 0 0 # 1 0 # # 1 0 0 1 0 1 1 0 # 1 1 0 1 1 1 1 1 # 1 # 0 1 # 1 1 # # # 0 0 # 0 1 # 0 # # 1 0 # 1 1 # 1 # # # 0 # # 1 # # # _____ 27 possible combinations total! = 3^3! So after all I was sort of wrong with the full and empty glasses, because the answer didn't matter and it seemed more logical: It's not glasses^2, its 2^glasses! But since I've got 3 possible combinations / glass, empty / half-full / full = 3 options / number It didn't work again the old way any more! So I concluded a new formulla after a few tests: possible combinations = options-per-object ^ number-of-objects BOOM! I've found it! I could calculate everything now! I loved math more than ever before. So with this you can conclude stuff again and do math: 1 # 0 9 3 1 3^2 3^1 3^0 Again another algorithm! It's just like the max value! Why? Look at the three glasses theory: the first glass(as seen from the left) changes every 9 new glasses. The second 3, and the first... one. Let's calculate the value of that number, based on order. I came up with this method: 1: Give the options a value(like 0 1 2 3): full = 2 half-full = 1 empty = 0 2: Get how many options there are: 3 options 3: Calculate it like so: Use the place of the number counted by zero as the power of, use the power itself is the number of options, then multiply it by the value you gave it 1 # 0 = ? 3^2 * 1 3^1 * 2 3^0 * 0 9 + 6 + 0 = 15 THE ANSWER IS RIGHT! INCREDIBLE! Let's to this with more options: 1: # full = 4 3 3/4 = 3 2 1/2 = 2 1 1/4 = 1 0 empty = 0 2: 5 options 3: 2 1 0 # 5^3 * 2 5^2 * 1 5^1 * 0 5^0 * 4 250 + 25 + 0 + 4 = 279 It's a good method I think! This should also work with any numeral system(even your own), not to mention Binary! Another example: I have a 3 dimensional lego-like building. There are 4 sorts of blocks: None, Red, Green, Blue. The building's width is 4, the length is 6, the height is 4 blocks. How many possible combinations can I create with this? Well, first you've got to calculate how many blocks there fit in that area. Blocks = Length * Width * Height Blocks = 6 * 4 * 4 = 96 blocks So there is space for 96 blocks. The possibilities are in total... 4! So: possible combinations = 4^96 = 6.277101735 * 10^57 possible combinations. That's quite a lot! I bet more than you'd expected! Thought it's the truth. If you don't believe it, read everything again! >:D Now you can say what's the chance if you and I build the same building and we DON'T look at each others building. chance = (1 / ans)^2 = ...% Multiply that answer by 100 and you have it in percents. That's not much either! Again the truth. Weird, huh? Why is that the chance? Because: There's one option / chance that you create that specific building of that huge number. So: chance that you create that: 1 / total But someone else has to make the same. His chance is the same. But how big is the chance this happens to you both? chance for the same building = chance p 1 * chance p 2 Since your chances are both the same, you can make it a power of 2. ### More math! ### I wasn't done yet with the Binary stuff. How do I calculate a number to binary from decimal? Well there's a simple method to convert from Decimal to Binary: First, you have a number, I pick 189. Then, I try to divide by two, when I can I write a 0, but when I can't, I just write a one, like a remainder. 189 / 2 - 1 94 / 2 - 0 47 / 2 - 1 23 / 2 - 1 11 / 2 - 1 5 / 2 - 1 2 / 2 - 0 1 / 2 - 1 Then I write it down from up to down, and you have your answer. 189 = 10111101 Numbers is just more than counting. It's something special. ### More info ### Goto this place: http://function1.nl/t/bpt Contact me? job@function1.nl! You want more stuff? http://joppiesaus.function1.nl!