5 The geometry of calculus

 

This chapter covers

  • Using the derivative as a measure of how fast a function grows
  • Computing the derivative of a function not only as a number, but also as a function itself
  • Using derivatives to compute tangent vectors of parametric curves
  • Using second derivatives to assess the curvature of a curve
  • Composing smooth piecewise functions and parametric curves

People usually have a pretty good intuition about the topics we’re going to talk about. Does a function grow or decline? Is a surface smooth, or does it have some sharp edges? Is one curve curvier than another? Usually, we can answer all these questions intuitively. But we can’t program intuition. We need formal things; we need formulas; we need equations. We need the mathematical basis on which to build our code. So this chapter is dedicated to calculus, its role in geometry, and the geometry behind it.

I know that calculus has a bad reputation for being dry and boring. But you’ll learn it not by studying formulas, but by expanding the geometric intuition you already have. We’ll leave the formulas to SymPy.

The concepts introduced in this chapter aren’t necessarily geometrical, but they’ll help you understand splines and nonlinear geometric transformations (chapters 7 and 8). They’ll also enable some interesting practical examples in chapters 11 and 12, such as building a smooth contour out of square pixels and coining a continuous curve out of parabolas.

5.1 What is a derivative?

5.1.1 Derivative at a point

5.1.2 Derivative as a function

5.1.3 Rules of differentiation

5.1.4 Using SymPy to do differentiation

5.1.5 Section 5.1 summary

5.2 Smooth piecewise parametric curves

5.2.1 Piecewise functions

5.2.2 Smooth parametric curves

5.2.3 Curvature

5.2.4 Section 5.2 summary

5.3 Practical example: Crafting a curve out of lines and circles

5.3.1 The biarc building block