Friday, June 14, 2013

Functions and Formulas: Mathematics for the Masses!

.
I have finally flipped my proverbial gourd!  I have decided to explain a little mathematics to my readers, who have probably gone through life saying to themselves: "I've had a wonderful run, in all my 45 years (or fill in some appropriate number; you are all very likely to be different ages, but probably very nice ages, each in their own way) without being confused by mathematics higher than multiplication.  I'm not about to start now."  Well, I'm writing this for my own satisfaction.  There's nothing a mathematician likes to do more than satisfy himself!  (I have sprinkled exclamation marks liberally throughout this post, in a vain attempt to draw in the gullible reader.)

Let's start with square roots.  You probably know that the square root of 9 is 3, the square root of 16 is 4, and, best of all, the square root of 25 is 5.  Or, should I say, 5!  (That's actually not advisable, because in mathematics, writing an exclamation right after a number means something entirely different.  Ok, so back to plain old 5.)

What does this mean?  It just means that 4x4 is 16, 3x3 is 9, and of course, without exclamations, now, 5x5 is 25.  You're probably wondering why anyone would go to the trouble of multiplying a number by itself, in the first place.  (Well, at least in the case of finding the area of a square, you have to agree that it comes in handy.  The number of square inches in a square twelve inches on a side is 144.  Conversely, if you happened to have a square of area 144, you work backwards and observe that it must be 12 inches on one side.

This brings us to the idea of a function.  The square root function is just a formula --a very simple formula, actually-- using a variable, x.  The formula tells you the side of a square, when you happen to know the area of it.  The formula in this case is

Now, this is where things get interesting.  It starts off by making a chart of a variety of numbers, and their square roots, which is an obvious enough thing for anyone to do.  I made this chart in Excel:

Frankly, I'm disappointed, and you must be laughing.  It certainly shows us the square roots, but fails to report whose square roots they are.  For example, I'd like to be told that the highest bar is the square root of 25, for heaven's sake.  What use is just the number 5?
So I'm going to make a different sort of chart, namely a scatter-plot.  I'll first make it, and then explain it.

Now, this is nice.  Each little diamond gives a number, for instance 9, and its square root, which is 3.  Perfect.

Notice that they have also joined the diamonds up into a sort of curve.

That curve is what I want to talk about.  It suggests that numbers between 9 and 16, for instance, might have square roots too.  I'm sure you know that every positive number has a square root, but the interesting thing is that the square root of a number between a and b will have a square root between the square root of a and the square root of b.  You might think that's obvious, but ... well, let's just say: other functions do not behave the same way.  (Informally, a function is some formula, like a square root.)

I'm obviously going to pick nice numbers that have square roots that are easy to find.  That's called stacking the deck.

Let's consider, er, I don't know ... how about 10.24?  (Heh heh!)  You'll find that its square root is 3.2.   If you had the patience and the motivation, you would find that starting from the point between 10 and 15 on the chart above that corresponds to 10.24 (I know; it's practically impossible to find exactly), if you go straight upwards to cross the pretty blue graph, you would cross it at a number that corresponds to 3.2 approximately.

In fact, 3.2 will actually be just a little above  the pretty blue line.  Why?  Because the pretty blue lines are actually crude approximations to a pretty blue curve.  Unfortunately I'm at home, and I don't have access to software that can generate the curve ... wait, I actually do.  Here you are:

(If you're really interested, I could superimpose the graph consisting of little lines and diamonds on top of this one, but you probably get the idea.)

So there it is.  The curve, or graph, consists of millions of dots that stand for square roots of numbers.  The x-position of the dot --for instance the dot named B in the graph above-- is some number, in this case 10.24, and the y-position, how high up the dot is, is the square root of the first number, in this case 3.2.

Though of course you can find square roots directly from the diagram, using some sort of measuring method, it is actually more a conceptual thing.  You can see, going from left to right, that square roots of numbers increase a lot slower than the numbers themselves.  For instance, the square root of 16 is 4, but the square root of 25 is just 5.  (This is the opposite of the way taxes increase, for instance.  You earn a little more, and your taxes are a lot more!)

Now, girls and boys, I'm going to do something a little strange.  I'm going to talk about approximating square roots.

Here's the deal.  I would like to give you a formula to find square roots fairly exactly, using a formula that only involves addition, subtraction, and multiplication.  These sorts of formulas are called polynomials.  All you need is a really cheap $2.99 calculator that does multiplication, addition and subtraction.  (You're probably thinking, well, those calculators can do square roots, too!  Ok, it's the principle of the thing.  I can even find you a formula to do more difficult things, but ... enough for the moment.)

I'm not actually going to tell you the process; I'm just going to give you the formula.  This one will only find for you square roots of numbers between 3 and 10, and very roughly, too.
where, as usual, x3 stands for x . x . x, and so forth.

Pretty cool, huh?  You're probably thinking that using the square root key on your calculator is much easier, but still, isn't it interesting that you can approximate one kind of function, a square root, with an entirely different kind of function, namely a polynomial?

The approximation isn't very good between 3 and 10, and much worse outside that range.  Just to show you how bad it is, here is a graph showing both of them, and you can compare:
The approximation is in green, as is its formula, and the square root is in blue.  The two graphs look almost exactly the same between the (x-) values of 3 and 10, but you sort of know that they can't be.  I could blow up the graphs, and you would see a slight difference, but I imagine only die-hard math folks would care.  It's enough for you to know that it is possible to approximate lots of functions --especially continuous functions-- with polynomials, which only involve addition, subtraction, and multiplication.

In case you were wondering why I'm making all this fuss about polynomials, it's simple.  Computers ultimately only do multiplication, addition and subtraction.  All this crazy stuff you see on the screen is based on only those operation, and simple logic.  To be sure, a computer has to do a lot of addition and multiplication to show you a website on a screen, but we all know that computers can do stuff very fast.  (Many programmers don't quite realize that the software they build is ultimately based on just addition and multiplication, because the computer itself translates program code into arithmetic at a level below the level at which most programmers work.  (The arithmetic aspects are built into the design of so-called chips, which is done once and for all when someone invents a chip, or when someone writes a compiler for a language; the rest of the time we generally ignore the fact that computers are essentially just adding machines in disguise.)

One of these days I'm going to blog on how to compare formulas.  It is a fascinating idea that anyone can understand, but one that is usually only considered by specialists, which is a shame.  Of course, you can't use the information, but ... well, how much of the stuff I tell you can you really use, when you come right down to it?  Not a lot!

[P.S.  I suppose I ought to have tried to calculate the (approximate) square root of 10.24 using my polynomial, to see how close it is to the exact value of 3.2.  After all, this was the point of the whole exercise!

Well, I used Excel, and ... lo and behold, it gives: 3.203381 amazingly enough!  Just a little too high, but still, not bad, huh?  This is obviously a rounded value, and I didn't do it by hand, but, for what it's worth, there it is.]

Arch

No comments:

Final Jeopardy

Final Jeopardy
"Think" by Merv Griffin

The Classical Music Archives

The Classical Music Archives
One of the oldest music file depositories on the Web

Strongbad!

Strongbad!
A weekly cartoon clip, for all superhero wannabes, and the gals who love them.

My Blog List

Followers