With several posts now focusing on math results, some might wonder why I'm doing it on this blog, and I wonder as well! And I figure things out at times by typing up a post, as I like to think out loud, so here is a post where I try to explain it.
Best way is to put up a math result which isn't mine, and is ancient so I can talk around it, and what it means to me. I've posted about it before, so the information is already been put up, and I'll repeat to explain more about my motivations.
The equation in focus is x2 - Dy2 = 1, in rationals, which means you have fractions, so to program a solution to it that I'm about to give you need to use doubles.
Turns out you can solve it parametrically, which just means you only need to change one variable:
x = (D + t2)/(D - t2)
and
y = -2t/(D - t2)
So if you have a value for D, then you just shift t, and that gives you x and y.
Cool. Makes solving the thing with fractions--not integers--nice and easy.
And if that all seems strange, like why would you want to solve it parametrically with fractions, well notice that with D = -1, the first equation is the circle: x2 + y2 = 1
And, yeah, people have reasons to solve for circles, right? So what does D do? Well it shifts things around between ellipses, which includes the circle, and hyperbolas. So with it negative, you have ellipses, while with it positive, you have hyperbolas, and D=0 is worthless, as that just gives x=1 or -1, so we don't care about it.
That result has been known to humanity for over 340 years, which I say because Pierre Fermat, who is a famous math dude, knew about it, and he has been dead since 1665. And I noted the above when I posted about it before, so why bother mentioning again now?
Because I never heard of that solution for x and y, until I had re-discovered it myself, got all excited, ready to run off and BRAG, and found out it had been known for centuries. But I had to dig!!!
So why isn't it a standard result, routinely taught? The circle paramaterization IS routinely taught, and is, again, when D=-1, and you have:
x = (1 - t2)/(1 + t2) and y = 2t/(1 + t2)
And you can go look that up to verify, but the earlier result? Wasn't so easy for me to look up and find it, and I think it's a cool result and wish I'd had it years ago when I played around with programming things like drawing circles, and other things.
People who write computer programs appreciate parametric solutions as you can focus just on what matters, and here, the focus is on D, and you don't have to play with square roots, or all kinds of others things, and yes there are parametric solutions for ellipses or hyperbolas, but here is ONE for both of them!
Efficiency. I like efficiency.
And why isn't this thing regularly taught?
Well I have theories, and my best guess is most modern mathematicians don't care about practical. And to them it's a useless little thing, which they don't think is worth discussing!
But I like practical. I don't care if mathematicians like talking about something or not. I like to DO things with math, as I'm a practical guy who codes for a purpose.
When I write a computer program I want it to DO something. I really don't care if some academic somewhere thinks that a tool I'm using is exciting to him or not.
So I talk about it because it's interesting to me, and I think it's a cool tool.
Which is why I include math results that I think are cool tools. They have a purpose. You can DO things with them, like count primes. And they're simple! I love simple.
James Harris
No comments:
Post a Comment