I Introduction

The fact that velocity and acceleration are related to the temporal change of displacement and velocity, respectively, implies relations that enable us to monitore motions by means of computers. This can occur with high accuracy in finite computational time. The basic observation is that the rate of change, or trend, $r$ of a function $f$ is well approximated by the ratio of the increment of the function $\Delta f$ belonging to a finite time difference $\Delta t$ divided by this time difference: $$ r(t) = \Delta f / \Delta t = (f(t + \Delta t) - f(t)) / \Delta t . \qquad (1)$$ The approximation is the better, the smaller $\Delta t$ is.

In mathematical terms, the exact trend is the derivative, $f’$, of function $f$. Determine the difference between the derivative of function $f(t)=t^2$ and the approximate expression of its rate, (1), at a given small time difference $\Delta t$. result.

The derivative of $t^2$ at $t$ is $2t$. The approximate form (1) with $\Delta t$ is $$ r(t)= [(t+\Delta t)^2-t^2]/\Delta t = [t^2 + 2 t \Delta t + (\Delta t)^2 - t^2] / \Delta t = [2 t \Delta t + (\Delta t)^2] / \Delta t = 2t + \Delta t. $$ The deviation from the true derivative equals $\Delta t$, the time difference. With $\Delta t = 0.001$, the deviation is $1/1000$, an error which is often barely recognizable.

Comparing the numerical results with a known case: vertical projection

Let us start with a case familiar to any student, which offers insight into what we obtain when using expression (1) belonging to some $\Delta t$. We shall also see how accurate such an approach can be.

Consider a vertical projection with initial velocity $v_0 = 10 \text{ m/s}$ whose velocity function is known to be $v(t)=10-10t$ (in SI units) when the gravitational acceleration is taken as $g=10 m\text{/s}^2$. The velocity $v$ is the rate of change, or trend, of the position $x$. We know that the exact displacement function is $x(t)=10t-5t^2$, when starting from coordinate zero ($x_0=0$). Let us apply the approximant form (1) for the displacement $x$ as $f$ with the known velocity $v(t)$ as the rate $r(t)$. This implies $$ (x(t+\Delta t)-x(t))/\Delta t = v(t). \qquad (2)$$ Let us consider time instances at integer multiples $(n=1,2,\dots)$ of the time step $\Delta t$ and denote the displacement obtained from (2) as $x_n$ at time instants $n\Delta t$. $x_{n+1}$ is thus the displacement at $(n+1)\Delta t$. Thus, (2) reads as $$ x_{n+1} = x_n + v_n\Delta t. \qquad (3) $$ This discrete-time relation has a very clear interpretation: knowing the rate of change $v_n$ at a time instant, the increment in the position is the rate of change multiplied by the times step. In other words, during sufficiently short time intervals, any motion is uniform, displacement occurs with practically constant velocity. If $v_n$ is known at any time instant, by measn of (3) we can determine all the $x_n$ values. More generally. for $\Delta t$ small enough, we can recover any function $f$ from its rate of change, or trend, $r(t)$ (in term of mathematics, by integrating the derivative).

Show that relation (3) has the geometric meaning that function $x$ at time $(n+1)\Delta t$ is well approximated by the value taken on its tangent drawn to the function at time $n\Delta t$, if $\Delta t$ is small. Hint: the slope of the tangent at $t$ is the derivative at this point. result.

The rate of change of function $x(t)$ at time $t$ is the velocity $v(t)$. The equation of a tangent line passing through the point $(t, x(t))$ is $x(t’)=x(t)+v(t)(t’-t)$. Taking $t’$ as $(n+1)\Delta t$ and $t=n\Delta t$, we recover $$ x_{n+1} = x_n + v_n \Delta t $$ since $v_n$ denotes $v(n \Delta t)$. Tangents are known to approximate very well, for short distances, the curves to which they are drawn. We can thus be optimistic concerning the accuracy of iteration (3) for short time steps $\Delta t$.

Equation (3) also implies that from the position and velocity $(x_n, v_n)$ characterizing the $n$th time instant and the time step itself you will get, by means of elementary operations, the position at the next time step. Starting from $x_0 = 0$ at $t=0$, you get $x_1=v_0 \Delta t$. With this, you can go one step further and obtain $x_2=x_1+v_1 \Delta t$, and so on, as long you want! This iterative method provides a way to unfold motions, and is ideally suited for computers to calculate. Before doing so, however, it is worth becoming acquainted with the method by personal experience (once in your life).

