Logo

A physics toolbox for laser spectroscopy.

Static Badge Static Badge Static Badge

Static Badge Static Badge

© 2025 Patrick Müller. All rights reserved.

qspec.simulate.ct_markov_dgl  (  t n rates r = 1.0 p0 = None time_resolved = False show = False  )[source]

Computes the evolution of a linear continuous-time markov chain numerically by solving the underlying ODE system.

Parameters:
tarray_like

The time after which the probability is returned. If all times from 0 to 't' are required, use 'time_resolved'=True (us).

nint

The maximum state number to compute. The first state corresponds to 'n' = 0.

ratesarray_like

The rate(s) at which the markov chain is transferring population from state i to state i + 1. If 'rates' is a scalar, this rate is assumed for all 0 ≤ i ≤ 'n'. If 'rates' is an Iterable, individual rates 'rates[i]' are assumed for the states i and 'rates' must have size 'n' + 1.

rarray_like

The ratio of the population which is transferred from state i to state i + 1. Here 1 - r is the ratio of the population that is lost during the transition from state i to state i + 1.

p0array_like

The initial population distribution. Must be an Iterable of length max('n') + 1. If None, 'p0' is set to [1, 0, 0, ..., 0].

time_resolvedbool

Whether to return the complete history of the result. If True, a 2-tuple similar to (time, population) is returned, were population has shape (time.size, n + 1). time will be an array of equally spaced times, such that numerical integrations can be performed easily.

showbool

Whether to plot the result.

Returns:
outNone

The probability distribution of the states 0 ≤ i ≤ 'n' after the time 't' for P(t=0, n=i) = p0[i] The normalization condition is sum_n(P(n, t0)) = 1 for every single point in time t0.

API navigation