Math

Filing Away Another Post

Computers.

It’s the 21st century, computers are all around us, and explaining them can yield to some pretty interesting blog content.

If you have used a computer you’ve used or at the very least heard of a file, and you have probably seen many different file extensions (.png, .wav, .docx, .txt).

“What makes them different?” You might ask.

Formats.

To a computer a file looks exactly like any other file. Strings of binary, rows upon rows of 0’s and 1’s. A computer has no notion of a, b, c, unless we tell them something like 001 is a 010 is b and 100 is c. So that’s what we do. And to make it more readable we turn 8 bits (each digit in binary) into a more compressed byte (which is 2 digits in hex). This is turning 10001010 (base-2) into 8a (base-16).

This means that different files are just different ways of reading those bytes. Some files have strict formatting rules and some have no rules at all.

There are essentially two different kinds of files, even though all files are really just bytes. Human-readable and binary. Binary files are files that aren’t really intended on being read by humans, while human-readable is exactly what it sounds like.

.txt files are human-readable, if you open one up and readily convert the bytes to characters without following any formatting rules then you’ll get a file that you should be able to read.

.csv files are also human-readable but have a common formatting they have commas separating all of the variables. These are common for spreadsheets.

stuff,stuff,stuff
a,b,c
1,2,3

On the opposite end, things like .docx, the document used to hold your Microsoft Word document, is binary. It sounds confusing, but .docx is capable of holding pictures and formatting and colors and so many things that a conventional .txt couldn’t hold.

Another binary file could be something like .png which can display cool images given the proper program to read it, but also looks like this when you open it in a hex editor.Screen Shot 2018-03-26 at 3.17.23 PM.png

The right side shows what the byte values on the left look like as character, and is what it will look like if you try to open a .png in a text editor (like notepad). If you didn’t have a program to interpret it (like paint) you wouldn’t be able to get an image.

A couple of thing are worth noting here though. Notice “IHDR” on the first line?Screen Shot 2018-03-26 at 3.17.23 PM.png

That indicates to a .png reader that it is the first chunk of the .png. It has to be there and all the future data is interpreted based off of that chunk.

On the flip-side “IEND” indicates the last chunk of the .png. This lets the .png reader know to stop reading the file, since it won’t get anymore information about the image.

Screen Shot 2018-03-26 at 3.24.34 PM.png

This means that you could shove a ton of data at the end of a .png file and it won’t be read. For example: The entire Bee Movie Script.

LOL_BEE_MOVIE_SCRIPT.png

While retaining a completely normal .png image of Barry from the Bee Movie, you can actually put the entire Bee Movie Script by Script-o-rama.com on the end of it. That said, if you download that image right now it won’t have it on there, because the image reader for WordPress actually will chop it all off after only reading what is needed for the image.

If you did decide to open up a text editor and try it yourself, it would look something like this, and the image would look exactly the same, when you opened it up.

Screen Shot 2018-03-26 at 3.28.52 PM.png

Angles on an Angle (A Mathematical Tangent)

I guaranteed there would be a post, and this is proof of that guarantee.

I like math. I wrote a post a while back about Fermat and how he is a super math prankster. This post isn’t going to be biographic. This post is experimental. Buckle up and get ready for the paint-application-level images.

I’ve always had a design in my head that is kind of inspired from taking the limit of a regular shape as its sides approach infinity. In basic terms, if you keep adding sides to a square such that all the sides are equal length once that side is added, at infinity you’ll get really dang close to making a circle.

So here is my example time. I was up one night doing this because it seemed fun and I was particularly fixated on figuring this out.

So this is a 90 degree angle.

If you put a single point somewhere in that quadrant, you’ll get another 90 degree angle if you draw perpendicular lines from the axes. Like the one below.

Now that’s a square and all the angles equal 90 degrees. But what if we add another point out in that space, such that we maintain the perpendicular angles on the axes, and make their angles out in the quadrant equivalent. It will look something like the thing down below.

The question that remains, what would the angles of the intersections have to be in order for them to be equal to each other?

What you are looking at is one fourth of an octagon. Also you are looking at two points, both with 135 degree angles in the quadrant. It is pretty easy to figure out that it is 135 since you can reason that they are perpendicular lines, splitting another 90 degree angle between them, forming two 135 degree angles.

So let’s add 3 more points for the fun of it, putting a total of 5 points out in the quadrant. You’ll see the result (or my best paint of it) down below.

I won’t lie, I eyeballed that figure so they probably won’t all be perfect 162 degree angles. How did I come up with that number? This one you can’t really just eyeball 162 degrees, but by the time I got to this many points that night, I already had a formula in hand (more about that later).

