Module 1 Flashcards
Integers
All whole natural numbers, negative and zero
NOT FRACTIONS
Real Numbers
All integers and all fractions. Basically all integers and all the numbers that exist between the integers
-Any value you encounter in the real world
-include rational and irrational numbers as well as integers
Rational Numbers
Real numbers that can be represented as a fraction
-Also includes the integer group because 10= 10/1
Irrational Numbers
real numbers that Cannot be represented as a fraction
(the decimal is never repeating so cant be a fraction)
Two main examples:
the square root of 2 and pi
Two common examples of irrational numbers
square root of 2 and pi
exponents
n^k = n multiplied by itself k times
Some common rules:
n^1=n
n^0=1
n^-1=1/n^1 (basically a number to a neg exponent is the inverse ex 2^-2 = 1/2^2 = 1/4
10^pos number = pos number is how many zeros after the one in thenumebr (ex 10^3= 1000)
Which are important when working with computers?
The exponents or powers of 2
Subscripts
-doesnt mean anything in traditional math
-usually just used to distinguish between variables like xsubscript2
-we will use it to distinguish number systems with different bases (later)
Continous Numbers
-Real numbers
-there is a smooth transition between any two values
-think of a line with no breaks in it
-think elevator moving from third and fourth floor, it is smooth and continous with no breaks, smooth transition
examples: time, temperature, distance , mass
Is there an infinite amount of values between any two real values?
Yes! Think of 3 to 4, there is 3.001, 3.000001, 3.0000000001 and so forth. Same with 3 to 3.001, there are infinite amount of values between them
Discrete Values
-Not Continous, jerky movement
-it is the transition between integers (but doesnt have to be integer) because it jumps from 3 to 4 for example because 3.001 is not an integer (rmember integers are whole natural numbers)
-doesnt have to be integer because can be something liek shoe sizes, 7 to 7.5, 7.5 is not an integer but this is dicrete because it jumps
-these are easily countable things, if u can “count on fingers” it is most likely discrete
ex: count people in room, there are 4 then someone walks in, all of a sudden it jumps to 5, it didnt transitionslowly from 4.001, 4.2 etc to 5 because there are neber 4.002 people in the room
For the elevator example for continous; the path the elevator takes is continous, but the buttons on the elevator are discrete because it jumps from 3 to 4, but the path is everything inbetweem
Do discrete values have to be integers?
No, but integers are always discrete
For example: pennys are discrete and they are 1/100
example 2: shoe sizes : 7, 7.5, but no 7.4 so not continuity so discrete but 7.5 is not an integer so yea
Do discrete quantities have to be numbers
No, the date is discrete. April 30 to May 1, it jumps
HOWEVER: Time is continous
Discretization
-Converting (or rounding) a continous quantity to a discrete value
i.e thinking about a continous thing as a dicrete, caring about significant digits and therefore ignoring others
Example: height, you measure urself and u are 167.8 cm, but with a super precise measuring one, u are 167.8172639 cm exactly. Saying that u are 167.8 cm is discretization because they rounded to the nearest milimeter so they discretized the height
thereofre, measuring tapes discretize continous quantities
can do the same with weather, we dont care if it is 12.9832983 degrees out, we just care that it is 12 degrees.
Time: we dont care if it si 2:59:59 we care that it is 3 so we discretized it
putting price as $19.95 instead of twenty makes us think that it is 19 dollars not 20
So to summarize, discretization is when a continuous quantity is converted to a discrete quantity with an appropriate level of precision. Humans naturally discretize quantities because it is practical and convenient.
Digital meaning
-latin roots (word digit)
-means finger (it is fingers and toes)
therefore, digital means “related to your fingers” or COUNTABLE
- bascially means that it is discrete (countable)
Digits: 10 digits, 0-9, make up numbers
Present meaning:
-anything that can be represented by 0 and 1, because this means that it can be stored on a computer
-therefore also means anything related to a computer because if it is digitalized, then it can be on a computer
KNOW that if u are working with something digital, you are working with discretized data (doesnt necessarily mean stored on computer, but usually does)
If data is digital what does this mean
-it is discrete data
Means we can count it, so it is discrete, not continous
discrete and data are interchangeable words
What is the opposite of digital
Analog
Analog and continous are interchangeable, just like how digital and discrete are
Think:
Analog thermometers: continous, and have infinite percision
Digital: discrete and only represent the temp accurate to few decimals, so it jumps
Digitalization
basically discretization,
-making data change from continous to discrete so that it can be digital, needed to happen so that the data can be stored and represented on a digital computer
Signal
A quantity that changes over time
Think: if plotting true height growth, it would be a continous plot, and this height curve is a signal
TO discretize this, we need to discretize two things, the height and time. Done by sampling (discretizing time) and height discretization
Discretizing time is called?
Sampling
-picking if we are going to measure time in seconds, years, months,
-basically the interval which you will be measuring at is the discritzation of time
Sampling frequency
sample at a regular interval ie meausring time t a requglar interval
-measured in hertz (Hz), measures how many times something happens per second, ex: if something is measured 10 times in a second, it would be 10 Hz
When discretizing data, and plotting it, if the jumps are visible this means…
-the sampling (intervals which we picked to measure time ) and the discretization of height was at a lower precision
-higher precision means things may appear smooth even though they are not (this is because we picked really good intervals and stuff so we cant visualize the jumps so it appears continous)
Most of the time, computers are digitizing things at high precision, magic of modern computers
Digital data is stored and represented in
Binary (0=off and 1=on)
-although it may seem easier to have all 10 digits 0-9 and use those, using binary is like spy light on in room situation (when light in window on it means go with assasination, when off it means no). It is able to communicate a message with two
Problem with binary?
Can only communicate two different messages/values.
Why is data stored in binary?
-because it is easy to tell if something is off or on. Using two digits instead of two for a computer is like using 10 different brightness levels for the spy light situation. It is hard to determine which one it is and it woulld require all digital devices to be more sensitive to these things
-with binary, we could have multiple sets, like spy light situation with 2 light bulbs in window (get 4 values now) or k lights, givin us k(2^k) values
-It is this characteristic: the ability to easily distinguish between two distinct values, which is why binary is an excellent choice to represent and store digital information
How can digital information be stored
-in computer: stored in binary off and on situation
physical medias:
-hard drive and floppydisk (on or off is stored in areas that are magnetized or demagnetized
-usb and sd (on off info stored as electrical charges like static electricity
CD, DVD, Blueray: (on off info stored as little pits on the surface of the disc
digital info is basically just long sequences of 0 and 1s
Bit vs Byte
As we know, digital info is long sequences of zeros and ones
-bit is the light switch, it is like a unit that is able to be either 0 or 1, stands for binary digit
-Byte is a group of 8 bits together, represents 2^8 values, or 256
-nibble: 4 bits in a group
Why use byte
-its like carton of eggs, easier to carry eggs with a carton even if we only want to use 1 byte
-even if using one byte tho, the other 7 will be there, but just ignored.
bits and the equation for how many values they represent
2^k where k= number of bits
byte represents 2^8=256 values
How many bytes is a essay, song and movie
Essay: kilobytes (thousands of bites) so few kilobytes Early computing days amt: 2^10=1024, but now represent as just 1000s
Song: Megabytes (millions of bytes) so few of these Early days amount 2^20=1048576, but now just say millions
Movie: Gigabytes (billions of bytes) so few of these
Bytes or bytes
when referring to Bytes, should be capital B and bits is lowercase
How to count (in different bases)
Label columns from the right most number moving left
Number: 5978
Column: 3210
When counting: think of it like the ones column is the 0 column, tens is 1, hundreds is 2 column.
Generalization:
1) Start column 0
2) add one if we can (then we are “good”)
3) if we are out of digits, reset that current column, move one to the left and try again
ex: 9 -> 10 (reset 0 column and added 1 to tens)
Number of digits u use is the BASE of the system, so we use a base 10 system (aka Decimal System)
Base 10 system is also called
decimal system
why is it called base 10 system, because the number of digits used is the base, and we use 10 so base 10
How to count in a base 8 system
only have digits 0-7
so…
Same generalization:
1. Start at column 0
2. If we can add a digit, add one
3. If we ran out of digits, make the current coloumn 0 and add a digit to the column to the left
ie: 16 -> 17 -> 20
skips 17 to 20 because we dont have digits 8 or 9 in base 8
What do computers count in (base)
Base 2
DO the same generalization, keep in mind we only have two digits
ex:
0 ->1 ->10 ->11 ->100 ->101 ->111
ANcient babylonians used
Base 16, they used all symbols
but if we wanted to use base 16, we would use our normal digits then add letters to it
Converting to Decimal (base 10)
- Look at the subscript at the end of the binary number
2.Start from the right, and multiply that number by the base raised to that column - DO this for each binary number until all done
- Add them all together
i.e
10010sub2
0x2^0 = 0
1x2^1 = 2
0x2^2=0
0x2^3=0
1x2^4=16
= 18
General way from vid:
1. Number the columns (withzero on the right)
2. Multiply each digits times base^column
3. Add it all up
How to tell which base we are counting in?
Using subscripts:
11sub10 = base 10
11sub2 = base 2
How does the column relate to base its raised to?
Column number used as what the base is raised to
ie
number: 5 9 7 8
column : 3 2 1 0
where 0 represents 1’s column, 2 is 10s, 3 is 100s
so think 10^0= 1, which is 1’s column
so for base 2
2^0 = 1 (represents column 0)
2^1 = 2 (represents column 1)
2^2 = 4 (represents column 2)
How to convert Hex to decimal
Keep in mind, the extra digits of hex( digits after 9, a b…) all correspond with decimal numbers still ie A=10 B =11, etc
so…
3FBsub16
Bx16^0= 11x16^0 = 11
Fx16^1= 15x16^1=240
3x16^3=3x16^2= 768
=1019
Converting to Binary(base 2)
they will give us a table that will help
- Find the largest power of two that is LESS than or EQUAL to the decimal number
- Put a one in that corresponding column
- Subtract the corresponding power of two from the decimal number
4.If we havent reached 0 yet, start over
example:
89
Largest power of two that fits in is 2^6=64
column 6 has a 1 now
89-64= 25 (not zero so must continue)
25 fits into 2^4=16
put a 1 in column 4
25-16= 9 (not zero so continue)
9 fits into 2^3=8
column 3 has a 1 now
9-8= 1 (not 0 so continue)
1 fits into 2^0
Column 0 has 1
1-1 = 0 so stop
Now look at whatever columns have 1 and fill in 0 where there is no 1
1011001sub2 is the binary
How to convert Binary to Hex
- Split the number into groups of four starting on the right
- Convert each into hex using table provided
ex: 111101100
split
1 1110 1100
1ECsub16
How to convert hex to binary
- Look on table, starting on right most hex number and see what binary coresponds with that digit
- Do it for each digit
ie: 3FB
11=3 1111=F 1011=B
Why is hex used?
Easier to convert between binary and hex than decimal and binary
-also much more compact, and more practical
-Since each byte is 8 binary digits (bits), there is two hex for every byte, so makes it easy to know how many bytes of info a number is
-harder to do that with decimal and break into bytes
What indicates something is in hex
3 ways:
1) Subscript 16
2) 0x infront of number ie 0x1234, common for programmers
3)# infront of number ie #1234
hashtage more common for designers
ASCII
American Standard Code for Information Interchange
Association that made a standard code for representing letters, symbols etc as numbers,
Essentially assigned each character with a number
Ex: Upper case A is 65
Table starts at 21, 0-31 are missing, and 127. This is because the teletype machines used by these govermnets, newspaper, etc to share info back and forth had special meaning for these number “called control characters”. Sending it would make noise, waste paper etc
Space is first and then exclamation mark
Goes from 0-127 so only need 7 bits of to represent each character , so fits into one byte with one leftover bit that can be used for detecting error
Character definition
Any letter, punctuation, symbol ie anything that you can type on a computer, emojis too
-greek roots, means making a cake but more related to making coins and how symbols were printed on coin
Why should u put exclamation mark infront of someones name if u want them to be first
BEcause it is the first visible character on ASCII system so it would be moved to the top, this choice better than AA because A is 65 whereas ! is 33
Unicode
-Helps to represent characters from different languages across the world
since ASCII is only 127, thre is room for more bc one bit left.
Ascii tried to add more characters but it didnt work and it was hard to encorporate othres so UNICODE was made
-supports 150 languages, and 100,000 characters, continously is expanded and evolved with new charaters, and ligatures (combined characters)
How does UNICODe work
-uses more than one byte per character
-most common way to store unicode is UTF-8 Standard (unicode transformation Formate) most websites use this because mixes plain ASCII with unicode, if it is ASCII, it uses one byte to store it, if not, uses multiple bytes
-include emojis, unlike ASCII
Digital Colour
Early Approach: assign numbers to colours
Con- very limited colour palette,
Think of representing grey: there is infinite number of greys between black and white (continous) so need to discretize them
WE can use one byte to represent shades of grey because then we have 256 values so 0 can be black 255 can be white and the various shades in between have many value options
Additive colour theory
opposite of subtractive (mixing colours makes it darker)
Computers use this
-Essentially the idea that Adding more colours makes it lighter, uses Red Green and Blue and different intensities to make all the colours
So we will use one byte for each colour (so one for red, one for blue and one for green) in order to make all colours by changing these intensities so in total 24 bits
What is the most common number of bit for representing colour on tv or any modern screen
24 bit colour
For red, if the number is 50 whatkind of red would it be
Since 0 represents black and 255 represents bright red, 50 would be a dark red
What does rgb (100,50,200) mean
Convention of specifying the intensities of each colour,
it would be medium red, little green and lots of blue, so makes a purple colour
rgb(0,0,0) is BLACK
What is rgb(255,255,255)
WHITE pure WHITE
what is #FF0000
Since the first two is hex digits for red, the second two for green, the third for blue,
FF is the highest intensity for red, 00 is lowest for green and blue so this is RED
000000 and #FFFFFF
0 one is black, f one is White
Is the first digit or second of each pair more important in a #F37E0B
So the hex pairs (two digit codes) are F3 7e and 0B
The most important is the first, so F7and 0
so this appears orange