Differential equation, recursively defined

Nov 2019
We will look at a model with a number of driverless cars that use the same control system. Suppose that M cars drive one after another on a road. The position of car i at time t is called xi(t). The cars are arranged so that




The function g is just equal to g = 5 m/s for all t.


The function f is f(x)=x/3, for 0<x<75 and is for 75<x equal to 25 (in the graph above vM = 25 m/s and d = 75m).

Let M = 10
0 < t < 40s

Let the positions of the cars at time t = 0 be given by xi (0) = d · i, i = 1, ..., M

Here xi^n denotes the Euler approximation after n steps, i.e an approximation of xi(t), where t = n*h.

You are supposed to implement eulers method to solve this problem:
This problem is solved with paper and pencil. If the time step h is too large, the cars may "pass each other" in the Euler solution, ie. xi^n> x(i + 1)^n (xi^n represents the i:th car to the power of n) , for some time step n (n*h = t). Determine an upper limit for time step h such that it is certain that this will not happen.

I am having problem with this as there are no similar problems in my book. By writing and testing in mat lab I get that n must be equal to 13 and therefore h = 40/13. See code here:
(FunkF is just the function for the derivative of x with respect to t) As you can see no car is passed by. But when n=12 i get the plot below:
Can someone help me prove that this is true by only using paper and pencil.

Regards Karl
Last edited:


Sep 2016
Unless somehow it's just me, probably nobody can read the text.