One thing that you should notice though is how much more like a circle it already looks than the 90 degree figure. That’s because all of the angles are getting closer to 180 degrees, which every point on a circle should essentially be (for our sake). And here is where the fun and elegant part comes in.

Like I said before, there is a formula to figure out what angle each intersection would have to be in order to have equivalent angles to each other, I couldn’t find one, but I made one and it looks like this.

[90(1+2x)]/(1+x) x being the amount of points added minus 1.

So as a chart
1 point = [90(1+2(0))]/(1+0) = 90 degree angle
2 points = [90(1+2(1))]/(1+1) = (90*3)/2 = 135 degree angles
3 points = [90(1+2(2))]/(1+2) = (90*5)/3 = 150 degree angles
4 points = [90(1+2(3))]/(1+3) = (90*7)/4 = 157.5 degree angles
5 points = [90(1+2(4))]/(1+4) = (90*9)/5 = 162 degree angles
…   skip a few
2000 points = [90(1+2(2000))]/(1+2000) = (90*4001)/2001 = 179.955 degree angles

So if you took the limit of this equation as you take the number of points to infinity you’ll get a nice crisp 180 degrees. This verifies the assertion that the limit actually creates a circle. Since, although a circle doesn’t have a 180 degree angle for every single point, it has something infinitely close to 180 degrees without ever actually being 180 degrees.

Limits are pretty cool and I might write about Euler’s number one of these days, or even the Monty Hall problem. For right now though, I hope this post satisfied your mathematical interests until the next one comes along.

Also feel free to test the formula, it should undoubtedly work and looks awesome when you decide to choose a large number of points.

 

Throwing a Pigskin

How much you wanna make a bet I can throw a football over them mountains?… Yeah… Coach woulda put me in fourth quarter, we would’ve been state champions. No doubt. No doubt in my mind.

-Uncle Rico, Napoleon Dynamite

I was never really good at football. By that I mean my mom was a little protective and I never got to play. I really don’t mind, football is a dangerous sport anyways.

This blog post isn’t about football though, this blog post is about regret and denial.

I know, I know. Maxwell you said this wasn’t going to be a lifestyle blog. Maxwell I thought you were going to do more music reviews. Maxwell, why don’t you talk about games or math or something.

I am going to live in denial a little bit and say that this post is really a character analysis more than it is a lifestyle commentary, although you can expect it to devolve into some form of rant. The character I am partially analyzing is Uncle Rico from Napoleon Dynamite.

Image result for uncle rico

If you haven’t seen Napoleon Dynamite shame on you I understand. It is a strange movie where it doesn’t really feel like there is a solid plot and every character is a caricature of an actual human.

Uncle Rico is the uncle to the main character Napoleon. That’s about it. He really doesn’t have much going for him. He is the caricature of regret and denial.

Although a grown man, Uncle Rico constantly references high school and how his coach didn’t put him in during state football championships. Most of his screen time is taken up by watching him record himself throwing footballs, aimlessly.

One of the scenes depicts him trying to use a (fake) time machine, so he can go back in time and correct the mistakes of the past.

His character is the epitome of denial, spending all of his present time wallowing, believing he should have earned something that is now long gone and out of reach.

Do not be like Uncle Rico.

If you don’t play football, you are halfway there.

I’m just kidding though, everyone probably has dealt with denial or regret. Everyone’s life is littered with mistakes, good days, bad days, alright days and so on and so forth. It is easy to get bogged down by a bad day and then caught up in a fond memory and think that you were so much better off then. The fact is you are selecting data and creating bad math.

And here is where I start talking about math.

First off, as humans we have an innate ability to see patterns and analyze things. I don’t mean we do it well, honestly we are pretty terrible at it. Optical illusions play on our brain’s desire to see patterns, and people still assume that 939578991 is more random than 123456789.

Now here is what you need to know about life and then about statistics.

No matter how hard you try you are going to have a bad day, if your life is amazing and awesome in every way you are still going to have bad moments, and still going to have regrets about your life.

On the flipside though, no matter how terrible and depressing your life is you are still going to at least have a couple of good moments.

The fact is that no matter how much you don’t like statistics, your life is a scatterplot. The ultimate goal in life is to be an upward trending scatterplot, kind of like the one below.

scatter plot showing strong positive linear correlation

The Y-axis would be your overall self-satisfaction.
The X-axis is time (how classic).
The line not only is the average but what you believe the satisfaction you should be getting out of your day is.

People that get too stuck in the past have a graph that looks like this.

Notice that it putters out.

