MATH 1020: Mathematics For Non-science Chapter 3: Information in a networked age

54
MATH 1020: MATH 1020: Mathematics For Non-science Chapter 3: Chapter 3: Information in a networked age 1 Instructor: Dr. Ken Tsang Room E409-R9 Email: [email protected]

description

MATH 1020: Mathematics For Non-science Chapter 3: Information in a networked age. Instructor: Dr. Ken Tsang Room E409-R9 Email: kentsang @uic.edu.hk. Transmitting Information. Binary codes Data compression Encoding with parity-check sums Cryptography - PowerPoint PPT Presentation

Transcript of MATH 1020: Mathematics For Non-science Chapter 3: Information in a networked age

Page 1: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

MATH 1020: MATH 1020: Mathematics For Non-science

Chapter 3: Chapter 3: Information in a networked age

1

Instructor: Dr. Ken Tsang

Room E409-R9

Email: [email protected]

Page 2: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

Transmitting Information

– Binary codes– Data compression– Encoding with parity-check sums– Cryptography– Model the genetic code

2

Page 3: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

Information , data & numbersInformation , data & numbers

Today information are transmitted all over the world through the internet

Information is just collection of data– Pictures – jpg, tif …– Sound – mp3, mp4– Video – wmv, mvb

Data consisted of numbers

3

Page 4: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

4

Decimal Number SystemDecimal Number System As human normally counts with hands and there are

totally 10 fingers on both hands, this probably explains the origin of the decimal number system.

10 digits:– 0,1,2,3,4,5,6,7,8,9

Also called base-10 number system, – Or Hindu-Arabic, or Arabic system

Counting in base-10– 1,2,…,9,10,11,…,19,20,21,…,99,100,…

Decimal number in expanded notation– 234 = 2 * 100 + 3 * 10 + 4 * 1

Page 5: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

Hindu–Arabic numeral systemHindu–Arabic numeral system The Brahmi (ancient Indian) numerals at the basis of the system

predate the Common Era. The development of the positional decimal system occurred during the

Gupta period (笈多王朝 , 320 to 540 CE). Aryabhata, a Gupta period scholar, is believed to be the first to come up

with the concept of zero.

These Indian developments were taken up in Islamic mathematics in the 8th century.

A young Italian in the 12th century, Fibonacci, traveled throughout the Mediterranean world to study under the leading Arab mathematicians of the time, recognizing that arithmetic with Hindu-Arabic numerals is simpler and more efficient than with Roman numerals.

5

Page 6: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

Fibonacci (1170-1250 CE)Fibonacci (1170-1250 CE) Italian mathematician, Leonardo Fibonacci

(through the publication in 1202 of his Book of Calculation, the Liber Abaci) introduced the Arabic numerals, the use of zero, and the positional decimal system to the Latin world.

Liber Abaci showed the practical importance of the new numeral system, by applying it to commercial bookkeeping.

6

The numeral system came to be called "Arabic" by the Europeans. It was used in European mathematics from the 12th century, and entered common use from the 15th century.Fibonacci significantly influenced the evolution of capitalist enterprise and public finance in Europe in the centuries that followed.

Page 7: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

7

Positional Numbering SystemPositional Numbering SystemThe value of a digit in a number

depends on:– The digit itself– The position of the digit within the number

So 123 is different from 321– 123: 1 hundred, 2 tens, and 3 units– 321: 3 hundred, 2 tens, and 1 units

Page 8: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

Roman numeralsRoman numeralsRoman numerals are numeral system of ancient

Rome based on the letters of the alphabetThe first ten Roman numerals are I, II, III, IV, V, VI,

VII, VIII, IX, and X. (no zero)Tens: X; hundreds: C; thousands: MNon-positional: e.g.

– 321 CCCXXI– 982 CMLXXXII– 2010 MMX

8

Page 9: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

Non-decimal Number SystemsNon-decimal Number Systems

The Maya civilization and other civilizations of pre-Columbian Mesoamerica used base-20 (vigesimal), as did several North American tribes (two being in southern California).

