- qspec.simulate. ct_markov_analytic ( t , n , rates , r=1.0 )[source]
-
The analytic solution of the evolution of a linear continuous-time Markov chain $0\rightarrow 1\rightarrow 2\rightarrow\dots$ with the rates $\lambda_i$, starting in the state 0. For a constant rate $\lambda$, this is the Poisson distribution
$$ P(n, t) = \frac{(r\lambda t)^n}{n!}e^{-\lambda t}. $$For individual rates, the analytic solution can be numerically unstable, since very small numbers are multiplied with very large numbers. See
ct_markov_dglfor a numerical solution.- Parameters:
-
- tarray_like
The time $t$ at which the probability is returned (μs).
- narray_like
The number $n$ of the state for which the probability is returned. The first state corresponds to
n = 0.- ratesarray_like
The rate(s) $\lambda_i$ at which the Markov chain transfers population from the state $i$ to the state $i + 1$ (MHz). If
ratesis a scalar, this rate is assumed for all $0 \leq i \leq n$. Ifratesis an iterable, it must have lengthmax(n) + 1and individual ratesrates[i]are assumed for the states $0 \leq i \leq n$.- rarray_like
The ratio $r$ of the population which is transferred from the state $i$ to the state $i + 1$. Then $1 - r$ is the ratio of the population that is lost during the transition.
- Returns:
-
- pndarray
The probability $P(n, t)$ for the Markov chain to be in the state
nafter the timet, with $P(0, 0) = 1$. Iftandnare iterables, a 2d-array with shape(t.size, n.size)is returned.
- Raises:
-
- ValueError
If
ris not a scalar between 0 and 1.