If you get too attached to a memory and find yourself saying that those were the glory days, that you no longer can be as good as you were, that you PEAKED, then this is probably what your life is like. You never actually get back to that level of self-satisfaction because you are now comparing your entire life to a single event.

The best way to remedy this is by first coming to the realization that you did not in fact peak. If you are life-ing properly you should peak when you die.

You are going to have good memories and they will define you.
You are going to have bad memories and they will define you.
The important part is that they aren’t unreachable.

If you live your life saying that you can never reach the pit that is your worst memory, then the rug could slip out from under and you could make the same mistake.

If you live your life saying that you can never reach the heaven that is your best memory, then I guarantee right now that you never will.

Your good memories should be motivation for how great your life can be. You should stop at nothing to the consistently reach the level of satisfaction of those memories. You can never relive those memories but you can make new memories that are just as great if not better.

Your bad memories should be there to motivate you to do better. Realistically, no matter how motivated or talented or happy or complete you are there will always be a bad day every now and then. The point of your bad memories is to minimize these bad days and the problems that they cause. You can’t fix them because they have passed, but you can learn from them.

All in all, the past is the past and we can’t ever reach it again, so use it as a lesson and then move on. The only part your present self can effect is your future self, and the only part your future self can thank is your past self.

Fermat: The World’s Greatest Troll

This handsome man is the great Pierre De Fermat. Born in the 17th century, he was a lawyer by day and a mathematician by night. What’s interesting about Fermat though is that he is increasingly more notable in the math world than he is in the law world.

He didn’t publish much, if anything, but he was included in some of the day’s math circles. So he was rubbing elbows with the best of the best and yet he was just a hobbyist mathematician. In fact, if he published some of his work, we might have actually ended up calling the 2d plane we know as the Cartesian plane (after Rene Descartes) the Fermatian plane.

Still though, none of this matters in comparison to what he was immortalized for.

First, picture this. You are sitting in your living room reading your book for English class and you have a discussion tomorrow so you are writing anything you find interesting into the margins of the book. You know, when you realize that this passage infers that Hamlet is completely ego-driven, or that this passage proves that Atticus Finch is the epitome of morality, or that this sentence proves that the monster from Frankenstein is all in Victor’s head. Specifics don’t matter since this is just an example but I hope it’s pretty easy to imagine, everyone in their lifetime has probably written something into the margins of a book.

Now Fermat is like everybody else. He was reading his copy of Arithmetica and he came across something he thought was interesting:

X2 + Y2 = Z2

And well, he decided to make note of a great thought he had in the margin. He wrote something along the lines of:

It is impossible to separate a cube into two cubes, or a fourth power into two fourth powers, or in general, any power higher than the second, into two like powers. I have discovered a truly marvelous proof of this, which this margin is too narrow to contain.

I’ll break down what he is saying and give you some background.

X2 + Y2 = Z2

What you see above is many things, but you probably know it as the Pythagorean Theorem. What’s more interesting about this is that there is an infinite amount of integers (non-decimal) numbers that can satisfy this. If you have taken Geometry you know these to be Pythagorean Triples. Stuff like:
3,4,5
9,16,25
5,12,13
Essentially, you can keep having these all the way into infinity. That means you can keep going and get larger sets like:
77893200, 128189952, 150000048

What Fermat is saying though is that it doesn’t hold true for any power greater than 2. There is no sets that can satisfy:
X3 + Y3 = Z3
X4 + Y4 = Z4
X5 + Y5 = Z5
X6 + Y6 = Z6
X1000 + Y1000 = Z1000

There is no combination of 3 non-decimal numbers AT ALL that can be put into those equations above and have them be true.

What’s so great about that? Well the second part of his margin note is his claim to have a proof that shows it, it just can’t fit into the margin. Oh and by the way it’s “truly marvelous” too.

It also couldn’t be found at all.

That’s right, Fermat wrote in the margin of his math textbook that he has one of the best proofs ever and doesn’t have the proof to back it up.

The thing is though, Fermat is completely right, and everyone knew it. The whole math community knew it. But the tough thing about math is that no work or conjecture has any value without a proof. Everything you learn in class has already been brought through lines and lines of formalized logic that satisfies the math community’s strict no-failing case standards.

So this became known as Fermat’s Last Theorem (even though this technically wasn’t his last theorem, it’s just that it was found way after he died) and it became unsolved for a whopping 400 years. Sure some people solved certain cases but nobody created a general proof that would hold true for every case.

It wasn’t until the 1990s that it was fully proved.

The implications of this are simple. Fermat, the man who wrote one of the greatest problems in the margin of his textbook, also claiming to have solved it, is the world’s greatest troll.