<jupyter_start><jupyter_text>A continuous time markov chain $X$ is defined by$$\mathbb{P}(X_{t + dt} = j | X_t = i) = \delta_{ij} + q_{ij}dt$$where $Q=(q_{ij})$ is an intensity matrix, that is$$q_{ij} \geq 0,\ i\neq j$$$$\sum_j q_{ij} = 0$$<jupyter_code>from stochastic_process.markov_chain import MarkovChain

X = MarkovChain(1, 2, 5, 4, 6, 3)
X.Q<jupyter_output><empty_output><jupyter_text>Assuming $X$ is homogeneous in time, the matrix$$P(\delta_t) = I + Q \delta_t$$describe probabilities for $X$ to switch from one state to another within the $\delta_t$ time interval.<jupyter_code>X.P(delta_t=0.02)<jupyter_output><empty_output><jupyter_text>Note that $\delta_t$ must indeed be sufficiently small for $P(\delta_t)$ to be a probability matrix. For example $\delta_t = 0.2$ will be too large:<jupyter_code>X.P(delta_t=0.2) # Return a matrix P with negative coefficients.<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup