# Ants decision model fitting with fokker planck

Consider the Fokker-Planck equation,

$$\frac{\partial G}{\partial t}=\frac{\sigma^{2}}{2}\frac{\partial^{2}G}{\partial s^{2}}-\frac{\partial}{\partial s}\left(G\frac{\partial U(s)}{\partial s}\right),\\$$

where $$U(s)$$ is the effective potential for the decision variable:

$$U(s)=\gamma s+ks\sum_{\alpha}\delta\left(t-t_{\alpha}\right).\\$$

Using $$U(s)$$, this becomes

$$\label{eq:FP} \label{eq:FP}\frac{\partial G}{\partial t}=\frac{\sigma^{2}}{2}\frac{\partial^{2}G}{\partial s^{2}}-\frac{\partial G}{\partial s}\left(\gamma+k\sum_{\alpha}\delta\left(t-t_{\alpha}\right)\right).\\$$

To solve this using the finite element method, first let $$G=\eta_{i}g_{i}$$, where $$\eta_{i}$$ are the shape functions and $$g_{i}$$ are the nodal variables. Summation notation applies over roman indices, e.g. over $$i$$ and $$j$$. After writing the weak form of the equation and setting the integral of the residual to zero, we obtain the finite element matrix equation:

$$\label{eq:FPmatrix} \label{eq:FPmatrix}M_{ij}\frac{dg_{j}}{dt}=\frac{\sigma^{2}}{2}A_{ij}g_{j}-\left(\gamma+k\sum_{\alpha}\delta\left(t-t_{\alpha}\right)\right)B_{ij}g_{j},\\$$

where $$M_{ij}$$, $$A_{ij}$$, and $$B_{ij}$$ are matrices: $$M_{ij}$$ is the mass matrix, $$A_{ij}$$ is a second-derivative operator, and $$B_{ij}$$ is a derivative operator.

The mass matrix is defined by integrating the shape functions:

$$M_{ij}=\int_{-1}^{1}\eta_{i}\eta_{j}ds.\\$$

To define $$A_{ij}$$, we will use integration by parts so that only a first derivative remains (and thus we will only need to use linear shape functions. Writing out the integral, and then integrating by parts, we have

\begin{align} \label{eq:Aijcalc} A_{ij} & =\int_{-1}^{1}\eta_{i}\frac{\partial^{2}\eta_{j}}{\partial s^{2}}ds\notag \\ & \label{eq:Aijcalc}=\left.\eta_{i}\frac{\partial\eta_{j}}{\partial s}\right|_{-1}^{1}-\int_{-1}^{1}\frac{\partial\eta_{i}}{\partial s}\frac{\partial\eta_{j}}{\partial s}ds.\@add@PDF@RDFa@triples\end{document}\\ \end{align}