Evidence of base-20 counting systems is also found in the languages of central and western Africa.

The Irish language also used base-20 in the past. Danish numerals display a similar base-20 structure.

9

Page 10: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

10

Base Base rr Number System Number SystemFor any value For any value rrValue is based on the sum of a power

series in powers of rr

rr is called the base, or radix

Page 11: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

11

Binary Number SystemBinary Number SystemBinary number system has only two digits

– 0, 1– Also called base-2 system

Counting in binary system– 0, 1, 10, 11, 100, 101, 110, 111, 1000,….

Binary number in expanded notation– (1011)2 = 1*23 + 0*22 + 1*21 + 1*20

– (1011)2 = 1*8 + 0*4 + 1*2 + 1*1 = (11)10

Page 12: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

12

Why Binary? Why Binary? Computer is a Binary machine It knows only ones and zeroes Easy to implement in electronic

circuitsReliableCheap

Page 13: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

13

Gottfried Leibniz (1646-1716)Gottfried Leibniz (1646-1716)Leibniz, German mathematician

and philosopher, invented at least two things that are essential for the modern world: calculus, and the binary system.

He invented the binary system around 1679, and published in 1701. This became the basis of virtually all modern computers.

Page 14: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

14

Leibniz's Step ReckonerLeibniz's Step Reckoner

Leibniz designed a machine to carry out multiplication, the 'Stepped Reckoner'. It can multiple number of up to 5 and 12 digits to give a 16 digit operand. The machine was later lost in an attic until 1879.

Page 15: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

Leibniz & Leibniz & I-Ching I-Ching (( 易经易经 ))

As a Sinophile, Leibniz was aware of the I-Ching and noted with fascination how its hexagrams correspond to the binary numbers, and concluded that this mapping was evidence of major Chinese accomplishments in the sort of philosophical mathematics he admired.

15

Page 16: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

16

An ancient Chinese binary An ancient Chinese binary number system in Yi-Jing (number system in Yi-Jing ( 易经易经 ))

Two symbols to represent 2 digits Zero: represented by a broken line One: represented by an unbroken line “—” yan 阳爻,“ --” yin 阴爻。

Page 17: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

17

HexadecimalHexadecimalHexadecimal number system has 16 digits

• 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F• Also called base-16 system

Counting in Hexadecimal– 0,1,…,F,10,11,…,1F,20,…FF,100,…

Hexadecimal number in expanded notation

– (FF)16 = 15*161 + 15*160 = (255)10

Page 18: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

18

Some Numbers to Some Numbers to RememberRemember

Page 19: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

19

Bit and Byte Bit and Byte BIT = Binary digIT, “0” or “1”State of on or off ( high or low) of a

computer circuitKilo 1K = 210 = 1024 ≈ 103 Mega 1M = 220 = 1,048,576 ≈ 106 Giga 1G = 230 = 1,073,741,824 ≈ 109

Page 20: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

20

Bit and Byte Bit and Byte Byte is the basic unit of addressable memory 1 Byte = 8 BitsThe right-most bit is called the LSB

Least Significant BitThe Left-most bit is called the MSB

Most Significant Bit

Page 21: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

21

Natural NumbersNatural NumbersNatural numbers

– Zero and any number obtained by repeatedly adding one to it

Negative Numbers– A value less than 0, with a – sign

Integers– A natural number, a negative number, zero

Rational Numbers– An integer or the quotient of two integers

We will only discuss the binary representation of non-negative integers

Page 22: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

22

Why Hexadecimal?Why Hexadecimal?Hexadecimal is meaningful to humans, and

easy to work with for a computerCompact

– A BYTE is composed of 8 bits– One byte can thus be expressed by 2 digits in

hexadecimal– 11101111 EF– 11101111b EFh

Simple to convert them to binary

Page 23: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

23

Binary to Decimal

Conversions Conversions Between Number SystemsBetween Number Systems

