Tumgik
Maryland + Ally Flag
Tumblr media
Combining the best state flag with one of the worse queer flags.
1 note · View note
A New And Correct Value of Pi
Pi is lovely. Pure mathematicians love it because it shows up in the most random places, and it’s widely regarded as one of math’s most important constants. However, our current estimation, \( \pi \approx 3.14159…\), is inaccurate for real-world use. While the estimation is fine for pure math, real-world factors such as air resistance make it inappropriate for many engineering applications. In this post, I will find and present, as pi visionary Edward J. Goodwin did before me, “a new and correct value for pi”.
Theory
Stirling’s Approximation states that
\[ \ln{n!} \approx n \ln n \]
for large \(n \); while elegant, it is inaccurate. Ramanujan, unsurprisingly, created an over-the-top variant that gives the approximation
\[ \ln{n!} \approx n \ln{n} - n + \frac{1}{6} \ln{(n + 4n^2 + 8n^3)} + \frac{1}{2}\ln{\pi} \]
(Try it for a few values if you’re unconvinced!) Clearly we can solve for pi to get
\[  \ln{\pi} \approx 2\ln{n!} - 2n\ln{n} + 2n - \frac{1}{3} \ln{(n + 4n^2 + 8n^3)} \]
This approximation is highly accurate. Using the theoretical value of \( 5! \), we get \( \pi \approx 3.141616 \), which isn’t far off from the theoretical value. However, this is using an idealized value of \( 5! \). To get a usable value that accounts for friction and air resistance, we’ll have to run an experiment. The following code runs a simulation that will find the value of \( 5! \) experimentally.
import numpy.random as npr def fact():    perm = [5,4,3,2,1]    count = 0    while (perm != [1,2,3,4,5]):        npr.shuffle(perm)        count += 1    return count
Since numpy’s shuffle( ) permutes a list randomly, the expected number of times the loop will have to run is \( n! \)
The following histogram shows a distribution of 1000 trials of the above function:
Results and Discussion
The average number of shuffles over 1000 trials was \( 117.82 \) As you can see, experimental error made a big dent in our theoretical value of \( 5! \), which should lead to a plunge in our value for pi. Indeed, using Ramanujan’s formula above, we see that \[ π≈3.0285079. \]
That’s pretty good– try measuring it yourself with a ruler if you don’t agree. (Not a tape measure, silly, an actual straight ruler. Harder than it seems, yes?) That being said, this experiment has a fatal flaw. You guessed it, dear reader– a computer simulation does not approximate \( 5! \) perfectly. Sure, it will be good enough for building bridges and other applications. But, in the field of pure applications, practicality isn’t enough. The best way to truly account for friction and air resistance is to do the experiment in real life.
I plan to redo this experiment with a deck of actual cards numbered 1 to 5. Doing so will get a more accurate value of \( 5! \), and therefore improve the accuracy of our estimate. Although it isn’t perfect, this experiment has shown that the theoretical value of pi is unusable for practical applications. So, tell your friends and professors about the #onetruepi! And, more importantly, the next time you build a circle outside of a frictionless vacuum, remember to ditch your calculator’s pi key and use the one true value of pi: \( 3.028… \)
2 notes · View notes