# Hawkes Process : recursive formula for : $R'_{m,n} (k) = \sum_{ \{i : t_i^n < t_k^m \} } (t_k^m - t_i^n) \exp ( - \beta_{m,n} ( t_k^m - t_i^n ) )$

Following the advice of a fellow mathematician, I am asking my question here from (https://mathoverflow.net/questions/365554/hawkes-process-recursive-formula-for-r-m-n-k-sum-i-t-in-t)

I need to use a function inside a my code and it is very expensive. I'd like to know if there exists a recursive version of it. I would like to reduce the complexity of the computations.

\begin{align*} k = 1, \quad R'_{m,n} (k) &= 0 \\ k \geq 2, \quad R'_{m,n} (k) &= \sum_{ \{i : t_i^n < t_k^m \} } (t_k^m - t_i^n)^{ \text{ either } 1 \text{ or } 2} \exp ( - \beta_{m,n} \cdot ( t_k^m - t_i^n ) ) \end{align*}

Perhaps do you have tricks in order to achieve such a thing ? How can I know there isn't any recursive version of the function ? The original expression is markovian, thus such recursive version should exists.

$$R_{m,n}(1) = 0$$ and for $$k \geq 1$$ as

$$\begin{equation*} \forall k \geq 2, \qquad R_{m,n} (k) = \sum_{ \{i : t_i^n < t_k^m \} } \exp \left ( - \beta_{m,n} \cdot ( t_k^m - t_i^n ) \right ) \end{equation*}$$ recursive version :

\begin{align*} k = 1, \quad R_{m,n} (k) &= 0 \\ k \geq 2, \quad R_{m,n} (k) &= \exp ( - \beta_{m,n} \cdot ( t_k^m - t^m_{k-1} ) ) R_{m,n} (k-1) \\ &+ \sum_{ \{i: t_i^n \in [ \ t_{k-1}^m, t_k^m \ [ \ \} } \exp ( - \beta_{m,n} ( t^m_k - t_i^n ) ) \end{align*}