Page 24: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

24

Conversions Conversions Between Number SystemsBetween Number Systems

Hexadecimal to Decimal

Page 25: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

25

Conversions Conversions Between Number SystemsBetween Number Systems

Octal to Decimal

– (32)8 = (?)10

What’s wrong?

– (187)8 = 1*64 + 8*8 + 7*1

Page 26: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

26

Conversions Conversions Between Number SystemsBetween Number Systems

Decimal to Binary

Reading the remainders from bottom to top, we have 32110 = 1010000012

remainderquotient

321 / 2 = 160 1 160 / 2 = 80 0 80 / 2 = 40 0 40 / 2 = 20 0 20 / 2 = 10 0 10 / 2 = 5 0 5 / 2 = 2 1 2 / 2 = 1 0 1 / 2 = 0 1

32110 = ?2

Page 27: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

27

One More ExampleOne More ExampleConvert 14710 to binary

So, 14710 = 100100112

Page 28: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

28

Conversions Conversions Between Number SystemsBetween Number Systems

Decimal to Base rr– Same as Decimal to Binary– Divide the number by rr– Record the quotient and remainder– Divide the new quotient by rr again– …..– Repeat until the newest quotient is 0 – Read the remainder from bottom to top

Page 29: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

29

Analogue DataAnalogue Data Analogue: something that is analogous or

similar to something else (Webster) Analogue Data: The use of continuously

changing quantities to represent data. A mercury thermometer is an analogue device.

The mercury rises and falls in a continuous flow in the tube in direct proportion to the temperature.

The mathematical idealization of this smooth change as a continuous function leads to “Analogue Data”, an infinite amount of data

Page 30: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

30

From Analogue to Digital dataFrom Analogue to Digital dataData can be represented in one of two ways:

analogue or digital:

Analogue data: A continuous representation (using mathematical function or smooth curve) , analogous to the actual information it represents

Digital data: A discrete representation, breaking the information up into separate elements (data)

Page 31: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

31

Digitized InformationDigitized InformationComputers, cannot work with analogue

information So we digitize information by breaking it into

pieces and representing those pieces separatelyWhy do we use binary?

– Modern computers are designed to use and manage binary values because the devices that store and manage the data are far less expensive and far more reliable if they only have to represent one of two possible values.

Page 32: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

32

Binary RepresentationBinary RepresentationOne bit can be either 0 or 1 (“on” & “off”

electronic signals)Therefore, one bit can represent only two things To represent more than two things, we need

multiple bitsTwo bits can represent four things because

there are four combinations of 0 and 1 that can be made from two bits: 00, 01, 10, 11

Page 33: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

33

Binary RepresentationBinary Representation

Represents2 numbers

Represents2 numbers

44

1616

3232

88

Page 34: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

34

Binary RepresentationBinary RepresentationIn general, n bits can represent 2n things because there

are 2n combinations of 0 and 1 that can be made from n bits

Note that every time we increase the number of bits by 1, we double the number of things we can represent

Questions:– How many bits are needed to represent 128 things?– How many bits are needed to represent 67 things?

Page 35: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

35

Binary mathematicsBinary mathematics

Logical operations

AND OR XOR

Page 36: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

36

ASCIIASCIIASCII stands for American Standard

Code for Information InterchangeThe ASCII character set originally used

seven bits to represent each character, allowing for 128 unique characters

Later ASCII evolved so that all eight bits were used which allows for 256 characters

Page 37: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

37

ASCII codeASCII code

Page 38: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

38

ASCIIASCII

Note that the first 32 characters in the ASCII character chart do not have a simple character representation that you could print to the screen (unprintable)

Page 39: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

39

Unicode charactersUnicode charactersExtended version of the ASCII character set is

not enough for international use The Unicode character set uses 16 bits per

character– Therefore, the Unicode character set can represent 216, or over

65 thousand, characters

Unicode was designed to be a superset of ASCII– The first 256 characters in the Unicode character set

correspond exactly to the extended ASCII character set

