82°

This is a 100% recycled yak fur story.

Molly asked me a thoughtful question while I was in the middle of something else and I said “Just a second, I need to rotate my brain.”   A moment later, I said OK and she asked me if my brain was all rotated now.  I replied, “Well, 82° out of 90°, close enough.”  Molly quipped “And since when did you ever do things square?”

But then I nerdsniped myself.  I started to wonder about 82° angles.  If a polygon with 90° angles is a square, what sort of polygon do you get if you turn 82° at each corner?  It’s not one of your basic shapes, because:

  • 120° angles make a triangle (3 sides, since 360° ÷ 120° = exactly 3)
  • 90º angles make a square (4 sides; 360° ÷ 90° = exactly 4)
  • 82° angles make a ??? (?? sides; 360° ÷ 82° = 4.3902439024???)
  • 72° angles make a pentagon (5 sides; 360° ÷ 72° = exactly 5)

It must be some kind of … star shape, 82 doesn’t go evenly into 360, which means that you’d have to spirograph-around the circle more than once to come back to where you started.

But what kind of star?  How many points would there be on a star with 82° angles at each point?  I decided that I had to know, and that I wanted to see what the star looked like, not just find out the numeric answer.  The numeric answer is the GCD of 82 and 360, and I could figure that out, but then where’s my picture of the star?  I decided to write a quick program to draw stars with angles of  ‘N’ degrees at each corner, and to print out how many points there were on the star.

And what’s a quick way to write a program to draw connected lines at various angles?  With Logo and turtle graphics, naturally.  Luckily, I’ve already done some programming in Logo.  Unluckily, it was back in the 1980s.  But it’s like riding an (imaginary) bicycle, right?  I was sure I could remember and pick it up again quickly.  I also (correctly) guessed that there were probably Logo interpreters that ran in a web browser using Javascript.  I chose this one, because it had handy examples and Logo language reference documentation built in: http://www.calormen.com/jslogo/

jslogo.png

So ten minutes later, I had refreshed my Logo skills.  Luckily, Logo is secretly sort of a dialect of LISP, and I’m very comfortable with LISP-like languages.  Here’s the code I finally came up with:

to anglestar :angle
  clearscreen 
  penup 
  forward 150 
  pendown

  make "count 1 
  setheading :angle

  while (heading > 0) [ 
    forward 200 
    right :angle 
    setheading round modulo heading 360 
    make "count sum :count 1
  ]
  forward 200 
  show :count
end

anglestar 82

Now experienced, professional Logo authors will notice that there’s a ’round’ in there.  Why is that?  If all these numbers are integers, why do I need to ’round’ the numbers at all?  Well, I didn’t have it in there at first, and the program wasn’t stopping.  At all.  It’s because this particular implementation of Logo, in Javascript, uses Javascript floating point numbers for Logo numbers, and since “modulo” is a floating point division-remainder operation in Javascript, sometimes instead of coming back with an answer like 377 modulo 360 = 17, it was really doing something like 377.0 modulo 360.0, and coming back with an answer like 17.000001, because floating point math is way more complicated and hard that you might think.  So after having this problem, and fixing it by inserting a ’round’ into the heading math, everything worked better.  Here’s the output from N=82°

82crop.png

And it printed “180”, meaning that this is a 180-point star.  Or, as Molly pointed out, more of a bike wheel than a star really.  An imaginary bike wheel.

I decided to try other angles since I now had this great program.  With N=80°, you get a nine-pointed star, because 80° x 9 = 720°, which is twice around the 360° circle:

80crop.png

And with N=81° you get a 40-pointed star:

81crop.png

Although as Molly pointed out, this one isn’t really a ‘star’, either.  This one is more of an imaginary bicycle gear, a lot like this real 40-toothed bicycle gear:

So anyway, the answer to the original question, “How many points are there on a ‘star’ whose lines meet at 82° angles?” is …. 180.  (And yes, the GCD of 82 and 360 is, in fact, 180!)  But to figure it out my way, I had to refresh my 35-year-stale Logo skills, debug and code around a Javascript floating point math issue, and now the floor is totally, completely covered in yak fur.

Oh, and after all this, Molly very patiently re-asked me her original question again, and I answered her without yak-further delay.

 

Advertisement


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s