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

Presentation on theme: "MATH 1020: Chapter 3: MATH 1020: Mathematics For Non-science Chapter 3: Information in a networked age 1 Instructor: Dr. Ken Tsang Room E409-R9 Email:"— Presentation transcript:

MATH 1020: Chapter 3: MATH 1020: Mathematics For Non-science Chapter 3: Information in a networked age 1 Instructor: Dr. Ken Tsang Room E409-R9 Email: kentsang@uic.edu.hk@uic.edu.hk

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

Information, 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

4 Decimal 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

Hindu–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

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.

7 Positional Numbering System The 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

Roman numerals Roman numerals are numeral system of ancient Rome based on the letters of the alphabet The first ten Roman numerals are I, II, III, IV, V, VI, VII, VIII, IX, and X. (no zero) Tens: X; hundreds: C; thousands: M Non-positional: e.g. – 321  CCCXXI – 982  CMLXXXII – 2010  MMX 8

Non-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

10 Base r Number System For any value r For any value r r Value is based on the sum of a power series in powers of r r r is called the base, or radix

11 Binary Number System Binary 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*2 3 + 0*2 2 + 1*2 1 + 1*2 0 – (1011) 2 = 1*8 + 0*4 + 1*2 + 1*1 = (11) 10

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

13 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.

14 Leibniz'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.

Leibniz & 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

16 An ancient Chinese binary 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 阴爻。

17 Hexadecimal Hexadecimal 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*16 1 + 15*16 0 = (255) 10

18 Some Numbers to Remember

19 Bit and Byte BIT = Binary digIT, “0” or “1” State of on or off ( high or low) of a computer circuit Kilo 1K = 2 10 = 1024 ≈ 10 3 Mega 1M = 2 20 = 1,048,576 ≈ 10 6 Giga 1G = 2 30 = 1,073,741,824 ≈ 10 9

20 Bit and Byte Byte is the basic unit of addressable memory 1 Byte = 8 Bits The right-most bit is called the LSB Least Significant Bit The Left-most bit is called the MSB Most Significant Bit

21 Natural Numbers Natural 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

22 Why Hexadecimal? Hexadecimal is meaningful to humans, and easy to work with for a computer Compact – A BYTE is composed of 8 bits – One byte can thus be expressed by 2 digits in hexadecimal – 11101111  EF – 11101111 b  EF h Simple to convert them to binary

23 Binary to Decimal Conversions Between Number Systems

24 Conversions Between Number Systems Hexadecimal to Decimal

25 Conversions Between Number Systems Octal to Decimal – (32) 8 = (?) 10 What’s wrong? – (187) 8 = 1*64 + 8*8 + 7*1

26 Conversions Between Number Systems Decimal to Binary Reading the remainders from bottom to top, we have 321 10 = 101000001 2 remainderquotient 321 / 2 =1601 160 / 2 =800 80 / 2 =400 40 / 2 =200 20 / 2 =100 10 / 2 =50 5 / 2 =21 2 / 2 =10 1 / 2 =01 321 10 = ? 2

27 One More Example Convert 147 10 to binary So, 147 10 = 10010011 2

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

29 Analogue 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

30 From Analogue to Digital data Data 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)

31 Digitized Information Computers, cannot work with analogue information So we digitize information by breaking it into pieces and representing those pieces separately Why 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.

32 Binary Representation One 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 bits Two 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

33 Binary Representation Represents 2 numbers Represents 2 numbers 4 4 16 32 8 8

34 Binary Representation In general, n bits can represent 2 n things because there are 2 n 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?

35 Binary mathematics Logical operations ANDORXOR

36 ASCII ASCII stands for American Standard Code for Information Interchange The 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

37 ASCII code

38 ASCII 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)

39 Unicode characters Extended 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 2 16, 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.

40 Unicode 4 Hex-numerals to represent 1 Unicode

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 Information

42 Representing Audio Information

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 Information

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 Information

Representing Image Pixel – Picture element – Smallest unit that can be displayed on a screen Simplest graphics are black and white – 0 – white – 1 - black 45

Image 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

Bit depth Bit depth: Number of bits per pixel – 1 bit – black and white – 4 bits – 16 colors (2 4 ) – 8 bits – 256 colors (2 8 ) – 16 bits – 65,536 colors (2 16 ) – 24 bits – 16,777,216 colors (2 24 ) Bit depth controls image file size – Higher the bit depth = larger file 47

1-bit, black and white 8-bit grayscale 48

49 Representing Color Color 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

RGB Model RGB Color Model – Red – Green – Blue – Additive model combines varying amounts of these 3 colors 50

Color Image Individual pixels represented in memory as a – Red value – Green value – Blue value Values represent intensity – If red is more intense, the color perceived is towards the red 51

Image Basics 24-bit color pixel value means – 8 bits for each RGB value – 256 possible values for each primary color – Values expressed as 0 – 255 52

Image 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

54 Three Dimension Color Space (0,0,0) (1,1,1)

55 DAC Composing color image Store the actual intensities of R, G, and B individually in the framebuffer 24 bits per pixel = 8 bits red, 8 bits green, 8 bits blue

Resolution Resolution – Number of pixels per unit of measurement dpi = dots (pixels) per inch – Typical monitor is 72 dpi – Total sizes range from 320 x 200 1280 x 1024 – Higher resolution equals sharper image 56

Graphic File size Memory (file) size – Number of pixels times 3 – 640 x 480 pixels in size – 640 x 480 = 307,200 total pixels – 307,200 x 3 = 921,600 bytes 57

58 Digitized 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

Image Basics Bitmap – Grid of pixels 59

60 BMP

61 Understanding Data Compression Some image formats compress their data – GIF, JPEG, PNG Others, like BMP, do not compress their data – Use data compression tools for those formats Data compression – Coding of data from a larger to a smaller form – Types Lossless compression and lossy compression

Download ppt "MATH 1020: Chapter 3: MATH 1020: Mathematics For Non-science Chapter 3: Information in a networked age 1 Instructor: Dr. Ken Tsang Room E409-R9 Email:"

Similar presentations