Is there a topic you’d like me to address? Email your suggestions to: randyp@terraphy.com

Coming Soon
Articles currently in the pipe, to be published soon:
 When should you add the cream to the coffee? An ageold controversy.
 Random numbers and Monte Carlo simulation. How does a computer pick random numbers from different distributions? How random are they?
 Edison and the elevators: The AC/DC wars and elevators

Drilling a hole through the earth
It’s been way too long since my last posting. A combination of wanting to do some additional research to support the post I was working on, and real life interfering,
So in the meantime I thought I’d do a quick post on a question that pops up here and there on the internet as it’s a fun little calculation: What happens (theoretically) if you fall into a hole that goes all the way through the earth?
(more…) 
Probability of a run of heads
The question is: If you flip coins in a row, what is the probability that somewhere in those flips you’ll get a series of (or more) heads in a row?
This is one that comes up periodically on Reddit, and I’ve answered it, though I’m not 100% I’ve always answered it exactly the same way twice. I do know that my answers to this one tend to be a little long and messy. To make a long story short, I always use some version of a recursive approach.
So the purpose of this article is to introduce the idea of recursive probability calculations, for problems which don’t seem amenable to another approach.
(more…) 
Square roots
This post gives three methods for calculating square roots.
You may have heard that, back in the stone age, we were taught how to calculate square roots by hand, by a method that looks something like long division. It’s true, and I was taught that method as part of Algebra class. So if you’ve wondered how it was done, or if you want to be ready for the Zombie Apocalypse which for some reason might also include the failure of all the calculators, then this section is for you.
But even in those days, probably nobody professional would ever have used that method. Once you got to be an adult engineer or scientist, you no doubt had a slide rule. I had a cheap plastic student slide rule, but never got to the stage of investing in a real one like my Dad’s, because before I graduated college the electronic calculator had been invented. Anyway, this section is for you sliderule enthusiasts. I know you’re out there.
But what do computers and calculators do? It turns out they use a different method entirely, one that is very fast and very easy to implement. That’s described here.
(more…) 
Running in the Rain
Do you get wetter walking or running in the rain? I remember people arguing this question long before the internet. It seems to be one of those silly arguments that never goes away, like whether it’s better to add the cream to the coffee early or late, or whether you should add tea to milk or milk to tea (both of which are in my blog queue).
I googled it and got plenty of hits to recent articles discussing it, so the conversation has obviously not died down, even though this article says that mathematician David Bell worked out the mathematics in 1976.
(more…) 
What’s this blog about?
A glance at a couple of posts will show that there are a lot of equations in these posts. I know that a lot of people are kind of triggered by math and might have an automatic fightorflight response on seeing an equation.
When I write something here it’s because I thought, “hey, isn’t it cool that you can calculate this thing, that math can answer this question?” If you like math, then the post is saying “hey, here’s how to calculate this thing.”
But if you’re not a big fan of math, then the take away is simply, “hey, did you know this thing can be calculated?”. Hopefully you’ll also think it’s cool that it can be calculated, without worrying about the “how”.
(more…) 
Shooting a cannon downhill
The question: If you are on a downhill slope with angle , what’s the optimum angle to fire a projectile to get the maximum range?
This was a Reddit question. I was surprised at how simple the answer turned out to be.
Introductory physics projectile problems almost always involve firing a projectile on flat ground. The final height is the same as the initial height. Things get rapidly messy pretty quickly if you get away from that situation.
(more…) 
General Linear Least Squares Fitting
You might have heard of linear regression for fitting a straight line to data, such as in the picture below. But did you know that you can fit much more complicated functions to data, and the procedure is almost as simple? You may be surprised to learn that “linear” covers a lot more than straight lines. This article is looking at the general “linear least squares” problem. So why is it called “linear” then? We’ll get to that.
(more…) 
Matrix calculus
This seems kind of esoteric but it’s the basis for really simplifying some complicated mathematics, like the general theory of least squares. It’s well worth working through if you’re going to be doing the linear algebra version of least squares or multivariable optimization.
The two main results proved as theorems below:
(more…) 
Special Relativity: the symmetric twin paradox
This post was prompted by this question on Reddit.
Most people have heard of Einstein’s theory of Special Relativity (SR), the 1905 theory that introduced the idea that time and space are affected by the state of relative motion, and the famous equation
And most people have heard of the famous “twin paradox”: Two twins separate, one of them traveling away from earth at close to the speed of light. The traveling twin reaches a distant star, turns around and then heads back to earth, again close to the speed of light. When the twins are reunited on Earth, the traveling twin is younger. The traveling twin experienced less time than the twin on Earth.
(more…)