Jump to content

Help with Binary Codes for IB physics

oc0110
Go to solution Solved by Ciccioo,

wait.. ok I understand the second part.

But can u explain to me what base numbers are and what N digits represent?

Thanks for helping out :)

342 is 1 number, written with 3 digits in base 10:

the 3 digits are (3, 4, 2)

the base is 10 because every digit could have 10 values (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)

 

binary is base 2 because you have only 2 possible values for every digit (0, 1)

hexadecimal has 16 symbols, usually written as (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F)

 

if you're working on a byte, then you know you're looking at 8 bits

"8 bits" stands for "8 binary digits", therefor N = 8, you have 8 digits

and those digits are binary, so they're base 2 digits

 

2 to the power of 8 = 256 combinations

 

edit: oh nevermind, you got it already

well fuck it, i reached 500 posts, hooray! useless custom member title incoming

Hi guys I'm taking IB physics and our teacher didn't cover digital technology so i have a couple of questions..

 

#1: how many different numbers can be represented by 1 byte --> is the answer 16 or 256? and why?

 

#2 can someone explain to me how binary codes represents alphabets?

 

+ does 1 character = 1 byte? I'm really new to binary codes...

 

Thanks in advance.

Link to comment
Share on other sites

Link to post
Share on other sites

binary wiki yo!

 

http://en.wikipedia.org/wiki/Binary_code

 

hint: it holds the secretes

CM Storm Switch Tester MOD (In-Progress) - http://linustechtips.com/main/topic/409147-cm-storm-switch-tester-macro-mod/


       Ammo Can Speaker 02 (Completed) - http://linustechtips.com/main/topic/283826-ammo-can-speakers-02/       A/B Switch V 0.5 (Completed) - http://linustechtips.com/main/topic/362417-ab-switch-v0


     Build 01 - The Life of a Prodigy -  http://linustechtips.com/main/topic/13103-build-01-the-life-of-a-prodigy/             Build 02 - Silent Server 3000 - http://linustechtips.com/main/topic/116670-build-02-silent-server-3000/

Link to comment
Share on other sites

Link to post
Share on other sites

#1 numbers 0-255 can be represented by 8 bits/1byte (2^8 - 1 = 255)

#2 in ascii numbers 65-90 in binary represent upper case alphabet letters, 97-122 lower case e.g 100 0001 is A and 101 1010  is  Z

standard representation is one character per byte (UTF - 8).

source:https://en.wikipedia.org/wiki/ASCII

Link to comment
Share on other sites

Link to post
Share on other sites

1)

1 byte is made of 8 bits/binary digits

in general, if you represent a number of N digits in base B, you can represent B^N different numbers (B to the power of N)

so, you have a base 2 number (B = 2) with 8 bits (N = 8) which gives you 2^8 = 256 numbers

 

also, if you have a 4 digits number (N = 4) in decimal (B = 10) you can encode 10^4 = 10000 numbers, which is right (from 0 to 9999)

just to show that the general rule is valid

 

2)

characters are usually represented using the ASCII code

asciifull.gif

so for instance

A = 65 = 01000001

a = 97 = 01100001

B = 66 = 01000010

b = 98 = 01100010

as you can see, there are some quite convenient patterns

and as you see, ASCII is an 8 bits code for encoding characters, which yes, is a byte

 

there are others codes for characters, such as unicode, which uses different numbers of bytes and are used for data exchange on the internet, i believe, but generally speaking, when you learn character encoding, you learn ASCII

Link to comment
Share on other sites

Link to post
Share on other sites

1)

1 byte is made of 8 bits/binary digits

in general, if you represent a number of N digits in base B, you can represent B^N different numbers (B to the power of N)

so, you have a base 2 number (B = 2) with 8 bits (N = 8) which gives you 2^8 = 256 numbers

 

also, if you have a 4 digits number (N = 4) in decimal (B = 10) you can encode 10^4 = 10000 numbers, which is right (from 0 to 9999)

just to show that the general rule is valid

 

2)

characters are usually represented using the ASCII code

asciifull.gif

so for instance

A = 65 = 01000001

a = 97 = 01100001

B = 66 = 01000010

b = 98 = 01100010

