Types of Numbers Complex Russian Dolls Model Real What is a Number? Rational Integer Seminar 2 Types of Numbers Natural Number Systems Representation in Computers C N Z Q R N ine Z ulu Q ueens R uled C hina Natural Numbers Integers N • Addition - Closed • Addition - Closed • Multiplication - Closed • Multiplication - Closed Counting Numbers • Subtraction - Not Closed • Subtraction - Closed • Division - Not Closed • Division - Not Closed Solving the Subtraction Problem: Solving the Division Problem: • Discovery of zero (600 CE) • Discovery of rational numbers • Discovery of negative numbers • Ratios between two integers • Han Dynasty 220 BCE - 202 CE • Europe: 17th century CE - Common era
Rational Numbers Decimal Representation of Fractions Rational numbers are simple quantities: Q • They can be understood in finite terms; • Yet they can be used to represent distances as small or as • Addition - Closed Numerator large as we please Denominator • Multiplication - Closed • Subtraction - Closed Numerator, Denominator are integers The denominator can not be 0 • Division - Closed Decimal Representation 1 3 = 0 . 333333333 . . . , Rational numbers are dense . Between any two of 29 Fractions are ultimately periodic : 12 = 2 . 416666666 . . . , after a certain point the infinite them, you can always find another! 9 7 = 1 . 285714285714285 . . . , sequence of digits consists of some • Between 0 and 1 there an infinite number of rationals! finite sequence of digits repeated 237 148 = 1 . 60135135135 . . . indefinitely! Are the rationals adequate? Real Numbers R Since the rationals are dense, do we need any other quantity or can we Real Numbers = Rational Numbers + Irrational Numbers even fit anything more on the number line? An irrational number is any number that can not be expressed as a ratio a / b where a and b are integers and b is not equal to 0 a 2 + b 2 c 2 = What is the length of the diagonal of the unit square? 1 2 + 1 2 √ = 2 = 1 . 4142135623730950488016887 . . . ? = 1 + 1 = 2 In decimal notation an irrational number is any number that can not be represented as terminating or repeating decimals. c 2 = 2 Can not be expressed as In decimal notation a rational number is any number that can be √ the ratio of two integers! = 2 c represented as terminating or repeating decimals. It is an irrational number!
Real Numbers Countability Some important irrational numbers in engineering! Dense Q π = C R Continuous d � � π = 3 . 141592653589793238462643383279 . . . ∞ ∞ →∞ e ln( x ) = x Are some infinite sets bigger than others? N ⊂ Q ⊂ R Euler’s number ln( e x ) = x e = 2 . 7182818284590452353602874713526 . . . Q R e = 1 + 1 1 1 1 1 + 1 × 2 + 1 × 2 × 3 + 1 × 2 × 3 × 4 + · · · × × Countable Uncountable � 1 + 1 � n e = lim n →∞ Infinite Processes! n Continuum Hypothesis (Cantor) - There is no set whose cardinality is strictly between that of the integers and that of the real numbers. Since they are important numbers, we will want to represent them in a computer! Number Systems Number Systems ⊂ ⊂ The base of a system specifies the number of digits used 7365 = 7 × 10 3 + 3 × 10 2 + 6 × 10 1 + 5 × 10 0 Base-10: Decimal number system: Digits 0-9 Lets generalize from base 10 to any base: Numbers are written and manipulated using positional notation . × × × · · · If a number in the base- B number system has n digits, it is represented as the following polynomial, where d i represents the digit in × × × × the i -th position d n × B n − 1 + d n − 1 × B n − 2 + · · · + d 2 × B 1 + d 1 Base-2: Binary number system: Digits 0-1 Base-8: Octal number system: Digits 0-7 Base-16: Hexadecimal number system: Digits 0-9, Letters A-F
Binary Number System From Binary to Decimal × × × × × × × d n × 2 n − 1 + d n − 1 × 2 n − 2 + · · · + d 2 × 2 1 + d 1 d n × B n − 1 + d n − 1 × B n − 2 + · · · + d 2 × B 1 + d 1 ⊂ ⊂ Decimal: B=10: 7365 = 7 × 10 3 + 3 × 10 2 + 6 × 10 1 + 5 × 10 0 × − × × · · · d n × 10 n − 1 + d n − 1 × 10 n − 2 + · · · + d 2 × 10 1 + d 1 Binary: B=2: 1101 = 1 × 2 3 + 1 × 2 2 + 0 × 2 1 + 1 × × × d n × 2 n − 1 + d n − 1 × 2 n − 2 + · · · + d 2 × 2 1 + d 1 How about from Decimal to Binary? Examples Binary Representation of a Positive Integer 1. Divide the value by 2 and record the remainder. 2. As long as the quotient obtained is not 0, continue What is the binary representation of 8? to divide the newest quotient by two and record the remainder 3. Now that the quotient of 0 has been obtained, the binary representation of the original value consists What is the binary representation of 5? of the remainders listed from right to left in the order they were recorded.
Hexadecimal system Some Examples × × × × d n × B n − 1 + d n − 1 × B n − 2 + · · · + d 2 × B 1 + d 1 What is 11000011 in hexadecimal notation? × − × × · · · C 3 B=16: d n × 16 n − 1 + d n − 1 × 16 n − 2 + · · · + d 2 × 16 1 + d 1 What is 11111101 in hexadecimal notation? • Since there are only 10 decimal digits but the Decimal ! Binary ! F D Hex ! base is 16, we need additional digits: A,B,C,D,E,F • Hexadecimal is shorthand notation for long 0 0 0000 1 1 0001 patterns of bits. 2 2 0010 3 3 0011 • Each group of 4 bits can be represented by a 4 4 0100 5 5 0101 What is E6 in decimal notation? single symbol. 6 6 0110 • 8 bits: 2 digits, 16 bits: 4 digits, 32 bits, 8 digits 7 7 0111 8 8 1000 1110 0110 9 9 1001 A 10 1010 10100011 becomes A3 B 11 1011 E*16 1 + 6*16 0 = 230 C 12 1100 D 13 1101 A 3 14*16 1 + 6*16 0 = 230 E 14 1110 F 15 1111 BITS - Binary Digits Information Storage & Processing Information in a computer is encoded as patterns of 1’s and 0’s. Goal: To understand how all modern computing systems and computation using such systems are based on binary numbers and Information = Bits + Context operations on them! The context provides an interpretation of the bit patterns! Computers execute binary computations. Any information we The same bit pattern can mean different things. process is ultimately encoded and stored as binary numbers! For instance, a numerical value, character or a program instruction! Images Video Text Symbols Sound Logical Computations Numerical Computations And, Or 1= true 1 Addition, Subtraction 0= false Not 0 Multiplication, Division Context: logic Context: Numbers Any process on data is ultimately encoded and stored as binary numbers!
Bits and Bytes Bytes and Words Decimal ! ! Machine(Has(“Word(Size”( Binary ! Hex ! ! Nominal(size(of(integer0valued(data( Most computers use blocks of 8 bits, or bytes, 0 0 0000 1 1 0001 as the smallest addressable unit of memory 2 2 0010 ! Including(addresses( 3 3 0011 4 4 0100 ! Most(current(machines(use(32(bits((4(bytes)(words( 5 5 0101 Byte ¡= ¡8 ¡bits ¡ 6 6 0110 7 7 0111 ! Limits(addresses(to(4GB( 8 8 1000 Binary ¡00000000 2 ¡to ¡11111111 2 ¡ 9 9 1001 ! Becoming(too(small(for(memory0intensive(applicaDons( A 10 1010 B 11 1011 Decimal: ¡0 10 ¡to ¡255 10 ¡ C 12 1100 ! High0end(systems(use(64(bits((8(bytes)(words( D 13 1101 E 14 1110 ! PotenDal(address(space(≈(1.8(X(10 19 (bytes( Hexadecimal ¡00 16 ¡to ¡FF 16 F 15 1111 ! x86064(machines(support(480bit(addresses:(256(Terabytes( (1000 4 ) ! Machines(support(mulDple(data(formats( ! FracDons(or(mulDples(of(word(size( ! Always(integral(number(of(bytes( Metric Prefixes Storage: Main Memory Memory Cell: is a unit of memory (usually a byte), organized in a bit order: What is a Googol? 10 100 What is a current estimate Address: A “name” that uniquely identifies one cell in the computer’s main memory of atoms in the • The names are actually numbers. • These numbers are assigned consecutively starting at zero. “observable” universe? • Numbering the cells in this manner associates an order with the memory cells 10 80 00•••0 FF•••F Byte Oriented Memory Organization • • • ! Virtual Memory: Programs refer to virtual addresses • Conceptually, it is a very large array of bytes. • System is actually implemented with a hierarchy of different memory types.
Recommend
More recommend