# Curve Fitting

## Discussion

### introduction

I stole this from the "Triple A-S" (the American Association for the Advancement of Science). They know how to do it right so why change it.

Because of its abstractness, mathematics is universal in a sense that other fields of human thought are not. It finds useful applications in business, industry, music, historical scholarship, politics, sports, medicine, agriculture, engineering, and the social and natural sciences. The relationship between mathematics and the other fields of basic and applied science is especially strong.

I see eleven different fields mentioned in this single sentence. I only deal with one of them on a daily basis, but I agree that all of them are beholden to math. If you make decisions about what you'll devote your life to (or at least what you'll study professionally) based on some notion of "importance" then abandon everything other than mathematics. It's one of the oldest branches of human knowledge. The only one that's older is agriculture … um … yeah … and then there are tools and fire and … well, language is pretty important and math is right up there. Yeah math!

What does this mean for you right now?

The usual way it works. The assumption is that there is some mathematical relationship between the quantities being graphed. The data aspires toward this mathematical ideal, but because of the limitations of human beings and their instruments it only approximates it. The data points of a graph form a cloud around the curve of a function. If only we had better "vision". If only our devices were better at recording the actual values. If only we really knew what the essence of nature was so that we could assign these devices to their intended task. Then. Then we would see that every data point fell precisely on a perfect analytical curve. Ah, what a beautiful world that would be. Unfortunately, real data never looks exactly like the ideal curves of mathematics.

horizontal axis (x) |
vertical axis (y) |
---|---|

independent variable | dependent variable |

explanatory variable | response variable |

∞ | ∝ | α |

infinity | proportional to | Greek "alpha" |

Also.

- categorical variables — represented by different symbols on the same coordinate system
- lurking variables or hidden variables — the source of some experimental errors

In search of relationships.

Your friend the proportionality symbol.

### independent

Take a look at the curve to the right. No matter what value the *x* variable takes on the curve, the *y* variable stays the same. This is a classic example of a relationship called independence. Two quantities are independent if one has no effect on the other. The curve is a horizontal, straight line represented by the general form equation…

*y* = *k*

where *k* is a constant.

A suitable conclusion statement from such a relationship would be that…

*y*is independent of*x*.*y*does not depend on*x*.*y*is constant for all values of*x*.*y*is not affected by*x*.*y*and*x*are independent.

For example…

- Free fall acceleration is independent of mass. Heavy objects fall just as fast as light objects in the absence of air resistance.
- The period of a simple pendulum does not depend on its mass. Simple pendulums that are identical in all respects except for the weight of the mass on the end will swing back and forth in an identical manner.
- The speed of light in a vacuum
*c*is constant for all values of*v*, the speed of the reference frame. No matter how I move around, the speed of light in a vacuum always stays the same. - The force of dry friction is not affected by the area of the two surfaces in contact. Dragging a box on its bottom or its side results in the same friction force.
- Mass and location are independent. If a frozen turkey has a mass of 10 kg in New York it'll have a mass of 10 kg in New Jersey, in New Delhi, on Mount Everest, in an airplane, in orbit, on the surface of the moon, in the Andromeda Galaxy, in…. Well, you get the idea.

Independent relationships can be both boring and profound. Boring when we realize there's no link between the two quantities. Profound when we realize we've identified a fundamental principle or underlying concept of great significance. The independence of the speed of light and the speed of a reference frame is one of these statements. The speed of light is a fundamental constant — one of three or four in physics.

### direct

Now take a look at this curve. As the *x* variable increases, the *y* variable increases too. But there are a lot of curves that do this. What makes this one unique? What distinguishes it from all the other curves that increase (as the mathematicians say) monotonically? The key is in the shape — a straight, non-horizontal line that runs through the origin. With this particular shape, something special happens.

Pick a point on the line and note its coordinates. Double the value of the *x* variable and see how the *y* variable responds. The new value of *y* should also have doubled. Try it again. Only this time, cut the *x* variable in half. The *y* variable should have responded in the same manner; that is, it too should be cut in half. Whatever *x* does, *y* does the same. This illustrates the simplest, nontrivial form of proportionality — direct proportionality. Two quantities are directly proportional if their ratio is a constant.

y |
= k |

x |

Rearranging this definition gives us the general form equation…

*y* = *kx*

where *k* is the constant of proportionality, which everyone should recognize as the the slope of a straight line in the *xy* plane.

A suitable conclusion statement from such a relationship would be that…

*y*is directly proportional to*x*.*y*varies directly with*x*.*y*and*x*are directly proportional.*y*∝*x*

For example

- Regular wages are directly proportional to the number of hours worked. Forty hours of work pays four times as much as ten hours of work. One hour of work pays one-tenth as much as ten hours of work.
- Weight varies directly with mass. Three times more mass means three times more weight, too. Likewise, half the mass means half the weight.
- Distance and time are directly proportional when speed is constant. Driving for two hours gets you twice as far away as one hour would, but only half as far as four hours.