With the Unicode, all text (in most languages) information can be represented.

Page 40: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

40

UnicodeUnicode4 Hex-numerals to represent 1 Unicode

Page 41: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

41

To digitize the signal we periodically measure the voltage of the signal and record the appropriate numeric value– this process is called sampling

In general, a sampling rate of around 40,000 times per second is enough to create a reasonable sound reproduction

Representing Audio Representing Audio InformationInformation

Page 42: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

42

Representing Audio Representing Audio InformationInformation

Page 43: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

43

• A compact disk (CD) stores audio information digitally • On the surface of the CD are microscopic pits that represent Binary digits•A low intensity laser is pointed as the disc•The laser light reflects strongly if the surface is smooth and reflects poorly if the surface is pitted

Representing Audio Representing Audio InformationInformation

Page 44: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

44

Audio Formats– WAV, AU, AIFF, VQF, and MP3

MP3 is dominant – MP3 is short for MPEG (Moving Picture Experts Group)

audio layer 3 file– MP3 employs both lossy and lossless compression– First it analyzes the frequency spread and compares it to

mathematical models of human psychoacoustics (the study of the interrelation between the ear and the brain), then it discards information that can’t be heard by humans

– Then the bit stream is compressed to achieve additional compression

Representing Audio Representing Audio InformationInformation

Page 45: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

Image BasicsImage Basics

00000000000000000011110000000000000000 00000000000000001100001100000000000000 00000000000000010000000010000000000000 00000000000000100000000001000000000000 00000000000000100010001001000000000000 00000000000001000111011100100000000000 00000000000001000010001000100000000000 00000000000001000000000000100000000000 00000000000001000000000000100000000000 00000000000001001000000100100000000000 00000000000000100100001001000000000000 00000000000000100011110001000000000000 00000000000000010000000010000000000000 00000000000000001100001100000000000000 00000000000000000011110000000000000000 00011110010000000000000000000000000000 01100010010000000000000000000000000000 11000100100000000000000000000000000000 00000100100001110001011000101100100100 00111111110010010001101000110101100100 00001001000100100111001011100101001000 00010010000101101010010101001011011010 00010010000110110111111011111101101100 00000000000000000100000010000000011000 00000000000000001100000110000000110000 00000000000000001000000100000000100000

46

Page 46: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

1-bit, black and white

8-bit grayscale

48

Page 47: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

49

Representing ColorRepresenting ColorColor is often expressed in a computer as an

RGB (red-green-blue) value, which is actually three numbers that indicate the relative contribution of each of these three primary colours

For example, an RGB value of (255, 255, 0) maximizes the contribution of red and green, and minimizes the contribution of blue, which results in a bright yellow

Page 48: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

RGB ModelRGB ModelRGB Color Model

– Red – Green – Blue– Additive model combines varying amounts of

these 3 colors

50

Page 49: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

Image BasicsImage Basics

(0, 0, 0) is black

(255, 255, 255) is white

(255, 0, 0) is red

(0, 255, 0) is green

(0, 0, 255) is blue

(0, 255, 255) is cyan

(255, 0, 255) is magenta

(255, 255, 0) is yellow

53

Page 50: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

54

Three Dimension Color Three Dimension Color SpaceSpace

(0,0,0)

(1,1,1)

Page 51: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

55

DAC

Composing color imageComposing color imageStore the actual intensities of R, G, and B

individually in the framebuffer24 bits per pixel = 8 bits red, 8 bits green, 8

bits blue

Page 52: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

58

Digitized Images and GraphicsDigitized Images and Graphics

Digitizing a picture is the act of representing it as a collection of individual dots called pixels

The number of pixels used to represent a picture is called the resolution

Several popular raster file formats including bitmap (BMP), GIF, and JPEG

Page 53: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

Image BasicsImage Basics

Bitmap– Grid of pixels

59

Page 54: MATH 1020:  Mathematics For Non-science Chapter 3:  Information in a networked age

60

BMPBMP