The exact flight time of the vertical projection considered is 2 s. Let us divide this into 10 steps, i.e. take $\Delta t=0.2 \text{s}$. Based on (3), please fill in the missing data in the table below. For your convenience the selected time instances are given, as well as (in the last column), the precise values of $x(t)=10t-5t^2$ at the selected time instances. After filling in, you shall be able to see how much the discrete-time and the continuous-time views differ.

For printing out, you can download the table from here.

$n$ $t$ $v_n=10-10t$ $v_{n-1}\Delta t$ $x_n=x_{n-1} + v_{n-1}\Delta t$ $x(t)=10t-5t^2$
0 0 10 - 0 0
1 0.2 8 2 1.8
2 0.4 3.2
3 0.6 4.2
4 0.8 4.8
5 1.0 5.0
6 1.2 4.8
7 1.4 4.2
8 1.6 3.2
9 1.8 1.8
10 2.0 0.0
11 2.2 -2.2

When finished, you see differences. This is natural since 0.2 s is not a really small value compared to the precise flight time of 2 s. What is surprising is that the numerically obtained values follow a sequence qualitatively similar to the exact motion, and there is a full return to the $x=0$ level at the 11th time step, i.e. at time 2.2 sec. This deviates only 10% from the exact flight time! Note that this final deviation is of the order of $\Delta t.$

Now it is worth putting the iteration scheme on a computer. The easiest way to generate a table is by means of the Excel program. In this Excel worksheet the rules are built in. You can check these out by clicking on the different boxes in the $n=1$ row. If, after marking this row, you scroll down to the $n=11\text{th}$ time step, the same table appears that you just completed. With a new feature, nonetheless: the results are also represented graphically (as red dots), and a blue curve (a parabola) indicates the exact displacement function. The qualitative similarity is more striking than just from the table.

An interesting feature of this simple system is that points obtained when dividing the flight time $T$ into $N$ steps ($\Delta t=T/N$) correspond to an exact vertical projection initiated with a larger velocity, namely with $v'_0=v_0(1+1/N)$. This also indicates that for sufficiently small time-steps, i.e. for $N \gg 1$ the discrete-time results become reliable! Check this relation for our case where $N=10$ and hence the initial velocity should be $v'_0=11$ m/s. result.

The exact displacement function with $v'_0=11 \text{ m/s}$ is $x'(t)=11t-5t^2$

Taking this at time instants $n$ 0.2 s, one finds the displacements in meters: $$ x'_n=11 n 0.2 -5 (n 0.2)^2 = 2.2 n- 0.2 n^2. $$ For $n=1,\dots,11$ these are exactly the values seen in our table as the result of the numerical approach.

Show, by comparing the numerical increment $x_{n+1}-x_n$ and the exact one $x(t=(n+1)\Delta t)-x(t=n \Delta t)$ taken with the same $\Delta t$ that their difference is proportional to $\Delta t^2$. This means that the error due to using approximation (3) is, within one time step, of the order of $\Delta t^2$. For e. g, $\Delta t=0.01$ this error is as small as about one ten-thousandth. result.

Using the velocity function $v(t)=10-10t$, the increment $x_{n+1}-x_n$ is $x_{n+1}-x_n =(10-10n\Delta t) \Delta t$.
From the exact $x(t)=10t-5 t^2$ we find for $$ x((n+1)\Delta t)-x(n\Delta t)=10(n+1)\Delta t-10n\Delta t-5(n+1)^2(\Delta t)^2 + 5 n^2 t^2 =\\ =10\Delta t - 10n(\Delta t)^2- 5(\Delta t)^2. $$ The difference between the two increments is $5(\Delta t)^2$. The numerical difference can be read off from comparing rows $n+1$ and $n$ of the filled-in table, and one finds the difference 0.2 (the numerical increment being the larger) which corresponds to $5(\Delta t)^2$, indeed.

