Calculus: dx/dt=f(t) as dx=f(t)*dt as x = integral f(t) dt

  • To those who ask what the infinitely small quantity in mathematics is, we answer that it is actually zero. Hence there are not so many mysteries hidden in this concept as they are usually believed to be. (Euler)

Watch and play with this code. containing the essence of Calculus in few lines.

The Calculus of Newton/Leibniz opened to the Industrial Revolution of the late 17th century forever changing human conditions in the form of mathematics of change as the initial value problem of finding a function x(t) of the (time) variable t, which solves:

  • \frac{dx}{dt} = f(t) for t>0
  • x(0)=x0

where  f(t) is a given function of t and x0 a given initial value.

Computing x(t) by time stepping in the form

  • x(t+dt) = x(t) + f(t)*dt,

with dt a given time step, successively computes x(t+dt) at a next time t+dt from x(t) at former time t plus the change of  f(t)*dt,  which can be captured by summation over all time steps to a final time T=N*dt after N steps:

  • x(T) =x0 + \sum_{n=1}^{N-1}f(n*dt)*dt
  • = x0 + f(0)*dt + f(dt)*dt + f(2*dt)*dt +f(3*dt)*dt +...f((N-1)*dt)*dt.

To capture this summation formula, Leibniz introduced the notation

  •  x(T)=x0 +\int_0^Tf(t)\, dt

where the integral sign in the form of an extended S represents the summation with t as integration variable and dt as time step.

We can now express the Fundamental Theorem of Calculus as:

  1. Time stepping of \frac{dx}{dt} = f(t) constructs the integral x=\int f(t)\, dt of the integrand f(t) by summation.
  2. Differentiation of the integral x=\int f(t)\, dt produces the integrand as f(t)=\frac{dx}{dt}.

Here the constructive step is the time stepping 1 with  f(t) given, captured as summation by repetition,  while 2 expresses the starting point as the initial value problem with dx =f(t)*dt.

Extension to f(x,t) depending also on x is direct, see 5. and 8. below.

A basic case is f(x,t)=x for which the integral is x =exp(t) with the remarkable property of being equal to its derivative as shown here.

More generally, the elementary functions sin(t), cos(t), log(t) and exp(t), and special functions such as Bessel functions,  all arise as solutions to initial value problems of basic form, and their values are computed by time stepping.

To do:

1. Study experimentally by computing the dependence of \int_0^T f(t)\, dt on the time step dt. Compare with Midpoint Euler vs Forward/Endpoint Euler. Divide time step by 2 and see effect.

2. Solve formally dx/dt = t for t > 0 with x(0)=0.

3. Solve formally dx/dt = t*t for t > 0 with x(0)=0.

4. Solve formally  dx/dt = t*t….*t  (n times) for t > 0 with x(0)=0.

5. Compare the effect of taking one step with time step 2*dt to taking two steps with time step dt when time stepping dx = f(t)*dt. See that the difference is (f(t)-f(t+dt))*dt, which is bounded by L*dt*dt if f(t) is Lipschitz continuous with Lipschitz constant L.   Conclude that the variation of the integral x(T) with the time step dt is bounded by T*L*dt,  Conclude that the integral of a Lipschitz continuous function can be computed to arbitrary accuracy by time stepping. In short: if the variation over one time step scales with dt*dt, then the variation after 1/dt time steps scales with dt.

6. Compare accuracy (see Midpoint Euler vs Forward/Endpoint Euler ) of

  • Forward Euler: x(t+dt) = x(t) + f(t)*dt
  • Backward Euler: x(t+dt) = x(t) + f(t+dt)*dt
  • Midpoint Euler: x(t+dt) = x(t) + f(t+dt/2)*dt

Find that Forward and Backward Euler are first order accurate in the sense that the variation of x(T) with the time step is bounded by T*L*dt. Find that Midpoint Euler is second order accurate with variation bounded by T*L*dt*dt.

7.  Note that if x(t) solves dx = f(t)*dt and |f(t)| < L, then |x(t+dt) – x(t)| = |dx| < L*|dt|, which means that x(t) is Lipschitz continuous with Lipschitz constant L.

8. Compare the effect of taking one step with time step 2*dt to taking two steps with time step dt when time stepping dx = f(x)*dt where f(x) is Lipschitz continuous with Lipschitz constant L. Se that the difference is (f(x) – f(x+f(x)*dt))*dt and that therefore the effect is bounded by L*|f(x)|*dt*dt < L*M*dt*dt if |f(x)|<M. Conclude that the variation of the solution x(T) of dx/dt = f(x),  where f(x) is bounded and Lipschitz continuous, with the time step dt is bounded by T*L*M*dt,  Conclude that  x(T) can be computed to arbitrary accuracy by time stepping. In short: if the variation over one time step scales with dt*dt, then the variation after 1/dt time steps scales with dt.

Essence of Calculus:

If f(t) is Lipschitz continuous, then time stepping with Forward Euler solves dx = f(t)*dt with global error bounded by constant*dt and local variation

  • x(t+dt) = x(t) + f(t)*dt + E, with |E| < constant*dt*dt,

expressing that x(t) is locally close to a linear function with slope dx/dt = f(t). Illustrate in a picture!

If |f(t)| is bounded , then a solution x(t) of dx = f(t)*dt is Lipschitz continuous  and so is locally close to a constant function. Illustrate in a picture!