Adding up small pieces
The question. If you know how fast your hand is moving at every moment, how far has it travelled?
This is the previous chapter run backwards, and it is the question a simulator faces at every instant. The laws of mechanics supply rates: a pull sets how fast velocity changes, and velocity is how fast position changes. To find where the arm is, the simulator must add up a great many small changes. The same adding-up gives the effort a muscle spends as it shortens and the mass of a bone from its shape.
By the end you will be able to find a total from a rate in three ways: as an area, by reversing a derivative, and by adding small pieces on a computer, knowing how the error shrinks as the pieces do.
From constant speed to changing speed
A hand moving at a constant 2 m/s for 3 s travels m. On a graph of velocity against time, that product is the area of a rectangle 2 m/s tall and 3 s wide.
When the velocity changes, cut the time into short pieces, each wide. Within one short piece the velocity hardly changes, so treat it as constant at the value it has when the piece begins. The distance covered in that piece is then about that velocity multiplied by , which is a thin rectangle on the graph. Adding the rectangles for all the pieces gives
where are the moments at which the pieces begin. In words: velocity multiplied by a short time, added up over all the short times.
The shorter the pieces, the less the velocity changes within each, and the closer the sum comes to the true distance. The value that the sum approaches as the pieces shrink is the integral of the velocity, written
In words: the total of velocity multiplied by a sliver of time, from time 0 to time . The sign is a stretched S, for sum. On the graph the rectangles fill the region between the curve and the time axis, so the integral is the area under the curve (Hartman 2017, sections 5.2 and 5.3).
A worked example
Take the hand of the last chapter, whose velocity is , and ask how far it travels in its first 2 s.
With four pieces of 0.5 s, the velocities at the start of the pieces are 0, 1, 2 and 3 m/s, and the sum is
| Pieces | Width of each (s) | Sum (m) | Short of the exact distance by (m) |
|---|---|---|---|
| 4 | 0.5 | 3 | 1 |
| 8 | 0.25 | 3.5 | 0.5 |
| 16 | 0.125 | 3.75 | 0.25 |
The exact distance is the area under the straight line : a triangle 2 s wide and 4 m/s tall, with area m.
The sums fall short because each rectangle misses a small triangle between its flat top and the sloping line. That triangle is wide and tall, so its area is . There are such triangles, which makes the whole shortfall . Halving the width of the pieces halves the error.
The same sum in other places
Effort from force over distance. Stretching a rubber band takes effort, and the pull needed grows as the band stretches. Stretched tissue in the body behaves the same way. Suppose the pull rises steadily from 0 to 10 N while the stretch goes from 0 to 0.1 m. Over each small extra stretch the effort is the pull at that moment multiplied by , so the total is the integral : the area under the line of pull against stretch. That area is a triangle, newton-metres. Energy and work calls this total the work done on the band.
The mass of a bone from thin slices. Cut a bone into thin slices across its length. A slice at position along the bone, whose cut face has area and whose thickness is , has volume . Multiply by the density , the mass of each cubic metre of the material, and add over all the slices: the mass is . Suppose a shaft 0.3 m long narrows steadily, its cut face shrinking from 0.0004 m² to 0.0002 m². The area under that straight line is the average of the two face areas multiplied by the length, m³, which is the volume of the shaft. With a density of 1,800 kg/m³, a value chosen here for illustration, its mass is kg.
Rates and totals undo each other
Let be the distance travelled up to time : the running total. During one more short piece it grows by about , so its rise over run is . The rate of change of the running total is the very quantity being added up:
In words: the derivative of the total so far is the rate at which it is growing. That gives a way of finding a total without adding anything. Find a formula whose derivative is , and subtract its value at the start from its value at the end:
In words: the total between two moments is the change in any quantity whose rate of change is . This is the fundamental theorem of calculus (Hartman 2017, section 5.4).
For , the power rule run backwards gives , whose derivative is . The distance in the first 2 s is m, as the triangle said. For it gives , and the distance is m.
Adding up on a computer
Formulas like these are rare. The rates in a body simulator come out of many parts acting on one another, and no formula gives their totals. A program adds pieces instead, and the shape of each piece matters.
- Rectangles use the value at the start of each piece. Each misses a sliver that is close to a small triangle, as in the worked example, so the error shrinks in proportion to the width of the pieces.
- Trapezoids join the values at the start and the end of each piece with a straight, slanted top, which amounts to using the average of the two values. For a velocity that is a straight line they are exact. For a smooth curve the error shrinks with the square of the width: half the width, a quarter of the error (Hartman 2017, section 5.5; Driscoll and Braun 2022, section 5.6).
For over the first 2 s, where the exact distance is 8 m:
| Pieces | Rectangles (m) | Error (m) | Trapezoids (m) | Error (m) |
|---|---|---|---|---|
| 4 | 5.25 | −2.75 | 8.25 | 0.25 |
| 8 | 6.5625 | −1.4375 | 8.0625 | 0.0625 |
| 16 | 7.2656 | −0.7344 | 8.0156 | 0.0156 |
Advance a little, repeat
The running total is built by repeating one line:
In words: the new total is the old total plus the rate multiplied by a short time. Know where you are, know your rate, take a small step, and repeat.
Here the rate was known in advance for every moment. In a simulator the rate depends on the present state, as the pull of a stretched band depends on how far it has already been stretched, but the loop is the same. Stepping through time builds on it.
Try it: pieces under a curve
- Check the worked example. Four rectangles under total 3 m against an exact 4 m. Press Play: the pieces are added one after another, and in the first plot the running total climbs in straight stretches beneath the exact curve, reaching 3 m at 2 s.
- Predict, then check. Raise the number of pieces to 8, then to 16. The totals are 3.5 m and 3.75 m: each doubling halves the shortfall. The second plot shows the shortfall for every number of pieces.
- Predict, then check. Go back to 4 pieces and change the shape to trapezoids. What is the total now? Exactly 4 m, because the slanted tops lie along the straight line.
- Try a curved velocity. Choose with 4 pieces. Rectangles give 5.25 m and trapezoids 8.25 m, against an exact 8 m.
- Predict, then check. Double the pieces to 8. The error of the rectangles roughly halves, to −1.44 m. The error of the trapezoids falls to a quarter, 0.06 m.
What this model leaves out
- Rates that depend on the state. The velocity was given in advance for every moment. When the rate depends on where the object already is, each step feeds the next, and errors can build on one another. Stepping through time studies that.
- Adding up over a solid. The slices of bone were stacked along one line. A real bone is added up over small blocks in all three directions. Bones as rigid bodies returns to this.
Summary
- An integral is a total built from a rate multiplied by small pieces: the value the sum approaches as the pieces shrink, and the area under the curve.
- Distance is the integral of velocity, work is the integral of force over distance, and the mass of a bone is the integral of density times the area of its cut face along its length.
- The derivative and the integral undo each other: a total between two moments is the change in a quantity whose rate of change is the thing being added.
- On a computer, the error of rectangles shrinks in proportion to the width of the pieces, and the error of trapezoids with its square.
- Advancing a little and repeating builds a running total. It is the seed of time stepping.
Next: with vectors, matrices, rates and totals in hand, the book turns to the law behind every motion in the simulator: force changes motion.