code: def transition_matrix(self):
          
          P0 = np.diag(self.r, k=0)
          P1 = np.diag(self.p[0:-1], k=1)
          P_1 = np.diag(self.q[1:], k=-1)
          return P0 + P1 + P_1
docs: Tridiagonal transition matrix for birth and death chain
  
          Returns
          -------
          P : (N,N) ndarray
              Transition matrix for birth and death chain with given
              creation and anhilation probabilities.