# Session 7

#### Fundamental Theorem Calculus

Recall that Calculus is about solving the differential equation du/dt = f(t) by time stepping in the form du = f(t)*dt or

• u(t+dt) = u(t) + f(t)*dt   (1)

starting at initial time t = 0 with u(0) given, where f(t) is given function of the variable t and dt a time step, which produces the values u(dt), u(2*dt), u(3*dt),…, u(N*dt), up to any final time T = N*dt after N time steps. We say that (1) represents Euler Forward with f(t) evaluated at the beginning of the time step from t t0 t+dt. Repeating (1) we get, assuming u(0) = 0,

• u(dt) = f(0)*dt,
• u(2*dt) =  f(0)*dt + f(dt)*dt,
• u(N*dt) = f(0)*dt + f(dt)*dt + f(2*dt)*dt +…+f((N-1)*dt)*dt,

that is with summation notation and T = N*dt,

•  $u(T)=\sum_{n=0}^{N-1}f(n*dt)*dt$               (2)

The Fundamental Theorem of Calculus states that computing with time steps dt decreasing to zero (with the number of time steps N = T/dt increasing) produces a unique solution u(T) at any given final time T named the integral of f(t) and denoted by u(T) = ∫ du = ∫ f(t)*dt, or more precisely

• $u(T) = \int_0^T f(t)dt$                             (3)

where the integral sign ∫ represents the summation in (2) of the values f(n*dt) of the integrand f(t) multiplied by the time step dt and the integration variable t ranges from 0 to T.

We here assume that f(t) is Lipschitz continuous satisfying for all t and s, |f(t) – f(s)| < L*|t – s| with L a Lipschitz constant.

By construction (1) we have du = u(t+dt)-u(t) = f(t)*dt , which by formally dividing by dt we write as du/dt = f(t) with du/dt the derivative of u. Given a function f(t) we have thus constructed by time stepping a function u(t) as the integral of f(t) with derivative du/dt = f(t). We thus start from f(t) and find a function u(t) = ∫ f(t)*dt which by construction has the derivative du/dt = f(t).

To prove the Fundamental Theorem (compare alternate version), we now study the dependence of u(T) on the time step dt , by decreasing dt successively by a factor of 2. The key observation is to see that the absolute value of the difference between one step with time step dt and two steps with time step dt/2, equals (see hint below + illustrate in picture):

• |(f(t)-f(t+dt/2))*dt/2| < L*dt*dt/4

and so the difference in the corresponding value of u(T) after T/dt steps is bounded by

• T*L*dt/4.

Conclude by repeated reduction of dt by a factor of 2,  that the difference in the value of u(T) (the error in computed value) is bounded by (compare with Session 6)

• T*L*dt*(1 + 1/2 + 1/4 + 1/8…)/4 < T*L*dt/2     (4)

We conclude that Euler Forward is first order accurate since the power of dt is one.

Verify (4) by computation.

Show that Midpoint Euler:

• u(t+dt) = u(t) + f(t+dt/2)*dt

is second order accurate. Verify by computation.

Hint: Let U be computed with time step dt and u with time step dt. We have starting at time t:

• U(t+dt) = U(t) + f(t)*dt
• u(t+dt) = u(t) + f(t)*dt/2 + f(t+dt/2)*dt

and so

• |u(t+dt) – U(t+dt)| ≤ |u(t) – U(t)|+ |(f(t)-f(t+dt/2))*dt/2|

showing that the contribution to U(T) – u(T) from time step t to t + dt, is bounded by L*dt*dt/4 .