code: def expectation(P, obs):
      r
      pi = statdist(P)
      return np.dot(pi, obs)
docs: r"""Equilibrium expectation of given observable.
  
      Parameters
      ----------
      P : (M, M) ndarray
          Transition matrix
      obs : (M,) ndarray
          Observable, represented as vector on state space
  
      Returns
      -------
      x : float
          Expectation value