New version page

UNC-Chapel Hill COMP 004 - Representing Concepts, Part 1

Pages: 30
Documents in this Course

11 pages

2 pages

25 pages

8 pages

39 pages

4 pages

3 pages

28 pages

4 pages

5 pages

17 pages

7 pages

3 pages

Unformatted text preview:

Representing concepts, Part 1Representing conceptsSlide 3Slide 4Slide 5Slide 6Slide 7Positional systemsSlide 9Slide 10Slide 11Positional valuesSlide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22Slide 23Numeric values in binary systemsSlide 25Negative numbersSlide 27Digression: Limitations on precisionSlide 29Slide 30COMP 4—Power Tools for the Mind1What’s in the box?Representing concepts, Part 1What we’ll cover for Part 1 :•Representing concepts in a computer–Five concept types–Numbering systems:•additive•positional–How to represent our decimal number values in a computer containing on-off switchesPower ToolsCOMP 4—Power Tools for the Mind2What’s in the box?•How do humans represent concepts? Examine:–Annual earnings of a UNC-CH faculty member.–Script of Gone with the Wind.–Set of fingerprints found in a police department.–Tarzan yell.–Recipe for making chicken fajitas.•Five basic kinds of concepts (data/information)•Want a single, common way to represent all five.–Can be encoded as numbers; which in turn can appear as signals at the hardware level.Representing conceptsCOMP 4—Power Tools for the Mind3What’s in the box?Representing numeric values•Additive:  / / / / /–Are any systems we use additive?•Can some symbols have a face value other than 1? •Positional: –Face value •Unique symbols: represent elementary quantities.–Place value•Value determined by position it occupies.•Base determines how many unique symbols are used.–Raising the base to all its powers gives the place value. –Total value: face value * place value.COMP 4—Power Tools for the Mind4What’s in the box?Counting with ten fingers (& Arabic numbers)0 1 2 3 4 5 6 7 8 9--Symbols represent values from 0 through 9.--How do we represent values greater than 9? Use other symbols?--Base? baseplace valuespowers104 103 102 101 100 10,000 1,000 100 10 1 2 3 1 7 8 6 0 4 1 3How would you describeyour algorithm tofind the total value of each number?COMP 4—Power Tools for the Mind5What’s in the box?Suppose, we count with only 5 fingers...Symbols? WHAT has changed?? What remains same??baseplace valuespowers b4 b3 b2 b1 b0625 125 25 5 1 2 1 1 five = ??ten 4 0 3 five = ??tenNotice base notation: numberbaseDecimal is most common, so may omit base notation.Suppose, we count with only 2 fingers...Base? Number of symbols?Quiz: How would you represent the value 2?0 1 2 3 4COMP 4—Power Tools for the Mind6What’s in the box?baseplace valuespowers 26 25 24 23 22 21 20 64 32 16 8 4 2 1 0 1 1 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0Notice as you read down, looks somewhat like an advancing odometer:Note 0 as “place holder” for the least significant digits with 0 value.COMP 4—Power Tools for the Mind7What’s in the box?100000 10000 1000 100 10 1 0 1 2 3 4 5 6 7 8 9 baseplace valuespowers 105 104 103 102 101 100Same thing for base ten: 1 0 1 1 1 2 ... 2 0 ... 9 9 ... 1 0 0COMP 4—Power Tools for the Mind8What’s in the box?Positional systems•What determines number of unique symbols used in a positional numbering system, then?•What determines value of each position?•Here’s a number: 1110–What value does it represent? (what is its decimal equivalent?)But WAIT!…what’s the problem here?COMP 4—Power Tools for the Mind9What’s in the box?Base 10 place values: 10,000 1,000 100 10 1 625 125 25 5 1Base 5 place values: 16 8 4 2 1Base 2 place values: 1 1 1 0 base xFace values:Dec.Value:Same algorithm: Sum of (face*place) =Base x:Base 10:Base 5:Base 2:1*1000 + 1*100 + 1*10 + 0*1 =1* 125 + 1*25 + 1*5 + 0*1 =1* 8 + 1* 4 + 1*2 + 0*1 =1,110 155 14Even more fingers…….Hexadecimal–0 1 2 3 4 5 6 7 8 9BEEF16 What is its decimal equivalent?164 163 162 161 160 baseplace valuesface valuespowers 65,536 4,096 256 16 1B E E F 16What algorithm do you use to find total value?11*4096 + 14*256 + 14*16 + 15*1 = 48,87910A B C D E F 10 11 12 13 14 15 dec value•Base 16: quick---how many fingers…or symbols? 2 A D10= 68510Hexadecimal ... used by Programmers!•for “looking” at the actual bits that are stored in memory (e.g. memory dump)•for “specifying” binary data. HEXadecimal is an efficient shorthand notation for Binary•one HEX symbol specifies 4 bits01101110 = 6E 11111111 = FF HEX BI HEX BI HEX BI HEX BI0 0000 4 0100 8 1000 C 11001 0001 5 0101 9 1001 D 11012 0010 6 0110 A 1010 E 11103 0011 7 0111 B 1011 F 1111COMP 4—Power Tools for the Mind12What’s in the box?Positional values•These are legal in their respective bases:–A489C16 –356728 – 24415•These are not: why?–87728 – 3A576910 –112112QUOTABLE•Base affects value! (place values change)–324510 is not equal to 32456–But: 1510 = 11112 = F16COMP 4—Power Tools for the Mind13What’s in the box?Simple to convert from any base to a decimal base; or from a decimal base to another base•Converting a base-x number to a decimal numbere.g.: 2134 = ?10 –first, find place values (how???)baseplace values(face values)powers 43 42 41 4064 16 4 1 2 1 34–second, find total values (how???)2*16 + 1*4 + 3*1 = 39Tot Value = SUM of (each face value * each place value)COMP 4—Power Tools for the Mind14What’s in the box?Converting a decimal number into base-x number–first, determine symbols (face values) used in base x. (How?)–second, find place values for base x. (How?)–Start far left as reasonable, and try largest face value: does it fit? If so, fill in. If not, try next smallest face value. Repeat. •In other words: Fill in table with enough numbers until it totals desired decimal value--sort of reversing the algorithm. Example:

View Full Document