The same Excel worksheet can be used to repeat the analysis with smaller time steps. The recommended values are: $\Delta t=0.1\text{s}$ and $\Delta t=0.02 \text{s}$. Don’t forget to scroll down to the 21st and 101st time step. Is the correspondence with the exact result better? If you have the courage to take $\Delta t=0.002$, are you able to see any difference in the graphics?

The example of vertical projection is so simple that you can derive an explicit expression for $x_n$ as a function of $\Delta t$. This enables us to express the difference between the discrete-time, numerical and the exact result after several iterations. Hint: add up the increments, and remember the sum of arithmetic series. result.

Let us add up the increments from 1 to $n$: $$ x_1 + (x_2 -x_1) + \cdots (x_n-x_{n+1}) = x_n =10\Delta t + (10-10\Delta t) \Delta t +\\ +(10-10\ 2\Delta t) \Delta t + (10-10\ 3\Delta t) \Delta t + \dots + (10-10 (n-1)\Delta t) \Delta t. $$ The term $10\Delta t$ occurs $n-1$ times, while the coefficient of $10 (\Delta t)^2$ is $(1+ 2 + 3 + \dots n-1)$. This is an arithmetic series whose sum is $n(n-1)/2$. Thus, the explicit expression for the numerical displacement after $n$ steps is $$ x_n =10n\Delta t - 5 n(n-1) (\Delta t)^2.$$ The exact value of $x$ at $t=n\Delta t$ is $$ x(t=n \Delta t)=10n\Delta t - 5 (n\Delta t)^2.$$ The difference is $5 n (\Delta t)^2$ ("in favor" of the numerical algorithm). You can check the validity of this result in your table. Anyhow, the difference after n steps also becomes very small for small time steps, but increases with $n$. By dividing the flight time into $N$ time steps: $\Delta t=T/N$, the end difference is $5 N (\Delta t)^2= 5 N (T/N)^2 =5 T \Delta t$, larger than the one step error, which was found to be proportional to $(\Delta t)^2$. Errors intend to accumulate when applying the iteration several times.

Answer the previous questions for vertical projections with and arbitrary initial velocity $v_0$ and by denoting the gravity by $g$. result.

One-step difference:
Using the exact velocity function $v(t)=v_0-gt$, the numerical increment is $x_{n+1}-x_n = (v_0-g n\Delta t) \Delta t$.
From $x(t)=v_0 t-(g/2) t^2$ we find for the exact increment $$ x((n+1)\Delta t)-x(n\Delta t) = v_0(n+1)\Delta t-v_0 n \Delta t-(g/2) (n+1)^2(\Delta t)^2 + (g/2) n^2 t^2 = $$ $$ = v_0\Delta t -gn(\Delta t)^2 - (g/2)(\Delta t)^2. $$ The one-step error between the two expressions is $(g/2) (\Delta t)^2$.

Long-term difference:
Adding up the increments from 1 to $n$ and using the sum of arithmetic series: $$ x_n =v_0\Delta t + (v_0-g\Delta t) \Delta t + (v_0-2 g \Delta t) \Delta t + \dots + (v_0-g (n-1)\Delta t) \Delta t =\\ = v_0n\Delta t - (g/2) n(n-1) (\Delta t)^2. $$ The exact value of $x$ at $t=n\Delta t$ is $$ x(t=n \Delta t)=v_0 n\Delta t - (g/2) (n\Delta t)^2. $$ The difference is $(g/2) n (\Delta t)^2$.

This linear growth with $n$ is faster here than in general cases where the total error grows with the number of steps approximately as $n^{1/2}$.

The equivalent exact vertical projection
The total flight time is $2 v_0/g$. When this is divided into $N$ time steps, $\Delta t=2 v_0/(gN)$. Inserting this into the expression of $x_n$ above, we find: $$ x_n = v_0 n 2 v_0/(g N) - (g/2) n^2 (2 v_0/g N)^2 - (g/2) n (2 v_0/g N) =\\ = v_0 n (2 v_0/g N) (1+1/N) - g/2 n^2 (2 v_0/g N)^2 $$ Since index $n$ belongs to time instant $t= n 2 v_0/(g N)$, this is $$ v_0 (1+1/N) t - g/2 t^2 $$ what is the displacement function of a vertical projection initiated with velocity $v_0 (1+1/N)$. This illustrates clearly that for large $N$ (small $\Delta t$) the numerical procedure provides results very close to the exact one.