Sunday, April 14, 2013

Clicktagon Redux

First jab at random clicktagon. For those of you who haven't seen the original, it's a little flash game where you have to identify different shapes (just play it and you'll understand).
Some things to do:
Equalize out the size of the different polygons (to make it harder).
Framerate is choppy.
Find out a smart way to do collision with the mouse.

Saturday, March 16, 2013

The Octagon Problem

Here's my video showing that the pythagorean theorem applies to regular octagons as well as squares:


Many thanks to Jack Eustis for his camera work and moral support.

Wednesday, March 13, 2013

Friday, March 1, 2013

Number of Triples to...

1
2
3
4
5
6
7
8
Up to 10: 0 triples, 0 primitives.
Up to 100: 17 triples, 7 primitives.
Up to 1000: 325 triples, 70 primitives.
Up to 10000: 4858 triples, 703 primitives.
Up to 100000: 64741 triples, 7026 primitives.
Up to 1000000: 808950 triples, 70229 primitives.
Up to 10000000: 9706567 triples, 702309 primitives.
Up to 100000000: 113236940 triples, 7023027 primitives.
 By Paul and Vikram using C because we're just that good.
Take that Harry and Josh


typedef unsigned long xint;

xint total, prim, max_peri;
xint U[][9] =  {{ 1, -2, 2,  2, -1, 2,  2, -2, 3},
{ 1,  2, 2,  2,  1, 2,  2,  2, 3},
{-1,  2, 2, -2,  1, 2, -2,  2, 3}};
void new_tri(xint in[])
{
int i;
xint t[3], p = in[0] + in[1] + in[2];
if (p > max_peri) return;
prim ++;

total += max_peri / p;
for (i = 0; i < 3; i++) {
t[0] = U[i][0] * in[0] + U[i][1] * in[1] + U[i][2] * in[2];
t[1] = U[i][3] * in[0] + U[i][4] * in[1] + U[i][5] * in[2];
t[2] = U[i][6] * in[0] + U[i][7] * in[1] + U[i][8] * in[2];
new_tri(t);
}
}
int main()
{
xint seed[3] = {3, 4, 5};
for (max_peri = 10; max_peri <= 100000000; max_peri *= 10) {
total = prim = 0;
new_tri(seed);
printf( "Up to "FMT": "FMT" triples, "FMT" primitives.\n",
max_peri, total, prim);
}
return 0;
}

Thursday, February 28, 2013

Hey, guess how many Pythagorean Triplets there are?

You guessed it! But how many do you think you can actually find? I bet you 13228 moneyz in geometric currency that you can't beat my supercomputer. I dare you to check all of them:

Click Here For a Lot of Numbers

At the start, Wolfram Mathematica was being a little obtuse with me, but then I switched to Python, and it turned out just fine. Here is the Python file for those of you who are interested.

Thursday, February 21, 2013

A Cute Triangle Walks into a Bar...

Just kidding, I don't have a knock knock joke. But I do have a fascinating mathematical exploration to tell you about! After figuring out how to identify the acuteness of a triangle with only knowing side lengths in class (shoutout to Vikram for helping me/telling me what the answer was), I decided to write a little program to do these calculations.

Its nice. It does nice things. But I'm starting to worry about its accuracy. Here is the algorithm I am using:

Right triangle (never happens because I use random coordinate inputs that are decimals):
     A^2 + B^2 = C^2
Acute:
     A^2 + B^2 < C^2
Obtuse:
     A^2 + B^2 > C^2

Also note that these are all real triangles, no floppy arm business like this: https://docs.google.com/drawings/d/1vqFSweJkqJm-2oSSe6q3nbhRDJ4l1LDcGIFDeid5STQ/edit

The thing that perplexed me was that there seemed to be A LOT more acute triangles than obtuse. I've been running this program with random triangles (in a finite 500 by 500 space) 200 times a second for over 10 minutes and the obtuse to acute ratio seems to be wavering around 1:2.645. Why? Is it a problem with my program, or a problem with...MATH?

Update: Whoops, I think I got my alligator teeth mixed up again! Its 2.645:1 which makes a bit more sense.

Another update: As you change the dimensions of the rectangle you are generating the triangles in the ratio changes. What is the correlation between the dimensions of the rectangle and the acute/obtuse ratio?

Tuesday, January 29, 2013

A Wild Obtuse Chase: Discovering the Hard Truth of Mathematical Identity in a Foggy World

Words are dangerous things. They're confusing, blurry, overly-complicated, emotional, and sometimes downright unpleasant. Unfortunately, words possess a rather complete monopoly on communication, and so all we can do is try our hardest to avoid falling into their numerous traps. However, being dangerous things, words always seem to find a way to get the best of you in the end, no matter how carefully you tread; experience will postpone this moment, but it will come. This is a tale of how two young, foolish students of mathematics managed to trip over the very first hurdle, and how they then spent several minutes running in completely the wrong direction, and how they eventually realized their mistake and turned around, and how they then, finally, wound up back at the starting line, having made absolutely no progress in the race, but having become a little bit wiser for it.

Let's start with angles. We are all familiar with angles in two dimensions, and how we represent them as fractions of a 360 degree circle. However, my esteemed colleague Vikram and I decided to try and extend our logic. What about three dimensional angles? That is to say, how can we better visualize the relationship between 3D angle and sphere, in the same we we do for 2D angle and circle? The answer is rather simple, actually.


Above, we have two images, on with a circle, the other with a sphere. In both cases, the point labeled 'O' is the center. As you can see, in the first image, two rays extend from the center of the circle, with the points at which they intersect the perimeter labeled 'A' and 'B'. The segment of circle in between the two rays is a certain number of degrees out of 360, and this is an angle. In the second image, we have a sphere, with three rays rather than two extending from the center and carving a patch out of the surface area. And as you can see, the patch it carves is in the shape of a triangle. And, since we know how to deal with the angles of triangles, this is cause for rejoice. So far, so intuitive. However, a problem quickly arises. Look below.



In this image, the 3D angle is more cone-y, and not so neat. Notice that when we looked at our 2D angle, the patch the rays carved out of our circle was a 1D shape (i.e., a line). And now, looking at our 3D angle, the patches cut out of the sphere's surface by the rays will all be 2D polygons. Because of this, finding a way to talk about and visualize these angles is a daunting task.

Now, Vikram and I faced up against this problem, but immediately wasted a good amount of our name doddling about with words and descriptions, rather than getting to the point of mathematical identity. We kept trying to express the 3D angle in terms of degrees (out of 3600, perhaps), in some attempt to tie it back to familiar 2D territory. However, the clear folly in this is that the number 360 is fully arbitrary. The patch of circle is 1/4 of the whole, the patch of sphere is 2/7 of the whole, and any further description just confuses the matter.

So, we wound up without having made any progress on the language front. And since that is where our research stopped, it seems right to end my report here as well. However, I am fully aware that we haven't even scratched the surface of these ideas; I'm particularly interested in the relationship between areas and angles. This has simply been an overview of the thoughts we had that day, and of how we came to better understand what the word 'angle' means. And so... The End.

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.



Saturday, January 5, 2013

A Tessellation of Fat Pigs Wearing Capes and Party Hats.

Hello all. I have been working for the past few weeks on a tessellation of pigs. However, these are not just any ordinary pigs. These are pigs have remarkably fleshy bellies and are sporting fashionable party hats and capes.
I wasn't really sure how to go about making a tessellation at first, so I began by making random shapes out of rectangles and triangles and other shapes on graph paper. I would then tweak those shapes to try to get them to fit together. I ended up getting something a bit like this:
I thought it was pretty cool, but I wanted to try making a tessellation of an actual object. Again, I didn't really know how to start, and it was more difficult to just sketch it this time because unlike in the the above shape, not all the lines in the objects I was drawing were straight.
I later found a website that showed different methods for making tessellations, and I chose one of them to loosely follow for mine (here is the link to the page: http://www.tessellations.org/methods-tracing-paper-0.shtml). I didn't follow all of the steps exactly, and only used one sheet of paper to sketch out my tessellation, but it did help a lot to use a grid with even rectangles for more structure. I turned the sides of those rectangles into squiggly lines and tried to to think of what they looked like--like when you try to figure out what clouds look like. I thought they looked slightly like disproportionate pigs, so I decided to go with it. I tweaked the shapes to get them to look more pig-like. Here is my first draft:
As you can see, the pigs are roughly the same shape and size, but they are still not completely equal. I had to keep adjusting the back of the pig so that the front would fit, and same for the top and bottom. The pigs went through many changes until they fit together just right:
^The final pig is on the bottom. To get my final tessellation, I traced and re-traced that pig on a grid, added details, and... voila! Pigs!