Secant to Tangent CalcLens

Hold one point P still and slide a second point Q toward it. The line through them is a secant, and its slope is an average rate of change. Watch what that slope does as the gap closes. Drag either point on the graph, or use the slider — P is the dark anchored dot, Q the coloured one with a halo.

Write it as you would say it: x^2, sin(x), -16x^2+32x+48, sqrt(x), 1/x.

Slide right to left to close the gap. h never reaches 0 — at h = 0 the difference quotient would be 0⁄0.

Closing the gap

Slope of the secant as h shrinks
hQ at slope of PQ

Secant to Tangent

P stays put. Q slides along the curve toward it. The line through P and Q is a secant, and its slope is the difference quotient — the average rate of change between the two points.

As h shrinks, the secant pivots. If it settles on one particular line, that line is the tangent and its slope is the derivative .

What to watch for

Putting this in a slide or a page

Every control is URL-addressable, so a lecture slide can link a stripped-down version. For example:

?f=-16x^2%2B32x%2B48&var=t&a=0.5&window=0,2
   &embed=true&controls=h&tangent=false

gives just the figure, the h slider and the table, with no function box and no tangent revealed. See docs/url-api.md for every parameter.

Keyboard

Change h (focus the slider first)
Space
Run or stop the gap closing
?
This dialog
Esc
Close