as you can see, there are some quite convenient patterns

and as you see, ASCII is an 8 bits code for encoding characters, which yes, is a byte

 

there are others codes for characters, such as unicode, which uses different numbers of bytes and are used for data exchange on the internet, i believe, but generally speaking, when you learn character encoding, you learn ASCII

wait.. ok I understand the second part.

But can u explain to me what base numbers are and what N digits represent?

Thanks for helping out :)

Link to comment
Share on other sites

Link to post
Share on other sites

nvm I got it :P

Thanks guys this problem is resolved

Link to comment
Share on other sites

Link to post
Share on other sites

wait.. ok I understand the second part.

But can u explain to me what base numbers are and what N digits represent?

Thanks for helping out :)

342 is 1 number, written with 3 digits in base 10:

the 3 digits are (3, 4, 2)

the base is 10 because every digit could have 10 values (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)

 

binary is base 2 because you have only 2 possible values for every digit (0, 1)

hexadecimal has 16 symbols, usually written as (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F)

 

if you're working on a byte, then you know you're looking at 8 bits

"8 bits" stands for "8 binary digits", therefor N = 8, you have 8 digits

and those digits are binary, so they're base 2 digits

 

2 to the power of 8 = 256 combinations

 

edit: oh nevermind, you got it already

well fuck it, i reached 500 posts, hooray! useless custom member title incoming

Link to comment
Share on other sites

Link to post
Share on other sites

ahahahah thanks anyways I really appreciate it

Link to comment
Share on other sites

Link to post
Share on other sites

For any base: digit*base^(pos-1) + ... + d*b^(0) where 0 <= digit < base

 

Let's take an 8bit binary number: 10101010

 

1*2^(8-1) + 0*2^(7-1) + 1*2^(6-1) + 0*2^(5-1) + 1*2^(4-1) + 0*2^(3-1) + 1*2^(2-1) + 0*2^(1-1)

 

128 + 0 + 32 + 0 + 8 + 0 + 2 + 0 = 170

 

A binary number can represent 2^digits numbers, with a max value of 2^d-1

 

This doesn't take into account 1's or 2's compliment.

main(i){for(;i<101;i++)printf("Fizz\n\0Fizzz\bBuzz\n\0%d\n"+(!(i%5)^!!(i%3)*3)*6,i);}

Link to comment
Share on other sites

Link to post
Share on other sites

The best way to explain binary in my IMO, i am going to try, lets see if i have gotten this correct my self.

 

When given a line of bits, each bit will have a different value, the value is double of the previous one.

because B is base 2 it goes like this.

 

(last bit>) 128  64  32   16   8   4    2    1 (<first bit) (note the line can be any length, this line is 8 bits long, or a BYTE)

                  0    0     1     0    1   0    1    0

how to calculate?

1=0

2=1

4=0

8=1

16=0

32=1

64=0

128=0

 

you can essentially ignore the 0:s now, just add all the values together, or the value each "1" represents, this boils down to.

2+8+32=42

 

There, i hope that was helpful some how, and i must certainly hope it was correct.

 

Spoiler

Case Bitfenix Ghost, Mobo Asus Maximus VIII Ranger, CPU i7 6700K @4.2 Ghz cooled by Arctic cooling Freezer i30, (barely). GPU Nvidia GTX 970 Gigabyte G1 @1519Mhz core, RAM 16Gb Crucial Ballistix CL16 @2400Mhz. SSD 128GB Sandisk Ultra Plus as my OS drive. HDD's  1TB  Seagate ST31000524AS its OEM, 3TB Seagate Barracuda, 2x 500GB WDC Blue (RAID 0)

If it isn't working absolutely perfectly, according to all your assumptions, it is broken.

Link to comment
Share on other sites

Link to post
Share on other sites

[...] i must certainly hope [...]

i love how this is worded

 

but yeah, it's correct

Link to comment
Share on other sites

Link to post
Share on other sites

Also, a handy tool for converting numbers and learning their binary representations is none other than the windows calculator.

 

View -> Programmer

main(i){for(;i<101;i++)printf("Fizz\n\0Fizzz\bBuzz\n\0%d\n"+(!(i%5)^!!(i%3)*3)*6,i);}

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×