egyptian numerals
play

Egyptian Numerals Egyptian number system is additive. Babylonian - PDF document

1900BC The Moscow papyrus is written. It gives details of Egyptian geometry. 30000BC Palaeolithic peoples in central Europe and France record numbers 1850BC on bones. Babylonians know Pythagoras's Theorem. 5000BC 1800BC


  1. • 1900BC The Moscow papyrus is written. It gives details of Egyptian geometry. • 30000BC Palaeolithic peoples in central Europe and France record numbers • 1850BC on bones. Babylonians know Pythagoras's Theorem. • 5000BC • 1800BC A decimal number system is in use in Egypt. Babylonians use multiplication tables. • 4000BC Babylonian and Egyptian calendars in use. • 1750BC The Babylonians solve linear and quadratic algebraic equations, compile • 3400BC The first symbols for numbers, simple straight lines, are used in tables of square and cube roots. They use Pythagoras's theorem and use Egypt. mathematics to extend knowledge of astronomy. • 3000BC • 1700BC The abacus is developed in the Middle East and in areas around The Rhind papyrus (sometimes called the Ahmes papyrus) is written. It the Mediterranean. A somewhat different type of abacus is used in shows that Egyptian mathematics has developed many techniques to China. solve problems. Multiplication is based on repeated doubling, and division • 3000BC uses successive halving. Hieroglyphic numerals in use in Egypt. • 1360BC • 3000BC A decimal number system with no zero starts to be used in China. Babylonians begin to use a sexagesimal number system for recording financial transactions. It is a place-value system without a • 1000BC zero place value. Chinese use counting boards for calculation. • 2000BC • 540BC Harappans adopt a uniform decimal system of weights and Counting rods used in China. measures. • 500BC • 1950BC Babylonians solve quadratic equations. The Babylonian sexagesimal number system is used to record and predict the positions of the Sun, Moon and planets. Egyptian Numerals Egyptian number system is additive. Babylonian numerals Mesopotamia Civilization Above: Babylonian sexagesimal (base 60) number. It is the first positional number system. Left: Oldest cuneiform writing by Sumerian.

  2. Chinese numerals Indian numerals 4359 Greek number systems Roman Numerals I 1 VI 6 L 50 II 2 VII 7 C 100 III 3 VIII 8 D 500 IV 4 IX 9 M 1000 V 5 X 10 MMMDCCCLXXVIII 3878 Mayan mathematics The numerals from al-Sizji's 250 AD to 900 AD, this period was built on top of a civilization which had lived in the region from about 2000 BC. treatise of 969 [8;14;3;1;12] represents 12 + 1 x 20 + 3 x 18 x 20 + 14 x 18 x 20 2 + 8 x 18 x 20 3 = 1253912.

  3. Abaci Logarithm and Slide Rule John Napier of Scotland developed the concept of logarithm around AD 1600. Chinese Abacus Slide rule based on the property of logarithm was invented in the late 1700s. If a y = x , then y = log a x log ( u v ) = log ( u ) + log( v ) Boethius (Hindu-Arabic) vs Pythagoras (counting board) Numbers: positional notation Decimal Numbers: Base 10 • Number Base B ⇒ B symbols per digit: Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 – Base 10 (Decimal): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Base 2 (Binary): 0, 1 • Number representation: Example: – d 31 d 30 ... d 1 d 0 is a 32 digit number 3271 = – value = d 31 × × B 31 + d 30 × × × × × × B 30 + ... + d 1 × × × × B 1 + d 0 × × B 0 × × (3x10 3 ) + (2x10 2 ) + (7x10 1 ) + (1x10 0 ) • Binary: 0,1 (In binary digits called “bits”) × 2 4 + 1 × × 2 3 + 0 × × 2 2 + 1 × × 2 1 + 0 × = 1 × × × × × × × × × × × × 2 0 – 0b11010 = 16 + 8 + 2 = 26 – Here 5 digit binary # turns into a 2 digit decimal # – Can we find a base that converts to binary easily? #s often written 0b… Hexadecimal Numbers: Base 16 Decimal vs. Hexadecimal vs. Binary Examples: Examples: 00 0 0000 • Hexadecimal: 01 1 0001 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F 1010 1100 0011 (binary) 1010 1100 0011 (binary) 02 2 0010 – Normal digits + 6 more from the alphabet = 0xAC3 = 0xAC3 03 3 0011 – In C, written as 0x… (e.g., 0xFAB5) 04 4 0100 10111 (binary) 10111 (binary) • Conversion: Binary ⇔ Hex 05 5 0101 = 0001 0111 (binary) = 0001 0111 (binary) 06 6 0110 – 1 hex digit represents 16 decimal values = 0x17 = 0x17 07 7 0111 – 4 binary digits represent 16 decimal values 08 8 1000 ⇒ 1 hex digit replaces 4 binary digits 0x3F9 0x3F9 09 9 1001 • One hex digit is a “nibble”. Two is a “byte” = 11 1111 1001 (binary) = 11 1111 1001 (binary) 10 A 1010 How do we convert between hex and How do we convert between hex and • Example: 11 B 1011 Decimal? Decimal? 12 C 1100 – 1010 1100 0011 (binary) = 0x_____ ? 13 D 1101 14 E 1110 15 F 1111

  4. What to do with representations of numbers? Which base do we use? • Just what we do with numbers! • Decimal: great for humans, especially when doing – Add them arithmetic – Subtract them • Hex: if human looking at long strings of binary 1 1 numbers, its much easier to convert to hex and look 4 – Multiply them bits/symbol – Divide them 1 0 1 0 – Terrible for arithmetic on paper – Compare them • Binary: what computers use; • Example: 10 + 7 = 17 you will learn how computers do +, -, *, / + 0 1 1 1 – …so simple to add in binary that we can – To a computer, numbers always binary build circuits to do it! – Regardless of how number is written: ------------------------- – subtraction just as you would in decimal 32 ten == 32 10 == 0x20 == 100000 2 == 0b100000 – Use subscripts “ten”, “hex”, “two” in book, slides when might – Comparison: How do you tell if X > Y ? be confusing 1 0 0 0 1 BIG IDEA: Bits can represent How to Represent Negative anything!! Numbers? • Characters? • So far, unsigned numbers – 26 letters ⇒ 5 bits (2 5 = 32) • Obvious solution: define leftmost bit to be sign! – upper/lower case + punctuation – 0 ⇒ +, 1 ⇒ - ⇒ 7 bits (in 8) (“ASCII”) – Rest of bits can be numerical value of number – standard code to cover all the world’s languages ⇒ 8,16,32 bits (“Unicode”) • Representation called sign and magnitude www.unicode.com • Logical values? • MIPS uses 32-bit integers. +1 ten would be: – 0 ⇒ False, 1 ⇒ True • colors ? Ex: 0000 0000 0000 0000 0000 0000 0000 0001 • locations / addresses? commands? • And –1 ten in sign and magnitude would be: • MEMORIZE: N bits ⇔ ⇔ at most 2 N things ⇔ ⇔ 1000 0000 0000 0000 0000 0000 0000 0001 Red (00) Green (01) Blue (11) Shortcomings of sign and Another try: complement the bits magnitude? • Arithmetic circuit complicated • Example: 7 10 = 00111 2 -7 10 = 11000 2 – Special steps depending whether signs are the same or not • Called One’s Complement • Also, two zeros • Note: positive numbers have leading 0s, negative – 0x00000000 = +0 ten numbers have leadings 1s. – 0x80000000 = -0 ten – What would two 0s mean for programming? 00000 00001 ... 01111 • Therefore sign and magnitude abandoned 11111 10000 ... 11110 • What is -00000 ? Answer: 11111 • How many positive numbers in N bits? • How many negative ones?

  5. Shortcomings of One’s complement? Standard Negative Number Representation • What is result for unsigned numbers if tried to subtract • Arithmetic still a somewhat complicated. large number from a small one? • Still two zeros – Would try to borrow from string of leading 0s, so result would have a string of leading 1s – 0x00000000 = +0 ten » 3 - 4 ⇒ 00…0011 - 00…0100 = 11…1111 – 0xFFFFFFFF = -0 ten – With no obvious better alternative, pick representation that made the hardware simple • Although used for awhile on some computer products, – As with sign and magnitude, one’s complement was eventually abandoned because leading 0s ⇒ positive, leading 1s ⇒ negative another solution was better. » 000000...xxx is ≥ 0, 111111...xxx is < 0 » except 1…1111 is -1, not -0 (as in sign & mag.) • This representation is Two’s Complement Sign and Magnitude Ones Complement (algebraically) -7 +0 +1 -6 1111 0000 Example: N = 4 N is positive number, then N is its negative 1's complement 1110 0001 -5 +2 + 1101 0010 N = (2 n 4 - 1) - N 2 = 10000 -4 +3 1100 0011 0 100 = + 4 -1 = 00001 -3 1011 0100 +4 1 100 = - 4 Example: 1's complement of 7 1010 0101 1111 -2 +5 - 1001 0110 +6 -7 = 0111 -1 1000 0111 +7 -0 1000 High order bit is sign: 0 = positive (or zero), 1 = negative -7 in 1's comp. Remaining low order bits is the magnitude: 0 (000) thru 7 (111) Bit manipulation: Number range for n bits = +/- 2 n-1 - 1 simply complement each of the bits Representations for 0? 0111 -> 1000 Operations: =, <, >, +, - ??? Twos Complement number wheel Ones Complement on the number wheel -0 +0 -1 +0 -1 +1 +1 1111 0000 -2 1111 0000 1110 0001 1110 0001 -2 +2 -3 +2 + + 1101 0010 1101 0010 like 1's comp -3 +3 except shifted -4 +3 1100 0011 0 100 = + 4 1100 0011 0 100 = + 4 one position -4 1011 clockwise -5 0100 +4 1 011 = - 4 1011 1 100 = - 4 0100 +4 1010 1010 0101 -5 -6 0101 +5 +5 - - 1001 1001 0110 0110 +6 +6 -6 1000 0111 -7 1000 0111 +7 -7 -8 +7 Easy to determine sign (0?) Subtraction implemented by addition & 1's complement Only one representation for 0 Sign is easy to determine Addition and subtraction just as in unsigned case Closure under negation. If A can be represented, so can -A Simple comparison: A < B iff A – B < 0 Still two representations of 0! One more negative number than positive number If A = B then is A – B == 0 ? - one number has no additive inverse Addition is almost clockwise advance, like unsigned

Recommend


More recommend