Warning! Don't think that directly proportional means "when one increases, the other increases" or "when one decreases, the other decreases". It's a more specific kind of relationship than that. Here's a contrary example. A worker who puts in 60 hours on the job works 1.5 times as much as one who puts in 40 hours.

60 hr | = 1.5 |

40 hr |

But workers working more that 40 hours a week in the US are supposed to be paid at an overtime rate, which is typically one and a half times their regular wage. Thus the 60 hour-a-week worker earns 1.75 times as much as the 40 hour-a-week worker.

1 × 40 regular hours |
= 1.75 |

1 × 40 regular hours |

Since the changes are not the same…

1.75 ≠ 1.5

the wages earned in this example are not directly proportional to the hours worked. A direct relationship is much more special than the general statement, "when one increases, the other increases". It's more like, "when one changes by a certain ratio, the other changes by the same ratio".

### inverse

Moving on. Take a look at this curve. This shape is called a rectangular hyperbola — a hyperbola since it has asymptotes (lines that the curve approaches, but never crosses) and rectangular since the asymptotes are the *x* and *y* axes (which are at right angles to one another).

Some say that this curve shows the opposite behavior of the previous one; that is, as the *x* variable increases, the *y* variable decreases and as the *x* variable decreases, the *y* variable increases. But like the previous curve there's a more specific kind of change that takes place. Check it out for yourself. Pick a convenient point on the curve. Note the coordinate values at this point. Now double the *x* coordinate and see what happens to the *y* coordinate. It's cut in half. Now try the reverse. Pick a point on the curve and cut its *x* coordinate in half. The *y* coordinate is now double its original value. Triple *x* and you get one-third of *y*. Reduce *x* to one-fourth and watch *y* increase by four. However you change one of the variables the other changes by the inverse amount. This illustrates another simple kind of proportionality — inverse proportionality. Two quantities are said to be inversely proportional if their product is a constant.

*xy* = *k*

Rearranging this definition gives us the general form equation…

y = | k |

x |

where *k* is the constant of proportionality.

A suitable conclusion statement from such a relationship would be that…

