## Friday, April 21, 2017

### Lesson 13-8: Exterior Angles of Polygons (Day 138)

This is what Theoni Pappas writes on page 111 of her Magic of Mathematics:

"In the Bible I appear twice and my value is given as 3. Egyptian mathematicians used 3.16 for me. And Ptolemy estimated me as 3.1416 in 150 A.D."

Of course, this is the last part of the pi story. Pi tells the other numbers how progressively more and more of his digits were discovered, from the primitive biblical value of three all the way up to the Ptolemaic value, which is still good enough -- recall that 3/14/16 was "Round It Up to Pi Day."

Note: This spring break post has been edited so that I can write about Eugenia Cheng's new book, Beyond Infinity. The "Eugenia Cheng" label has been added to this post. Today I selected a random chapter to discuss.

Chapter 12 of Eugenia Cheng's Beyond Infinity is "Infinite Dimensions." She begins:

"Would you like to be able to travel in time? It sounds exciting, but it also sounds terrifying because of the dire consequences if you even slight interfere with your own past."

In this chapter, Cheng writes about the concept of infinitely many dimensions. But this is tricky as it's difficult to imagine what it means for a world to have four dimensions, much less infinitely many.

Last year at around this time (between Round It Up to Pi Day and April Fool's Day 2016), I was blogging about Rudy Rucker's The Fourth Dimension: Toward a Geometry of Higher Reality. As the title implies, this book discusses the fourth dimension. Cheng writes about the fourth dimension as well, albeit en route to even higher dimensions.

By the way, last year I mentioned Rucker's other book -- Infinity and the Mind. That's right -- it's yet another book about infinity. We can see how Rucker and Cheng apparently both love infinity and higher dimensions. Clearly I share that love as well, since I keep blogging about their books.

Let's get back to Eugenia Cheng. Anyway, Cheng begins by describing several examples of one-, two-, and three-dimensional objects. A line is one-dimensional, but so is a circle, since someone living on a circle can only go one way or the other, just like on a line. (This is why we often refer to a circle as S^1.) Likewise, a plane and a sphere are both two-dimensional. In both cases we need a pair of coordinates to specify our location, but even on a plane, we can use circular (polar) coordinates. Of course, our ordinary space is three-dimensional.

One example of a possible fourth dimension is time. She writes:

"If you find this hard to understand, you can imagine time as a fourth dimension. This is a valid and in fact powerful way to think of time, put to great use in theoretical physics, but it is just one way of thinking of a fourth dimension, not the only way."

Rucker also mentions time as an example of a fourth dimension. Cheng also gives color as a possible fourth dimension, where you're only in the same place as something if you're the same color. Again, Rucker gives the same example in his book.

According to Cheng, dimensions should be independent. So when she gives her location as "4 miles east, 2 miles north, and sqrt(18) miles northeast," only two of those dimensions are independent. So she doesn't need to provide a northeast coordinate.

Cheng proceeds:

"As my research is in higher-dimensional category theory, I spend a lot of time talking to people about dimensions, both formally and informally."

I already knew that category theory is Cheng's specialty from her first book, How to Bake Pi. So of course she finds a way to discuss category theory in her new book as well. Indeed, the next chapter of her book, Chapter 13, is titled "Infinite-Dimensional Categories."

And just as in her first book, Cheng likes to give food analogies. She writes that in order to make French macaroons, she needs to decide how much icing sugar, caster sugar, and ground almonds to include in the recipe, so that's three "dimensions" to consider. The oven temperature is the fourth dimension, and the fifth through ninth dimensions are all temporal -- how long to whisk the whites, fold the batter, pipe the circles, let them stand, and finally bake them.

She continues:

"You might think that this is all very well, but is there ever a need to study those higher-dimensional spaces? Do we even need to know that they're there?"

Her answer is an emphatic "yes" -- we use seven dimensions every time we move our arms. Two of these are shoulder movement and two more are wrist movement. The remaining three dimensions are all angles -- the elbow angle, the angle the hand is facing, and the upper arm angle. She points out that as humans we don't think about all of these dimensions, but if we were to program a robotic arm, we must consider all of them.

"Thinking about higher-dimensional space is difficult. That's why there are whole branches of math devoted to it."

Now Cheng provides several examples of improperly reducing dimensions. The dominant example is when filling out surveys that ask, "Do you prefer socializing in large groups or one-to-one?" as if one can't like both equally or hate both equally. She adds that for years, people thought of politics as being one-dimensional (left-wing or right-wing) when two dimensions represent them better. Thus she provides the following link to a two-dimensional political survey:

http://www.politicalcompass.org

She wraps up the chapter with the following:

"Sometimes when I'm doing a 'pros and cons' type evaluation of a situation, I discover that the criteria are too difficult to separate out. For example, you might be thinking about short-term benefits and long-term benefits."

In other words, there are too many variables to consider -- and sometimes we can't even tell how to divide the criteria into separate variables! And so this is a job for -- infinitely many dimensions. As Cheng points out, "No wonder decisions are difficult."

By the way, in the previous chapter (11) and a few other places in the book, Cheng mentions that the simplest way to get to infinity is by a simple program. She writes it in BASIC:

10 PRINT "HELLO"
20 GOTO 10

but we can also write it in Logo:

to hello
print "Hello
hello
end

Ironically, we must end the procedure with "END" even though it doesn't end. Last year, I mentioned an infinite polygon program written by Brian Harvey:

```to poly :size :angle
forward :size
right :angle
poly :size :angle
end```

```
```
`I decided to keep the Logo problems in my worksheet. Unfortunately, unlike BASIC, Logo isn't easy to convert into TI-BASIC. Logo is mentioned in this section because the angles mentions in the RIGHT commands are in fact exterior angles. If the students don't have access to Logo (Harvey discusses how one can download Berkeley logo on his webpage), one can change it to simple angle questions -- for example, my Question #3 becomes, "What is the exterior angle of a regular octagon?" (rather than draw one in Logo).`

So that is what I wrote last year. This year I decided to go back to the Berkeley Logo and show you some more interesting programs. One of my favorites is Tic-Tac-Toe:

https://www.cs.berkeley.edu/~bh/v1ch6/ttt.html

This set of procedures combines both list processing (for the strategy) and turtle graphics (to draw the X and O symbols). We can recognize most of the turtle graphic procedures:

```to drawx
pendown
repeat 4 [forward 25.5 back 25.5 right 90]
end```

This procedure obviously draws the X's. The only procedure with which we might be unfamiliar is the line setheading 45. Of course the 45 refers to 45 degrees. What this line does is tilt the turtle 45 degrees so that the symbol looks more like an X than like a + symbol.

Now that we've seen drawx, we may be curious to see what drawo looks like -- perhaps it's similar to the 180GON that we see in the U of Chicago text. Well, actually it isn't:

```to drawo
pendown
arc 360 18
end```

Of course, we can easily figure out what the line arc 360 18 does -- the 360 obviously means 360 degrees, and I think that 18 refers to the radius of the arc (in turtle units).

Most of the link above discusses Tic-Tac-Toe strategy and how to implement it. Harvey writes:

At the beginning of the discussion about strategy, I suggested that one possibility would be to make a complete list of all possible move sequences, with explicit next-move choices recorded for each. How many such sequences are there? If you write the program in a way that considers rotations of the board as equivalent, perhaps not very many. For example, if the computer moves first (in the center, of course) there are really only two responses the opponent can make: a corner or an edge. Any corner is equivalent to any other. From that point on, the entire sequence of the game can be forced by the computer, to a tie if the opponent played a corner, or to a win if the opponent played an edge. If the opponent moves first, there are three cases, center, corner, or edge. And so on.

Actually, the problem of Tic-Tac-Toe strategy has already been completely solved. The solution is given by the website xkcd, which describes itself as "A webcomic of romance, sarcasm, math [ha! -- dw], and language":

https://xkcd.com/832/

By the way, xkcd has created webcomics for several math topics. I was able to find two different webcomics involving Zeno's Paradoxes!

https://xkcd.com/1153/
https://xkcd.com/994/

Harvey goes on to write:

If you're tired of tic-tac-toe, another possibility would be to write a program that plays some other game according to a strategy. Don't start with checkers or chess! Many people have written programs in which the computer acts as dealer for a game of Blackjack; you could reverse the roles so that you deal the cards, and the computer tries to bet with a winning strategy. Another source of ideas is Martin Gardner, author of many books of mathematical games.
[emphasis mine]

What the -- here's yet another Martin Gardner reference! Well, that just goes to show how popular Gardner and his math games column was!

Actually, before taking up Harvey's suggestion the challenge would be to implement xkcd's game strategy in Logo. Notice that xkcd's Tic-Tac-Toe strategy is in fact foolproof, in that if the computer were programmed to follow it, the computer will always either win or tie. So in the procedure:

```to ttt
local [me you position]
draw.board
init
if equalp :me "x [meplay 5]
forever [
if already.wonp :me [print [I win!] stop]
if tiedp [print [Tie game!] stop]
youplay getmove                         ;; ask person for move
if already.wonp :you [print [You win!] stop]
if tiedp [print [Tie game!] stop]
meplay pickmove make.triples            ;; compute program's move
]
end```

we can delete the line that says You win! (where "you" refers to you, the computer user) because that line can never be reached.

2017 Update: I decided to take Logo a step further and actually include an activity page, based on Exploration Question #18 from the text. Maybe it's because of all that computer time I had in my classroom, even though that's IXL and Study Island, not Logo!