Unary and BinarySlide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11Slide 12Slide 13How to play the 9 stone game?Magic Square: Brought to humanity on the back of a tortoise from the river Lo in the days of Emperor Yu in ancient ChinaMagic Square: Any 3 in a vertical, horizontal, or diagonal line add up to 15.Conversely, any 3 that add to 15 must be on a line.TIC-TAC-TOE on a Magic Square Represents The Nine Stone Game Alternate taking squares 1-9. Get 3 in a row to win.Slide 19Slide 20Slide 21Slide 22Slide 23Slide 24Slide 25Slide 26Slide 27Slide 28Slide 29Slide 30Slide 31Slide 32Slide 33Slide 34Slide 35Slide 36Slide 37Slide 38Slide 39Slide 40Slide 41Slide 42Slide 43Slide 44Slide 45Slide 46Slide 47Slide 48Slide 49Slide 50Slide 51Slide 52Slide 53Slide 54Slide 55Slide 56Slide 57Slide 58Slide 59Slide 60Slide 61Slide 62Slide 63Slide 64Slide 65Study BeeSlide 67Slide 68Slide 69Slide 70Slide 71Slide 72Unary and BinaryGreat Theoretical Ideas In Computer ScienceDanny Sleator CS 15-251 Spring 2010Lecture 3 Jan 19, 2010 Carnegie Mellon UniversityHomework #1 is due today at 11:59pmGive yourself sufficient time to make PDFQuiz #1 is next Thursday during lectureOh No!More on FractalsFractals are geometric objects that are self-similar, i.e. composed of infinitely many pieces, all of which look the same.The Koch Family of CurvesFractal DimensionWe can break a line segment into N self-similar pieces, and each of which can be magnified by a factor of N to yield the original segment.We can break a square into N2 self-similar pieces, and each of which can be magnified by a factor of N.Fractal DimensionThe dimension is the exponent of the number of self-similar pieces with magnification factor into which the figure may be broken.Hausdorfdimension # of self similar piecesmf dimfactor) tion(magnifica lnpieces) similarself of(# ln dimFractal Dimension of the PlaneWe can break a square into N2 self-similar pieces, and each of which can be magnified by a factor of N.2(N) ln)(N ln dim2Fractal Dimension of the Koch CurveWe begin with a straight line of length 1Remove the middle third of the line, and replace it with two lines that each have the same lengthRepeat infinitelyFractal Dimension of the Koch Curvefactor) tion(magnifica lnpieces) similarself of(# ln dim1.26(3) ln(4) ln dim 1The Koch Family of Curves60oWhat if we increase that angle but keep all sides of the equal length? 72oCompute its dimension!The Koch Family of Curves|AD|= 2 + |BC|72o1A B C D|BC| = 2 cos(72o) dim ln (4)ln (2 2 cos(72o))1.44The Koch Family of Curves72o1A B C D2)cos(90 2 (2 ln(4) ln dim o90oA B C DIncrease this anglePlane-filling curveUnary and BinaryHow to play the 9 stone game?9 stones, numbered 1-9 Two players alternate moves. Each move a player gets to take a new stoneAny subset of 3 stones adding to 15, wins.123456789Magic Square: Brought to humanity on the back of a tortoise from the river Lo in the days of Emperor Yu in ancient China492357816Magic Square: Any 3 in a vertical, horizontal, or diagonal line add up to 15.449922335577881166Conversely, any 3 that add to 15 must be on a line.449922335577881166449922335577881166TIC-TAC-TOE on a Magic SquareRepresents The Nine Stone GameAlternate taking squares 1-9. Get 3 in a row to win.Always seek the more useful one!Don’t stick with the representation in which you encounter problems!This idea requires a lot of practiceBasic Idea of This Lecture1234Prehistoric UnaryYou already used induction to verify that the answer is ½n(n+1) Consider the problem of finding a formula for the sum of the first n numbersA different approach…1 + 2 3 n-1 n S+ + … + + =1+2…n-1n S++n-2++ =n+1+n+1…n+1n+1 2S++n+1++ =n(n+1)= 2S21)(n n S1 + 2 3 n-1 n S+ + … + + =1+2…n-1n S++n-2++ =n(n+1)= 2S 1 2 . . . . . . . . n n . . . . . . . 2 1There are n(n+1) dots in the grid!21)(n n Snth Triangular Numbern = 1 + 2 + 3 + . . . + n-1 + n= n(n+1)/2nth Square Numbern = n2= n + n-1Breaking a square up in a new wayBreaking a square up in a new way 1Breaking a square up in a new way 1 + 3Breaking a square up in a new way 1 + 3 + 5Breaking a square up in a new way 1 + 3 + 5 + 7Breaking a square up in a new way 1 + 3 + 5 + 7 + 9 =?1 + 3 + 5 + 7 + 9 = 52Breaking a square up in a new wayPythagoras The sum of the first n odd numbers is n2Here is an alternative dot proof of the same sum….n = n + n-1 = n2nth Square Numbern = n + n-1 = n2nth Square Numbern = n + n-1 nth Square Numbern = n + n-1 = Sum of first n odd numbersnth Square NumberWe find a formula for the sum of the first n cubes.nn=n (n+1)/2Area of square= (n)2n-1n-1??nn=n (n+1)/2Area of square= (n)2n-1n-1nnnn=n (n+1)/2Area of square= (n)2n-1n-1nnnnArea of square= (n)2n-1n-1nnnn(n-1)2nn-1nnArea of square= (n)2= (n-1)2 + nn-1 + nn= (n-1)2 + n(n-1 + n)= (n-1)2 + n(n2)= (n-1)2 + n3(n)2 = n3 + (n-1)2= n3 + (n-1)3 + (n-2)2= n3 + (n-1)3 + (n-2)3 + (n-3)2= n3 + (n-1)3 + (n-2)3 + … + 13(n)2 = 13 + 23 + 33 + … +n3 = [ n(n+1)/2 ]2Can you find a formula for the sum of the first n squares? Babylonians needed this sum to compute the number of blocks in their pyramidsRhind PapyrusScribe Ahmes was Martin Gardner of his day!A man has 7 houses,Each house contains 7 cats,Each cat has killed 7 mice,Each mouse had eaten 7 ears of spelt,Each ear had 7 grains on it.What is the total of all of these?Sum of powers of 7Rhind PapyrusWhat is a closed form of the sum of powers of integers?1 + X1 + X2 + X3 + … + Xn-2 + Xn-1 = X - 1 Xn – 1We’ll use this fundamental sum again and again:The Geometric SeriesProof(X-1) ( 1 + X1 + X2 + X3 + … + Xn-2 + Xn-1 )X1 + X2 + X3 + … + Xn-1 + Xn=- 1 - X1 - X2 - X3 - … - Xn-2 - Xn-1= Xn - 1 1 x x2... xn-1 xn 1x - 1(when x ≠ 1)Geometric Series for x=21 n1n2 2...42 1Geometric Series for x=½ nn212 21...4121 1 Two Case StudiesBases and RepresentationBASE X RepresentationS = an-1 an-2 … a1 a0 represents the number: Base 2 [Binary Notation]101 represents:1 (2)2 + 0 (21) + 1 (20)Base 7015 represents:0 (7)2 + 1 (71) + 5 (70)==an-1 Xn-1 + an-2 Xn-2 + . . . + a0 X0Sumerian-Babylonian: 10, 60, 360Egyptians: 3, 7, 10, 60Maya: 20Africans: 5, 10French: 10, 20English: 10, 12,
View Full Document