Thursday, September 10, 2009

Calculus in 5 minutes (part 1)


Here is a post I wrote for my son. I hope he reads it! The essential ideas of calculus are surprisingly simple. See if you don't agree.

We can talk about the slope of a curve at a single point. This seems odd because "slope" refers to a change in y divided by a change in x. We ought to need two points, not just one. But we don't.

A single point can have a slope for the same reason that the earth seems to be flat where I'm standing right now even though I know it is curved---it is flat, on the ocean or the Mohave desert anyway. The carpenters who built your house assumed that the earth's curvature is negligible, and we will too. We can mentally zoom in indefinitely (ask an ant if the earth is flat).

So for any given point on a curve, we can always find another point very close nearby which has the same slope, and then we know the slope between them is constant (within any limits you want to establish).

Like driving a car

You can understand the basic procedures in calculus by thinking about driving a car (Strang). Most drivers refer frequently to the speedometer (measures velocity), if they're measuring distance they refer to the odometer.

If we plot accumulated distance as a function of time, the slope of that curve is the velocity shown on the speedometer. [This analogy will become useful in part 2].

Simple tricks

There are tricks to use to find the slope from the equation for a curve. Where the tricks come from isn't hard to understand, but it's not necessary---just use the trick. Consider the equation:

(y-1) = (x-2)2

Multiply it out to make things a bit more interesting:

y = x2 - 4x + 5

The trick is that the slope of the curve (designated as y') is easily calculated:

y  = x2 - 4x + 5
y' = 2x - 4

We used three rules together:

(i) if we have various parts being added together, we take the slope for each part separately and then add them up.

(ii) the slope of a constant term (like y = 3) is zero (obviously, a horizontal line is flat, and has slope = 0).

(iii) if (c stands for constant):

y  = c xn;  
y' = c n xn-1

So what

One reason this is useful is to find maximum and minimum points of a curve. These are points at which the slope is zero. For our example

y' = 2x - 4
0 = 2x - 4
x = 2

This happens when

y = x2 - 4x + 5
y = 4 - 8 + 5 = 1

This is easy to see by going back to the first form of the equation. The minimum is when the term in parentheses on the right is zero.

(y-1) = (x-2)2

There are other simple tricks for terms like 2x and sin x.

R code:
f <- function(x) { x**2 - 4*x + 5}
plot(f,from=-3, to = 7)
plot(f,from=-3, to = 7,col='red',lwd=3)

No comments: