Lecture 1 - Slide
Lecture 1 - Slide
Data Representation
Outline
● Chapter 1: Bits and Bytes
● Chapter 2: Number Systems
● Chapter 3: Bits and Gigabytes
● Chapter 4: Other types of Data - all boils down to
numbers and bits
Chapter 1: Bits and Bytes
1.1 Bit & Byte
1.2 Patterns with N Bits
Bit & Byte
● It's the smallest unit for computer data storage and processing.
● Anything that can exist in two separate states can serve as a home for a bit.
● One byte can represent a character (a letter, or symbol), e.g. 'A' or 'x' or '$'
● 3 bits - 8 patterns (000, 001, 010, 011, 100, 101, 110, 111).
The binary system uses 1s and 0s only which gives these corresponding weightings:
128 64 32 16 8 4 2 1
27 26 25 24 23 22 21 20
1 1 0 1 (base-2)
1 X 20 = 1
0 X 21 = 0
1 X 22 = 4
1 X 23 = 8
8 + 4 + 0 + 1 = 13
11012= 1310
Decimal to Binary
The numbers 0 - 9 and the letters A - F are used to represent hexadecimal digits.
Hexadecimal Number System
Binary to Hexadecimal
B E 1
Hexadecimal to Binary
4 5 A
In case of fraction, the weights after the decimal point ( . ) will have the following
pattern.
0.1 1 1 (base-2)
1 X 2-1 = 0.5
0 X 2-2 = 0.25
1 X 2-3 = 0.125
(0.875)10
Fractions
How do we represent 0.3 in Binary?
0.3 X 2 = 0 .60
● Start with 0.3 and multiply with 2.
● Take the fractional part of the result and
0.6 X 2 = 1 .20 multiply it with 2 again.
● Keep doing it until … ?
0.2 X 2 = 0 .40
● We do have memory constraints so can’t
0.4 X 2 = 0 .80 continue indefinitely.
● The closest we can get is:
0.8 X 2 = 0 .60 ○ (0.01010)2 = (0.3125)10
○ (0.010001)2 = (0.28125)10
0.6 X 2 = 1 .20
● Which one is better? Why?
. . . . ● IEEE754: commonly used standard for
representing floating/real numbers in
computer.
Absolute and relative error
Absolute Error:
● Discrepancy between the measured and true values.
● Example: 1 cm error in height measurement.
Relative Error:
● Measures the error relative to the true value.
● Audio, image and video data typically stored in "compressed" form, e.g. MP3.
● The audio on a CD is not compressed, hence takes more space than MP3.
○ - 4 GB or RAM
● Nowadays, computer hard drives can have storage capacities of 1-2 terabytes (TB).
● The rate that a CPU can do its simplest operation per second.
● Higher gigahertz CPUs consume more power, and generate increased heat.
A text file basically holds a sequence of characters all represented by the ASCII /
Unicode based numbers.
Images
How much memory do you need to store a 500 x 500 pixel color image, if it is not
compressed in any way?
How much memory do you need to store 1 minute color video shot with 60 fps?
Assume (the image size is 500 x 500)
If a sampling rate of 44 KHz (44K samples per second) is used with 128-bit rate (or sampling
resolution), how much storage will be required to store a typical Bangla song?
Time series generally applies to any data where some quantity (sound amplitude for Audio)
is stored at different times.
● Weather data
● Rainfall measurements
● Heart rate monitoring (EKG)
● Brain monitoring (EEG)
● Quarterly sales
● Stock prices
● Automated stock trading
● Industry forecasts
● Interest rates
Question: what trend do you see here?