12. Differential Calculus

We now consider the formalization of notions from analysis, starting with differentiation in this chapter and turning integration and measure theory in the next. In Section 12.1, we stick with the setting of functions from the real numbers to the real numbers, which is familiar from any introductory calculus class. In Section 12.2, we then consider the notion of a derivative in a much broader setting.

12.1. Elementary Differential Calculus

Let f be a function from the reals to the reals.

Derivative of f at a single point:

open Real

/-- The sin function has derivative 1 at 0. -/
example : HasDerivAt sin 1 0 := by simpa using hasDerivAt_sin 0
example (x : ) : DifferentiableAt  sin x :=
  (hasDerivAt_sin x).differentiableAt

deriv f : : Derivative of a function f : , and is defined to take the value 0 at any point where f is not differentiable.

example {f :   } {x a : } (h : HasDerivAt f a x) : deriv f x = a :=
  h.deriv

example {f :   } {x : } (h : ¬DifferentiableAt  f x) : deriv f x = 0 :=
  deriv_zero_of_not_differentiableAt h

12.2. Differential Calculus in Normed Spaces