code: def recursive_mean(self, mean, length, chain):
          r
          n = length + len(chain)
          return length * mean / n + chain.sum(0) / n
docs: r"""Compute the chain mean recursively.
  
          Instead of computing the mean :math:`\bar{x_n}` of the entire chain,
          use the last computed mean :math:`bar{x_j}` and the tail of the chain
          to recursively estimate the mean.
  
          .. math::
              \bar{x_n} & = \frac{1}{n} \sum_{i=1}^n x_i
                        & = \frac{1}{n} (\sum_{i=1}^j x_i + \sum_{i=j+1}^n x_i)
                        & = \frac{j\bar{x_j}}{n} + \frac{\sum_{i=j+1}^n x_i}{n}
  
          :Parameters:
              -  mean : array
                  Previous mean.
              -  length : int
                  Length of chain used to compute the previous mean.
              -  chain : array
                  Sample used to update mean.