A stochastic cannibalistic snail problem

96 Views Asked by At

Here's a somewhat stupid question, in sum about adding stochasticity to a linear ODE (see the end).

Background

I was thinking about a silly problem of 4 cannibal snails in a box:

Each snail starts in a corner and wants to eat the next one around the circle (anticlockwise say); and thereby moves at constant speed towards this other snail. What is the shape of the curves they trace?

The ODE

Thinking about this I came up with the following model.

It's an ODE for $ z(t) \in \mathbb C ^{\,4,1}$, where each coordinate of $z$ represents the position of a snail in the plane. More precisely:

$$\dot z (t) = B z(t),\quad \text{where}\quad B := \begin{pmatrix} -1&1&0&0\\ 0&-1&1&0\\ 0&0&-1&1\\ 1&0&0&-1 \end{pmatrix},\quad\text{ and}\quad z(0) = \begin{pmatrix}1\\-i\\-1\\i\end{pmatrix}.$$

And naturally such a nice ODE straightforwardly yields the following solution:

$$ z(t) = e^{tB}z(0) = \begin{pmatrix} e^{(-1-i) t} \\ -i e^{(-1-i) t}\\ -e^{(-1-i) t}\\ i e^{(-1-i) t} \end{pmatrix} $$

and corresponds to the following nice little spiral.

Snails trying to eat one another make a spiral

The question

What does one obtain when one adds stochasticity to the model, i.e. white noise to the ODE? Do we see the same sprialling inwards curve-plus-noise, or does something a bit weirder happen?

Further to this, whatever the behaviour is, is there a manner of adding noise which has the opposite effect?

1

There are 1 best solutions below

2
On

This is purely a numerical answer. I used Matlab to solve the deterministic ODE and also to simulate realisations of the stochastic ODE. It seems like nothing unexpected happens, and on average the stochastic paths follow the deterministic path.

Following are plots of 200 realisations of the stochastic ODE with varying levels of noise, and the mean trajectories, compared to the deterministic solutions.

Starting with small noise, $\sigma=0.001$, the 200 paths

200 paths with sigma = 0.01

and the mean path with the deterministic ODE solution as dashed lines

mean of 200 realisations compared to deterministic result

Increasing the noise to 0.1 gives the following results:

enter image description here

enter image description here

And increasing it to 1 gives

enter image description here

enter image description here

and you can see the mean is still similar to the deterministic path, with more realisations I think it's fair to assume it would get closer (edit: it does).

Here is the code I used to generate these images

T = 10;

% deterministic solution
[~,z] = ode45(@(t,z) (diag(-ones(1,4))+diag(ones(1,3),1)+diag(1,-3))*z,[0 T],[1+0i;1i;-1+0i;-1i]);

% Euler's method for stochastic ODEs
N = 200; % number of realisations
h = 0.01; % time step
sigma = 0.1; % standard deviation
s = zeros(4,2); % initialise results array
figure(1),clf,hold on

for j = 1:N
    % Euler scheme
    x = [1 0;0 1;-1 0;0 -1]; % initial conditions
    for k = 1:floor(T/h) % updates
        x(:,:,k+1) = x(:,:,k)+(circshift(x(:,:,k),-1)-x(:,:,k))*h...
            +sigma*randn(size(x(:,:,k)))*sqrt(h);
    end

    plot(squeeze(x(:,1,:)).',squeeze(x(:,2,:)).') % plot path j

    s = s+x; % store results
end
hold off

figure(2)
s = s/N; % averaged path
plot(squeeze(s(:,1,:)).',squeeze(s(:,2,:)).')
hold on
plot(z,'--') % deterministic path
hold off