# msmtools.analysis.expectation¶

msmtools.analysis.expectation(T, a, mu=None)

Equilibrium expectation value of a given observable.

Parameters: T ((M, M) ndarray or scipy.sparse matrix) – Transition matrix a ((M,) ndarray) – Observable vector mu ((M,) ndarray (optional)) – The stationary distribution of T. If given, the stationary distribution will not be recalculated (saving lots of time) val – Equilibrium expectation value fo the given observable float

Notes

The equilibrium expectation value of an observable a is defined as follows

$\mathbb{E}_{\mu}[a] = \sum_i \mu_i a_i$

$$\mu=(\mu_i)$$ is the stationary vector of the transition matrix $$T$$.

Examples

>>> import numpy as np
>>> from msmtools.analysis import expectation

>>> T = np.array([[0.9, 0.1, 0.0], [0.5, 0.0, 0.5], [0.0, 0.1, 0.9]])
>>> a = np.array([1.0, 0.0, 1.0])
>>> m_a = expectation(T, a)
>>> m_a
0.909090909...