*y*is inversely proportional to*x*.*y*varies inversely as*x*.*y*and*x*are inversely proportional.*y*∝ 1/*x**y*∝*x*^{−1}

For example…

- The time needed to finish a job varies inversely as the number of workers. More workers means less time to finish a job. (Twice as many means it takes half the time.) Fewer workers means it takes longer. (If only one-third of the normal number of workers show up, the job will take three times longer.)
- The volume of a mass of gas is inversely proportional to the pressure acting on it. Place a balloon in a hyperbaric chamber and double the pressure — the balloon will squash to half its original volume. Place the balloon in a vacuum chamber and decrease the pressure to one-tenth atmospheric — the balloon will expand ten times in volume (assuming it doesn't break first).

### square

What do we have here? Why it's a parabola with its vertex at the origin. You get this kind of curve when one quantity is proportional to the square of the other. Since this parabola is symmetric about the *y*-axis that makes it a vertical parabola and we know that it's the horizontal variable that gets the square. Here's the general form equation for this kind of curve…

*y* = *kx*^{2}

A suitable conclusion statement from such a relationship would be that…

*y*is proportional to the square of*x*.*y*∝*x*^{2}

For example…

- The distance traveled by an object dropped from rest is proportional to the square of time. How long does it take to fall one meter? Double that time and you'll fall 4 m, triple it and you'll fall 9 m, and so on.
- The rate at which heat is produced by an electric circuit is proportional to the square of the current. Doubling the current in a toaster oven quadruples its heat output. Reduce the current in the CPU of a computer to half its previous value and you'll reduce the heat ouput to one-quarter its previous value.

### square root

Here's another parabola with its vertex at the origin, This one's tipped on its side and is symmetric about the *x*-axis. For a horizontal parabola like this one, it's the vertical variable that gets the square. The general form equation for this kind of curve is…

*y* = *k*√*x*

A suitable conclusion statement from such a relationship would be that…

*y*is proportional to the square root of*x*.*y*∝ √*x**y*∝*x*^{½}

For example…

- Speed is proportional to the square root of distance for freely falling objects. How fast is an object moving after it has fallen one meter? At four meters it'll have double that speed; at nine meters, triple; sixteen, quadruple; and so on.

Something to remember — the square root is not an explicit function. It isn't single-valued. Every number has two square roots: one positive and one negative. Typical curve fitting software disregards the negative root, which is why I only drew half a parabola on the diagram above. Something else to remember — the domain of the square root is restricted to non-negative values. That's a fancy way of saying you can't find the square root of a negative number (not without expanding your concept of "number", that is).

### power

So far we have five curves and five general form equations…

• independent | y = k |

• direct | y = kx |

• inverse | y = k/x |

• square | y = kx^{2} |

• square root | y = k√x |

They have three common components…

x = |
an independent variable (or explanatory variable) |

y = |
a dependent variable (or response variable) |

k = |
a constant of proportionality |

and one component that varies…

n = |
power of the independent variable |

We could rewrite these general equations with two variables, a constant of proportionality and a power like this…

• independent | y = kx^{0} |

• direct | y = kx^{1} |

• inverse | y = kx^{−1} |

• square | y = kx^{2} |

• square root | y = kx^{½} |

We could even go so far as to write a general form equation for a whole *family* of equations…

*y* = *kx ^{n}*

Any two variables that are related to one another by an equation of this form are said to have a power relation between them.

power | general form | description | appearance |
---|---|---|---|

0 | y = k |
independent | horizontal, straight line |

1 | y = kx |
direct | non-horizontal straight line through the origin |

2 | y = kx^{2} |
square | vertical parabola with vertex at the origin |

3 | y = kx^{3} |
cube | |

−1 | y = k/x |
inverse | rectangular hyperbola |

−2 | y = k/x^{2} |
inverse square | |

−3 | y = k/x^{3} |
inverse cube | |

½ | y = k√x |
square root | horizontal parabola with vertex at the origin |

⅓ | y = k∛x |
cube root |

### linear

Description: A combination of constant and direct. A fixed amount is added (or subtracted) at regular intervals.

General form.

*y* = *ax* + *b*

A suitable conclusion statement from such a relationship would be that…

*y*is linear with*x*.*y*varies linearly with*x*.*y*is a linear function of*x*.

Appearance: any straight line, regardless of slope or y-intercept

Example(s): utility bills (there's always a service charge)

### quadratic

Description: A combination of square, direct, and constant.

General Form

*y* = *ax*^{2} + *bx* + *c*

A suitable conclusion statement from such a relationship would be that…

*y*is quadratic with*x*.*y*varies quadratically with*x*.*y*is a quadratic function of*x*.

Appearance: A vertical parabola when graphed. It's vertex can be anywhere. It could also be flipped upside down.

Example(s): distance during uniform acceleration

### polynomial

Description: A combination of a constant, direct, square, cube, …. Keep going as far as you wish.

General form.

*y* = *a* + *bx* + *cx*^{2} + *dx*^{3} +…

A suitable conclusion statement from such a relationship would be that…

*y*can be approximated by an nth order polynomial of*x*.- An nth order polynomial of
*x*was fit to*y*.

Appearance: any non-periodic function without asymptotes

Example(s): Polynomial functions can be used to approximate many continuous, single-valued curves

order | general form | name |
---|---|---|

0 | y = a |
constant |

1 | y = a + bx |
linear |

2 | y = a + bx + cx^{2} |
quadratic |

3 | y = a + bx + cx^{2} + dx^{3} |
cubic |

4 | y = a + bx + cx^{2} + dx^{3} + ex^{4} |
quartic |

5 | y = a + bx + cx^{2} + dx^{3} + ex^{4} + fx^{5} |
quintic |

⋮ | ⋮ | ⋮ |

n | y = a_{0}x^{0} + a_{1}x^{1} + a_{2}x^{2} + a_{3}x^{3} + … + a_{n}x^{n} |
nth order polynomial |

### exponential growth

Description:

General form.

*y* = *an ^{bx}*

A suitable conclusion statement from such a relationship would be that…

*y*increases exponentially with*x*.*y*grows exponentially with*x*.*y*∝*n*^{x}

The ratio of successive iterations is a constant. The quantity is multiplied by a fixed amount at regular intervals.

Appearance: asymptotic with negative *x*-axis, followed by runaway expansion

Example(s): unrestricted population growth, the magic of compound interest

### exponential decay

Description:

General form.

*y* = *an*^{−bx}

A suitable conclusion statement from such a relationship would be that…

*y*decreases exponentially with*x*.*y*decays exponentially with*x*.*y*∝*n*^{−x}

The ratio of successive iterations is a constant. The quantity is divided by a fixed amount at regular intervals.

Appearance: large initial value followed by abrupt collapse, approaches positive *x*-axis asymptotically

Example(s): radioactive decay, discharging a capacitor, de-energizing an inductor

### exponential approach

Description:

General form.

*y* = *a*(1 − *n*^{−bx}) + *c*

A suitable conclusion statement from such a relationship would be that…

*y*approaches a final value exponentially.

Appearance: asymptotically approaches a horizontal line

Example(s): charging a capacitor, energizing an inductor, teaching (half the students get it, then half of the remaining students get it, then half of the remaining students get it, and so on…)

### periodic

Description:

General form.

*y* = *a* sin(*bx* + *c*)

A suitable conclusion statement from such a relationship would be that…

*y*varies periodically with*x*.*y*is periodic with*x*.

Appearance: A sine curve is the prototypical example, not the only example. Any curve that repeats itself is periodic.

Example(s): Any daily (diurnal), monthly (lunar), yearly (annual, seasonal), or other periodic change.