Skip to main content
5 of 6
added 177 characters in body
probably_someone
  • 35.8k
  • 3
  • 58
  • 98

Let $F(r)$ be any function satisfying the following properties:

  • $F(r)$ is well defined for $r\in[0,1]$.
  • $F(r)\geq 0$ for $r\in[0,1]$.
  • $F(r)$ is decreasing for $r\in[0,1]$.

Then a repulsive interaction satisfying your conditions can be built as follows:

For two agents $a$ and $b$, their positions at time $t_{i+1}$ are determined from their positions at time $t_i$ as follows:

$$a(t_{i+1})=a(t_i)+(1-\delta_{a(t_i)0})(1-\delta_{a(t_i)1})\text{sgn}(a(t_i)-b(t_i))F(|a(t_i)-b(t_i)|)$$ $$b(t_{i+1})=b(t_i)+(1-\delta_{b(t_i)0})(1-\delta_{b(t_i)1})\text{sgn}(b(t_i)-a(t_i))F(|a(t_i)-b(t_i)|)$$

where

$$\text{sgn}(x)=\begin{cases}1 & \text{if }x>0 \\ 0 & \text{if }x=0 \\ -1 & \text{if }x<0\end{cases}$$

is the usual "sign function", and

$$\delta_{yz}=\begin{cases}1 & \text{if }y=z\\ 0 & \text{if }y\neq z\end{cases}$$

is the Kronecker delta. The sign function ensures that the force is pointing the right direction to be repulsive, and the Kronecker deltas shut the force off once the agent hits the end of the interval.

There are an infinity of possible choices for $F$; examples include:

  • $F(r)=\mu(1-r)$
  • $F(r)=\mu(1-r^n)$
  • $F(r)=\frac{\mu}{r+\epsilon}$
  • $F(r)=e^{-\mu r}$
probably_someone
  • 35.8k
  • 3
  • 58
  • 98