MakarovSuites
English
EnglishDeutschРусскийУкраїнськаFrançaisEspañolItalianoPolski
Contact & licences

Math

The derivative under a microscope

Zoom in on a smooth curve with the vertical scale locked to the horizontal one and it straightens: that is what a derivative is, and the secant through two points walks onto the tangent as they close. Then the same lens on a corner, a cusp and a curve whose difference quotient settles on nothing - three different failures, drawn as two tangents, a vertical one and none. And the part nobody is told: in floating point a smaller step stops helping near 1e-8 and then makes the answer worse, because subtracting two nearly equal numbers throws away the digits that carried the answer.

The derivative under a microscope — Actual application image
Actual application image

What happens

Magnify a smooth graph enough and it stops looking curved - that is what the derivative says, and this module is the microscope. Zoom in on a point and the graph straightens into its tangent; halve the window and the remaining bend falls by four. Zoom in on a kink and it never straightens: |x| keeps two slopes, x^(2/3) a vertical one, a wiggle stays wiggly at every scale. Then compute the slope numerically and meet the other limit - shrink h too far and rounding error takes over, so there is a best h and it is not zero. Try the functions, zoom, and read where the difference quotient stops improving.

Equations used in the module
Equations
f'(x) = lim (f(x+h) − f(x))/h
local linearity: max |f(x+s) − f(x) − f'(x)s| ≤ w²|f''|/2 on |s| ≤ w
forward difference: error ~ h|f''|/2 + 2ε|f|/h
central difference: error ~ h²|f'''|/6 + ε|f|/h,  ε = 2.2e−16

Related experiments

Back to catalogue
The integral, built by hand — Actual application image

Math

The integral, built by hand

Fill the region under a curve with panels and watch the count climb: the choice of where each panel takes its height decides everything, and the trapezoid that follows the curve is exactly twice as bad as the midpoint rectangle that does not. Then the sign, because the integral of a sine over one period is zero while the area between it and the axis is four. And the accumulated function, whose slope is the curve you started from - except where the curve jumps, and there it has a corner instead.

How much room a cell takes — Actual application image

Math

How much room a cell takes

Change variables in an integral and a factor appears; everyone learns to write r dr dθ and few are shown where the r comes from. It is the determinant of the map's derivative - the ratio between a tiny cell's area and its image's, measured here on the polygons themselves. Three things that determinant is not: the sign is an orientation and not part of the factor, a vanishing determinant means an edge collapsed rather than cells got small, and the integral of |det J| equals the image's area only when the map covers it once. z → z² covers the unit disc twice and the total is out by exactly two.

Bounds instead of estimates — Actual application image

Math

Bounds instead of estimates

Every other way of computing gives a number that is probably right. Interval arithmetic gives a pair that is certainly right, and the whole subject is what that costs. It costs sharpness, and the cost has a name: every occurrence of a variable is treated as a different variable, so x − x comes out as an interval two units wide. Which means the enclosure is a property of the FORMULA, not of the function - rewrite x(1 − x) as 0.25 − (x − 0.5)² and the width falls from 1 to the true 0.25; write x·x instead of x² in 1/(1 + 25x²) and the answer becomes the entire real line.