Sunday, January 13, 2013

I am the ox cart; Mathematica is the ox.

After finishing writing this post, I realized that I may have already written this exact same post a couple weeks ago. I couldn't find it though, so I'm posting this. This one is probably better anyway.

So I was trying to make a brute force approach to figuring out different combinations of regular polygons that fit around a point. (For example, 3 hexagons, or a triangle and 2 dodecahedrons) So into Mathematica I went.

First I tried this:


FindInstance[(180 - (360/x)) + (180 - (360/y)) + (180 - (360/z)) + (180 - (360/w)) == 360, {x, y, z, w}, Integers, 100]


In normal person language, this finds 100, 4 integer combinations that fulfill that equation up there where the 4 integers are x, y, z, and w. The thinking behind this equation is this: 180 - (360/x) is the formula for the interior angle of a regular polygon with x number of sides. So, in fact, this equation only solves for combinations of polygons with a maximum of 4 polygons.

Anyways, this didn't work. If you don't understand this equation, message me up in the comments. I think the main reason why this made Mathematica go crazy was the it overflowed. So I added some minimum and maximums for the number of sides.

FindInstance[(180 - (360/x)) + (180 - (360/y)) + (180 - (360/z)) + (180 - (360/w)) == 360 && x > min && y > min && z > min && w > min && x < max && y < max && z < max && w < max, {x, y, z, w}, Integers, 100]

You don't really need to understand this. All you need to know is that I put restrictions on the number of sides for each polygon so that the computer didn't explode.

After a couple more trivial little Mathematica troubles I finally got it to work. This is what is output:

{{2, 3, 10, 15}, {4, 6, 12, 2}, {15, 10, 3, 2}, {6, 3, 4, 4}, {6, 6, 2,
  6}, {3, 8, 2, 24}, {5, 10, 5, 2}, {20, 5, 2, 4}, {3, 10, 2, 15}, {2, 9, 3,
  18}, {12, 2, 3, 12}, {12, 6, 2, 4}, {4, 8, 2, 8}, {6, 4, 3, 4}, {5, 20, 4,
  2}, {4, 8, 8, 2}, {4, 12, 3, 3}, {4, 20, 2, 5}, {5, 10, 2, 5}, {10, 3, 2,
  15}, {12, 4, 3, 3}, {15, 3, 2, 10}, {3, 4, 3, 12}, {4, 12, 2, 6}, {5, 5, 10,
   2}, {4, 2, 20, 5}, {10, 2, 15, 3}, {4, 20, 5, 2}, {2, 12, 12, 3}, {15, 2,
  3, 10}, {9, 3, 18, 2}, {4, 4, 6, 3}, {4, 2, 12, 6}, {8, 2, 4, 8}, {2, 4, 6,
  12}, {3, 3, 12, 4}, {10, 3, 15, 2}, {5, 5, 2, 10}, {12, 2, 6, 4}, {3, 2, 12,
   12}, {2, 4, 12, 6}, {2, 8, 3, 24}, {4, 6, 3, 4}, {6, 6, 6, 2}, {3, 2, 18,
  9}, {2, 8, 24, 3}, {3, 4, 4, 6}, {2, 20, 5, 4}, {3, 18, 9, 2}, {18, 9, 2,
  3}, {5, 2, 10, 5}, {18, 3, 2, 9}, {18, 2, 9, 3}, {12, 4, 2, 6}, {18, 9, 3,
  2}, {2, 6, 12, 4}, {12, 3, 4, 3}, {8, 2, 8, 4}, {2, 12, 3, 12}, {6, 3, 3,
  6}, {2, 5, 10, 5}, {6, 6, 3, 3}, {2, 5, 4, 20}, {24, 3, 8, 2}, {3, 24, 8,
  2}, {2, 15, 10, 3}, {2, 10, 15, 3}, {6, 4, 4, 3}, {3, 6, 3, 6}, {4, 5, 20,
  2}, {2, 10, 5, 5}, {2, 12, 4, 6}, {10, 15, 3, 2}, {5, 2, 5, 10}, {6, 2, 6,
  6}, {8, 2, 24, 3}, {2, 5, 5, 10}, {3, 6, 6, 3}, {8, 3, 2, 24}, {24, 8, 3,
  2}, {8, 24, 3, 2}, {4, 3, 12, 3}, {3, 4, 6, 4}, {8, 8, 4, 2}, {3, 12, 4,
  3}, {4, 12, 6, 2}, {9, 2, 18, 3}, {2, 15, 3, 10}, {18, 2, 3, 9}, {12, 2, 4,
  6}, {12, 3, 2, 12}, {4, 6, 2, 12}, {24, 3, 2, 8}, {2, 6, 6, 6}, {9, 3, 2,
  18}, {6, 2, 12, 4}, {2, 12, 6, 4}, {10, 2, 5, 5}, {2, 4, 20, 5}, {2, 18, 9,
  3}}

These are 100 different combinations. For instance, the first combination--{2,3,10,15} is saying a triangle, a dodecahedron, and a 15-gon will fit around a point. The 2 represents a line, which takes up 0 degrees around angle. This is caused by me using 4 variables. In other words, just ignore any 2s.

Question: are there infinite combinations?

It would be nice to organize this data a little bit better. For instance, in this case, order does matter, but it shouldn't. I'd also like to think about writing a process like this but for full tilings. It might be a lot more difficult though. Also, making Mathematica output graphics would be nice.



1 comment:

  1. I was doing a little toying around with these and i discovered 1. Not all of them tesselate. 2. In some weird possibly coincidental way, all of the numbers in a given set 'relate' to each other, as in you can take three of them add, multiply subtract or divide them by each other and you get the fourth number. Example Set 1 2+3+10=15, 2: (6/2)*4=12. The third thing I discovered is that there are a lot of repeats in this. The first and third are the same four numbers. End of comment,

    ReplyDelete