```python
import ambulance_game as abg
import numpy as np
import sympy as sym
from sympy.abc import a,b,c,d,e,f,g,h,i,j
```

# Classic Markov Chain


```python
def get_P0(lambda_2, lambda_1, mu, num_of_servers, threshold):
    ro = (lambda_2 + lambda_1) / (mu * num_of_servers)
    summation_1 = np.sum(
        [
            ((ro * num_of_servers) ** i) / np.math.factorial(i)
            for i in range(num_of_servers)
        ]
    )
    summation_2 = ((num_of_servers * ro) ** num_of_servers) / (
        np.math.factorial(num_of_servers) * (1 - ro)
    )
    P_0 = 1 / (summation_1 + summation_2)
    return P_0

```


```python
def get_prob(P_0, state, lambda_2, lambda_1, mu, num_of_servers, threshold):
    u = state[0]
    v = state[1]

    ro = (lambda_2 + lambda_1) / (mu * num_of_servers)
    # P_0 = get_P0(lambda_2, lambda_1, mu, num_of_servers, threshold)

    if v < num_of_servers:
        P_i = P_0 * ((ro * num_of_servers) ** v) / np.math.factorial(v)
        return P_i

    # if u != 0:
    #     ro_a = (lambda_2) / (mu * num_of_servers)
    #     P_i_1 = (P_0 * (ro ** v) * (num_of_servers ** num_of_servers) / (np.math.factorial(num_of_servers)))
    #     P_i_2 = (P_0 * (ro_a ** u) * (num_of_servers ** num_of_servers) / (np.math.factorial(num_of_servers)))
    #     return P_i_1 + P_i_2

    P_i = (P_0 * (ro ** v) * (num_of_servers ** num_of_servers) / (np.math.factorial(num_of_servers)))
    return P_i

```


```python
lambda_2 = 1
lambda_1 = 1
mu = 2

num_of_servers = 3
threshold = 6
system_capacity = threshold - 1
buffer_capacity = 1

```


```python
abg.markov.visualise_ambulance_markov_chain(num_of_servers, threshold, system_capacity, buffer_capacity)
```


```python
all_states = abg.markov.build_states(threshold, system_capacity, buffer_capacity)
Q = abg.markov.get_transition_matrix(
    lambda_2, lambda_1, mu, num_of_servers, threshold, system_capacity, buffer_capacity
)
sol = abg.markov.get_steady_state_algebraically(Q, algebraic_function=np.linalg.solve)
sol


```




    array([0.36486486, 0.36486486, 0.18243243, 0.06081081, 0.02027027,
           0.00675676])




```python
exact_P0 = get_P0(lambda_2, lambda_1, mu, num_of_servers, threshold)
sum([get_prob(exact_P0, state, lambda_2, lambda_1, mu, num_of_servers, threshold) for state in all_states])

```




    0.9966329966329966




```python
sum([get_prob(sol[0], state, lambda_2, lambda_1, mu, num_of_servers, threshold) for state in all_states])

```




    0.9999999999999999



# Using Sympy


```python
lambda_2 = 1
lambda_1 = 1
mu = 2

num_of_servers = 1
threshold = 3
system_capacity = threshold - 1
buffer_capacity = 1
```

## Numeric


```python
Q_num = abg.markov.get_transition_matrix(lambda_2=lambda_2, lambda_1=lambda_1, mu=mu, num_of_servers=num_of_servers, threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
Q_num
```




    array([[-2.,  2.,  0.],
           [ 2., -4.,  2.],
           [ 0.,  2., -2.]])




```python
dimension = Q_num.shape[0]
print(dimension)
```

    3



```python
Q_num.transpose()[:-1,:]
```




    array([[-2.,  2.,  0.],
           [ 2., -4.,  2.]])




```python
M_num = np.vstack((Q_num.transpose()[:-1], np.ones(dimension)))
M_num
```




    array([[-2.,  2.,  0.],
           [ 2., -4.,  2.],
           [ 1.,  1.,  1.]])




```python
b_num = np.vstack((np.zeros((dimension - 1, 1)), [1]))
b_num
```




    array([[0.],
           [0.],
           [1.]])




```python
np.linalg.solve(M_num, b_num).transpose()[0]
```




    array([0.33333333, 0.33333333, 0.33333333])



## Symbolic


```python
Q_sym = abg.markov.get_symbolic_transition_matrix(num_of_servers=num_of_servers, 
                                            threshold=threshold, 
                                            system_capacity=system_capacity,
                                            buffer_capacity=buffer_capacity)
Q_sym
```




$\displaystyle \left[\begin{matrix}- \Lambda & \Lambda & 0\\\mu & - \Lambda - \mu & \Lambda\\0 & \mu & - \mu\end{matrix}\right]$




```python
dimension = Q_sym.shape[0]
dimension
```




    3




```python
sym.ones(1, dimension)
```




$\displaystyle \left[\begin{matrix}1 & 1 & 1\end{matrix}\right]$




```python
M_sym = sym.Matrix([Q_sym.transpose()[:-1,:], sym.ones(1,dimension)])
M_sym
```




$\displaystyle \left[\begin{matrix}- \Lambda & \mu & 0\\\Lambda & - \Lambda - \mu & \mu\\1 & 1 & 1\end{matrix}\right]$




```python
b_sym = sym.Matrix([sym.zeros(dimension - 1, 1), [1]])
b_sym
```




$\displaystyle \left[\begin{matrix}0\\0\\1\end{matrix}\right]$




```python
system = M_sym.col_insert(5,b_sym)
system
```




$\displaystyle \left[\begin{matrix}- \Lambda & \mu & 0 & 0\\\Lambda & - \Lambda - \mu & \mu & 0\\1 & 1 & 1 & 1\end{matrix}\right]$




```python
# np.linalg.solve(M_sym, b_sym).transpose()[0]
sym.init_printing(use_latex='mathjax')
sym_pi=sym.solve_linear_system_LU(system, [a,b,c,d,e])
sym_pi
```




$\displaystyle \left\{ a : - \frac{\Lambda + \frac{\Lambda \left(\Lambda + \mu\right)}{- 2 \Lambda - \mu}}{\Lambda - \frac{\left(- \Lambda + \mu\right) \left(\Lambda + \mu\right)}{- 2 \Lambda - \mu}} + 1 - \frac{- \Lambda - \frac{\left(- \Lambda + \mu\right) \left(\Lambda + \frac{\Lambda \left(\Lambda + \mu\right)}{- 2 \Lambda - \mu}\right)}{\Lambda - \frac{\left(- \Lambda + \mu\right) \left(\Lambda + \mu\right)}{- 2 \Lambda - \mu}}}{- 2 \Lambda - \mu}, \  b : \frac{- \Lambda - \frac{\left(- \Lambda + \mu\right) \left(\Lambda + \frac{\Lambda \left(\Lambda + \mu\right)}{- 2 \Lambda - \mu}\right)}{\Lambda - \frac{\left(- \Lambda + \mu\right) \left(\Lambda + \mu\right)}{- 2 \Lambda - \mu}}}{- 2 \Lambda - \mu}, \  c : \frac{\Lambda + \frac{\Lambda \left(\Lambda + \mu\right)}{- 2 \Lambda - \mu}}{\Lambda - \frac{\left(- \Lambda + \mu\right) \left(\Lambda + \mu\right)}{- 2 \Lambda - \mu}}\right\}$




```python
[sym.simplify(sym_pi[key]) for key in sym_pi.keys()]
```




$\displaystyle \left[ \frac{\mu^{2}}{\Lambda^{2} + \Lambda \mu + \mu^{2}}, \  \frac{\Lambda \mu}{\Lambda^{2} + \Lambda \mu + \mu^{2}}, \  \frac{\Lambda^{2}}{\Lambda^{2} + \Lambda \mu + \mu^{2}}\right]$




```python

```

# Multiple examples


```python
sym.init_printing(use_latex='mathjax')
```


```python
def get_symbolic_pi(num_of_servers, threshold, system_capacity, buffer_capacity):
    Q_sym = abg.markov.get_symbolic_transition_matrix(num_of_servers=num_of_servers, 
                                            threshold=threshold, 
                                            system_capacity=system_capacity,
                                            buffer_capacity=buffer_capacity)
    dimension =  Q_sym.shape[0]
    if dimension > 7:
        return "Capacity of 6 exceeded"
    M_sym = sym.Matrix([Q_sym.transpose()[:-1,:], sym.ones(1,dimension)])
    b_sym = sym.Matrix([sym.zeros(dimension - 1, 1), [1]])
    system = M_sym.col_insert(dimension,b_sym)
    sol = sym.solve_linear_system_LU(system, [a,b,c,d,e,f,g])
    return sol


```


```python

```

# $C=1, T=3, N=2, M=1$


```python
num_of_servers = 1
threshold = 3
system_capacity = 2
buffer_capacity = 1
```


```python
abg.markov.visualise_ambulance_markov_chain(num_of_servers, threshold, system_capacity, buffer_capacity)
```


```python
sym_pi = get_symbolic_pi(num_of_servers=num_of_servers, threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
```


```python
abg.markov.build_states(threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
```




$\displaystyle \left[ \left( 0, \  0\right), \  \left( 0, \  1\right), \  \left( 0, \  2\right)\right]$




```python
[sym.simplify(sym_pi[key]) for key in sym_pi.keys()]
```




$\displaystyle \left[ \frac{\mu^{2}}{\Lambda^{2} + \Lambda \mu + \mu^{2}}, \  \frac{\Lambda \mu}{\Lambda^{2} + \Lambda \mu + \mu^{2}}, \  \frac{\Lambda^{2}}{\Lambda^{2} + \Lambda \mu + \mu^{2}}\right]$




```python

```

# $C=1, T=4, N=3, M=1$


```python
num_of_servers = 1
threshold = 4
system_capacity = 3
buffer_capacity = 1
```


```python
abg.markov.visualise_ambulance_markov_chain(num_of_servers, threshold, system_capacity, buffer_capacity)
```


```python
sym_pi = get_symbolic_pi(num_of_servers=num_of_servers, threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
```


```python
abg.markov.build_states(threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
```




$\displaystyle \left[ \left( 0, \  0\right), \  \left( 0, \  1\right), \  \left( 0, \  2\right), \  \left( 0, \  3\right)\right]$




```python
[sym.simplify(sym_pi[key]) for key in sym_pi.keys()]
```




$\displaystyle \left[ \frac{\mu^{3}}{\Lambda^{3} + \Lambda^{2} \mu + \Lambda \mu^{2} + \mu^{3}}, \  \frac{\Lambda \mu^{2}}{\Lambda^{3} + \Lambda^{2} \mu + \Lambda \mu^{2} + \mu^{3}}, \  \frac{\Lambda^{2} \mu}{\Lambda^{3} + \Lambda^{2} \mu + \Lambda \mu^{2} + \mu^{3}}, \  \frac{\Lambda^{3}}{\Lambda^{3} + \Lambda^{2} \mu + \Lambda \mu^{2} + \mu^{3}}\right]$



# $C=1, T=1, N=2, Μ=1$


```python
num_of_servers = 1
threshold = 1
system_capacity = 2
buffer_capacity = 1
```


```python
abg.markov.visualise_ambulance_markov_chain(num_of_servers, threshold, system_capacity, buffer_capacity)
```


```python
abg.markov.build_states(threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
```




$\displaystyle \left[ \left( 0, \  0\right), \  \left( 0, \  1\right), \  \left( 1, \  1\right), \  \left( 0, \  2\right), \  \left( 1, \  2\right)\right]$




```python
sym_pi = get_symbolic_pi(num_of_servers=num_of_servers, threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
```


```python
sym_state_probs = [0 for _ in range(5)]
```


```python
# (0,0)
sym_state_probs[0] = sym.simplify(1 - sum(sym_state_probs[1:]))
sym_state_probs[0]
```




$\displaystyle \frac{\mu^{3} \left(\lambda^{A} + \mu\right)}{\Lambda \left(\lambda^{A}\right)^{2} \lambda^{o} + \Lambda \left(\lambda^{A}\right)^{2} \mu + \Lambda \lambda^{A} \left(\lambda^{o}\right)^{2} + 3 \Lambda \lambda^{A} \lambda^{o} \mu + 2 \Lambda \lambda^{A} \mu^{2} + \Lambda \lambda^{o} \mu^{2} + \Lambda \mu^{3} + \lambda^{A} \mu^{3} + \mu^{4}}$




```python
# (0,1)
sym_state_probs[1] = sym.simplify(sym_pi[b])
sym_state_probs[1]
```




$\displaystyle \frac{\Lambda \mu^{2} \left(\lambda^{A} + \mu\right)}{\Lambda \left(\lambda^{A}\right)^{2} \lambda^{o} + \Lambda \left(\lambda^{A}\right)^{2} \mu + \Lambda \lambda^{A} \left(\lambda^{o}\right)^{2} + 3 \Lambda \lambda^{A} \lambda^{o} \mu + 2 \Lambda \lambda^{A} \mu^{2} + \Lambda \lambda^{o} \mu^{2} + \Lambda \mu^{3} + \lambda^{A} \mu^{3} + \mu^{4}}$




```python
# (1,1)
sym_state_probs[2] = sym.simplify(sym_pi[c])
sym_state_probs[2]
```




$\displaystyle \frac{\Lambda \lambda^{A} \mu \left(\lambda^{A} + \lambda^{o} + \mu\right)}{\Lambda \left(\lambda^{A}\right)^{2} \lambda^{o} + \Lambda \left(\lambda^{A}\right)^{2} \mu + \Lambda \lambda^{A} \left(\lambda^{o}\right)^{2} + 3 \Lambda \lambda^{A} \lambda^{o} \mu + 2 \Lambda \lambda^{A} \mu^{2} + \Lambda \lambda^{o} \mu^{2} + \Lambda \mu^{3} + \lambda^{A} \mu^{3} + \mu^{4}}$




```python
# (0,2)
sym_state_probs[3] = sym.simplify(sym_pi[d])
sym_state_probs[3]
```




$\displaystyle \frac{\Lambda \lambda^{o} \mu^{2}}{\Lambda \left(\lambda^{A}\right)^{2} \lambda^{o} + \Lambda \left(\lambda^{A}\right)^{2} \mu + \Lambda \lambda^{A} \left(\lambda^{o}\right)^{2} + 3 \Lambda \lambda^{A} \lambda^{o} \mu + 2 \Lambda \lambda^{A} \mu^{2} + \Lambda \lambda^{o} \mu^{2} + \Lambda \mu^{3} + \lambda^{A} \mu^{3} + \mu^{4}}$




```python
# (1,2)
sym_state_probs[4] = sym.simplify(sym_pi[e])
sym_state_probs[4]
```




$\displaystyle \frac{\Lambda \lambda^{A} \lambda^{o} \left(\lambda^{A} + \lambda^{o} + 2 \mu\right)}{\Lambda \left(\lambda^{A}\right)^{2} \lambda^{o} + \Lambda \left(\lambda^{A}\right)^{2} \mu + \Lambda \lambda^{A} \left(\lambda^{o}\right)^{2} + 3 \Lambda \lambda^{A} \lambda^{o} \mu + 2 \Lambda \lambda^{A} \mu^{2} + \Lambda \lambda^{o} \mu^{2} + \Lambda \mu^{3} + \lambda^{A} \mu^{3} + \mu^{4}}$




```python
sym.simplify(sum(sym_state_probs))
```




$\displaystyle 1$




```python

```

# $C=2, T=1, N=2, M=1$


```python
num_of_servers = 2
threshold = 1
system_capacity = 2
buffer_capacity = 1
```


```python
abg.markov.visualise_ambulance_markov_chain(num_of_servers, threshold, system_capacity, buffer_capacity)
```


```python
abg.markov.build_states(threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
```




$\displaystyle \left[ \left( 0, \  0\right), \  \left( 0, \  1\right), \  \left( 1, \  1\right), \  \left( 0, \  2\right), \  \left( 1, \  2\right)\right]$




```python
sym_pi = get_symbolic_pi(num_of_servers=num_of_servers, threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
```


```python
sym_state_probs = [0 for _ in range(5)]
```


```python
# (0,0)
sym_state_probs[0] = sym.simplify(1 - sum(sym_state_probs[1:]))
sym_state_probs[0]
```




$\displaystyle \frac{2 \mu^{3} \left(\lambda^{A} + 2 \mu\right)}{\Lambda \left(\lambda^{A}\right)^{2} \lambda^{o} + 2 \Lambda \left(\lambda^{A}\right)^{2} \mu + \Lambda \lambda^{A} \left(\lambda^{o}\right)^{2} + 5 \Lambda \lambda^{A} \lambda^{o} \mu + 6 \Lambda \lambda^{A} \mu^{2} + 2 \Lambda \lambda^{o} \mu^{2} + 4 \Lambda \mu^{3} + 2 \lambda^{A} \mu^{3} + 4 \mu^{4}}$




```python
# (0,1)
sym_state_probs[1] = sym.simplify(sym_pi[b])
sym_state_probs[1]
```




$\displaystyle \frac{2 \Lambda \mu^{2} \left(\lambda^{A} + 2 \mu\right)}{\Lambda \left(\lambda^{A}\right)^{2} \lambda^{o} + 2 \Lambda \left(\lambda^{A}\right)^{2} \mu + \Lambda \lambda^{A} \left(\lambda^{o}\right)^{2} + 5 \Lambda \lambda^{A} \lambda^{o} \mu + 6 \Lambda \lambda^{A} \mu^{2} + 2 \Lambda \lambda^{o} \mu^{2} + 4 \Lambda \mu^{3} + 2 \lambda^{A} \mu^{3} + 4 \mu^{4}}$




```python
# (1,1)
sym_state_probs[2] = sym.simplify(sym_pi[c])
sym_state_probs[2]
```




$\displaystyle \frac{2 \Lambda \lambda^{A} \mu \left(\lambda^{A} + \lambda^{o} + 2 \mu\right)}{\Lambda \left(\lambda^{A}\right)^{2} \lambda^{o} + 2 \Lambda \left(\lambda^{A}\right)^{2} \mu + \Lambda \lambda^{A} \left(\lambda^{o}\right)^{2} + 5 \Lambda \lambda^{A} \lambda^{o} \mu + 6 \Lambda \lambda^{A} \mu^{2} + 2 \Lambda \lambda^{o} \mu^{2} + 4 \Lambda \mu^{3} + 2 \lambda^{A} \mu^{3} + 4 \mu^{4}}$




```python
# (0,2)
sym_state_probs[3] = sym.simplify(sym_pi[d])
sym_state_probs[3]
```




$\displaystyle \frac{2 \Lambda \lambda^{o} \mu^{2}}{\Lambda \left(\lambda^{A}\right)^{2} \lambda^{o} + 2 \Lambda \left(\lambda^{A}\right)^{2} \mu + \Lambda \lambda^{A} \left(\lambda^{o}\right)^{2} + 5 \Lambda \lambda^{A} \lambda^{o} \mu + 6 \Lambda \lambda^{A} \mu^{2} + 2 \Lambda \lambda^{o} \mu^{2} + 4 \Lambda \mu^{3} + 2 \lambda^{A} \mu^{3} + 4 \mu^{4}}$




```python
# (1,2)
sym_state_probs[4] = sym.simplify(sym_pi[e])
sym_state_probs[4]
```




$\displaystyle \frac{\Lambda \lambda^{A} \lambda^{o} \left(\lambda^{A} + \lambda^{o} + 3 \mu\right)}{\Lambda \left(\lambda^{A}\right)^{2} \lambda^{o} + 2 \Lambda \left(\lambda^{A}\right)^{2} \mu + \Lambda \lambda^{A} \left(\lambda^{o}\right)^{2} + 5 \Lambda \lambda^{A} \lambda^{o} \mu + 6 \Lambda \lambda^{A} \mu^{2} + 2 \Lambda \lambda^{o} \mu^{2} + 4 \Lambda \mu^{3} + 2 \lambda^{A} \mu^{3} + 4 \mu^{4}}$




```python
sym.simplify(sum(sym_state_probs))
```




$\displaystyle 1$




```python

```

# $C=1, T=2, N=2, M=2$


```python
num_of_servers = 1
threshold = 2
system_capacity = 2
buffer_capacity = 2
```


```python
abg.markov.visualise_ambulance_markov_chain(num_of_servers, threshold, system_capacity, buffer_capacity)
```


```python
sym_pi = get_symbolic_pi(num_of_servers=num_of_servers, threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
```


```python
abg.markov.build_states(threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
```




$\displaystyle \left[ \left( 0, \  0\right), \  \left( 0, \  1\right), \  \left( 0, \  2\right), \  \left( 1, \  2\right), \  \left( 2, \  2\right)\right]$




```python
sym_Lambda = sym.symbols("Lambda")
sym_lambda_1 = sym.symbols("lambda_1")
sym_lambda_2 = sym.symbols("lambda_2")
sym_mu = sym.symbols("mu")
```


```python
# (0,0)
(sym.simplify(sym_pi[e]) * sym_mu ** 4) / (sym_lambda_2 ** 2 * sym_Lambda ** 2)


```




$\displaystyle \frac{\mu^{4}}{\Lambda^{2} \left(\lambda^{A}\right)^{2} + \Lambda^{2} \lambda^{A} \mu + \Lambda^{2} \mu^{2} + \Lambda \mu^{3} + \mu^{4}}$




```python
# (0,1)
(sym.simplify(sym_pi[e]) * sym_mu ** 3) / (sym_lambda_2 ** 2 * sym_Lambda)
```




$\displaystyle \frac{\Lambda \mu^{3}}{\Lambda^{2} \left(\lambda^{A}\right)^{2} + \Lambda^{2} \lambda^{A} \mu + \Lambda^{2} \mu^{2} + \Lambda \mu^{3} + \mu^{4}}$




```python
# (0,2)
sym.simplify(sym_pi[c])
```




$\displaystyle \frac{\Lambda^{2} \mu^{2}}{\Lambda^{2} \left(\lambda^{A}\right)^{2} + \Lambda^{2} \lambda^{A} \mu + \Lambda^{2} \mu^{2} + \Lambda \mu^{3} + \mu^{4}}$




```python
# (1,2)
sym.simplify(sym_pi[d])
```




$\displaystyle \frac{\Lambda^{2} \lambda^{A} \mu}{\Lambda^{2} \left(\lambda^{A}\right)^{2} + \Lambda^{2} \lambda^{A} \mu + \Lambda^{2} \mu^{2} + \Lambda \mu^{3} + \mu^{4}}$




```python
# (2,2)
sym.simplify(sym_pi[e])
```




$\displaystyle \frac{\Lambda^{2} \left(\lambda^{A}\right)^{2}}{\Lambda^{2} \left(\lambda^{A}\right)^{2} + \Lambda^{2} \lambda^{A} \mu + \Lambda^{2} \mu^{2} + \Lambda \mu^{3} + \mu^{4}}$




```python

```

# Verify results


```python
num_of_servers = 1
threshold = 1
system_capacity = 2
buffer_capacity = 1
```


```python
abg.markov.build_states(threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
sym_pi = get_symbolic_pi(num_of_servers=num_of_servers, threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
```


```python
lambda_2 = 0.2
lambda_1 = 0.1
mu = 0.4
```


```python
`
[sym_pi[key].subs({sym_Lambda: lambda_2 + lambda_1, sym_lambda_1: lambda_1, sym_lambda_2: lambda_2, sym_mu: mu}) for key in sym_pi.keys()]
```




    [0.402515723270440,
     0.301886792452830,
     0.176100628930818,
     0.0503144654088050,
     0.0691823899371068]




```python
all_states = abg.markov.build_states(threshold, system_capacity, buffer_capacity)
Q = abg.markov.get_transition_matrix(
    lambda_2, lambda_1, mu, num_of_servers, threshold, system_capacity, buffer_capacity
)
sol3 = abg.markov.get_steady_state_algebraically(Q, algebraic_function=np.linalg.solve)
list(sol3)
```




    [0.4025157232704404,
     0.30188679245283023,
     0.17610062893081757,
     0.050314465408805034,
     0.06918238993710682]




```python

```

# $\pi$ for larger models

# $C=1, T=3, N=4, M=1$


```python
lambda_2 = 0.2
lambda_1 = 0.1
mu = 0.4

num_of_servers = 1
threshold = 3
system_capacity = 4
buffer_capacity = 1
```


```python
abg.markov.visualise_ambulance_markov_chain(num_of_servers, threshold, system_capacity, buffer_capacity)
```


```python
all_states = abg.markov.build_states(threshold, system_capacity, buffer_capacity)
Q = abg.markov.get_transition_matrix(
    lambda_2, lambda_1, mu, num_of_servers, threshold, system_capacity, buffer_capacity
)
sol = abg.markov.get_steady_state_algebraically(Q, algebraic_function=np.linalg.solve)
sol
```




    array([0.31771641, 0.23828731, 0.17871548, 0.13403661, 0.07818802,
           0.02233944, 0.03071672])




```python
def pi_for_1_server_3_threshold_4_sys_1_par(lambda_2, lambda_1, mu, num_of_servers, threshold, system_capacity, buffer_capacity):
    all_states = abg.markov.build_states(threshold, system_capacity, buffer_capacity)
    Lambda = lambda_2 + lambda_1
    pi = [0 for _ in range(len(all_states))]
    pi[0] = (lambda_2) * (mu ** 5) + (mu ** 6)  # (0,0)
    pi[1] = Lambda * lambda_2 * (mu ** 4) + Lambda * (mu ** 5)  # (0,1)
    pi[2] = (Lambda ** 2) * lambda_2 * (mu ** 3) + (Lambda ** 2) * (mu ** 4)    # (0,2)
    pi[3] = (Lambda ** 3) * lambda_2 * (mu ** 2) + (Lambda ** 3) * (mu ** 3)    # (0,3)
    pi[4] = (Lambda ** 3) * lambda_1 * lambda_2 * mu + (Lambda ** 3) * lambda_2 * (mu ** 2) + (Lambda ** 3) * lambda_2 * lambda_2 * mu     # (1,3)
    pi[5] = (Lambda ** 3) * lambda_1 * (mu ** 2)    # (0,4)
    pi[6] = (Lambda ** 3) * (lambda_1 ** 2) * lambda_2 + (Lambda ** 3) * lambda_1 * (lambda_2 ** 2) + 2 * (Lambda ** 3) * lambda_1 * lambda_2 * mu    # (1,4)
    sum_of_rates = sum(pi)
    pi = [i/sum_of_rates for i in pi]
    return pi

```


```python
ans = pi_for_1_server_3_threshold_4_sys_1_par(lambda_2, lambda_1, mu, num_of_servers, threshold, system_capacity, buffer_capacity)
```


```python
for i in range(7):
    print(str(ans[i]) + " " + str(sol[i]) + " ---> " + str(round(ans[i], 10) == round(sol[i], 10)))
```

    0.3177164132795532 0.3177164132795532 ---> True
    0.2382873099596649 0.23828730995966502 ---> True
    0.1787154824697487 0.1787154824697487 ---> True
    0.13403661185231155 0.13403661185231147 ---> True
    0.07818802358051506 0.07818802358051498 ---> True
    0.022339435308718594 0.022339435308718583 ---> True
    0.030716723549488064 0.030716723549487967 ---> True



```python

```

# $C=1, T=1, N=2, M=2$


```python
lambda_2 = 1
lambda_1 = 1
mu = 3

num_of_servers = 1
threshold = 1
system_capacity = 2
buffer_capacity = 2
```


```python
abg.markov.visualise_ambulance_markov_chain(num_of_servers, threshold, system_capacity, buffer_capacity)
```


```python
all_states = abg.markov.build_states(threshold, system_capacity, buffer_capacity)
Q = abg.markov.get_transition_matrix(
    lambda_2, lambda_1, mu, num_of_servers, threshold, system_capacity, buffer_capacity
)
sol = abg.markov.get_steady_state_algebraically(Q, algebraic_function=np.linalg.solve)
sol
```




    array([0.41116751, 0.27411168, 0.1142132 , 0.05329949, 0.06852792,
           0.04568528, 0.03299492])




```python
all_states
```




$\displaystyle \left[ \left( 0, \  0\right), \  \left( 0, \  1\right), \  \left( 1, \  1\right), \  \left( 2, \  1\right), \  \left( 0, \  2\right), \  \left( 1, \  2\right), \  \left( 2, \  2\right)\right]$




```python
def pi_for_1_server_1_threshold_2_sys_2_par(lambda_2, lambda_1, mu, num_of_servers, threshold, system_capacity, buffer_capacity):
    all_states = abg.markov.build_states(threshold, system_capacity, buffer_capacity)
    Lambda = lambda_2 + lambda_1

    pi = [0 for _ in range(len(all_states))]
    pi[0] = (mu ** 6) + 2 * (lambda_2) * (mu ** 5) + (lambda_2 ** 2) * (mu ** 4) # (0,0)
    pi[1] = (Lambda * mu ** 3) * (mu ** 2 + 2 * mu * lambda_2 + lambda_2 ** 2)  # (0,1)
    pi[2] = (Lambda * lambda_2 * mu ** 2) * (lambda_2 ** 2 + lambda_2 * lambda_1 + lambda_1 * mu + mu ** 2 + 2 * lambda_2 * mu) # (1,1)
    pi[3] = (Lambda * lambda_2 ** 2 * mu) * (lambda_2 ** 2 + 2 * lambda_1 * lambda_2 + 3 * lambda_1 * mu + mu ** 2 + 2 * lambda_2 * mu + lambda_1 ** 2) # (2,1)
    pi[4] = (Lambda * lambda_1 * mu ** 3) * (lambda_2 + mu)  # (0,2)
    pi[5] = (Lambda * lambda_1 * lambda_2 * mu ** 2) * (2 * mu + lambda_1 + lambda_2)   # (1,2)
    pi[6] = (Lambda * lambda_1 * lambda_2 ** 2) * (lambda_1 ** 2 + 4 * lambda_1 * mu + 2 * lambda_1 * lambda_2 + 3 * mu ** 2 + lambda_2 ** 2 + 3 * lambda_2 * mu)    # (2,2)
    sum_of_rates = sum(pi)
    pi = [i/sum_of_rates for i in pi]
    return pi

```


```python
ans = pi_for_1_server_1_threshold_2_sys_2_par(lambda_2, lambda_1, mu, num_of_servers, threshold, system_capacity, buffer_capacity)
```


```python
for i in range(7):
    print(str(ans[i]) + " " + str(sol[i]) + " ---> " + str(round(ans[i], 10) == round(sol[i], 10)))
```

    0.41116751269035534 0.4111675126903551 ---> True
    0.27411167512690354 0.27411167512690343 ---> True
    0.11421319796954314 0.11421319796954318 ---> True
    0.0532994923857868 0.05329949238578686 ---> True
    0.06852791878172589 0.06852791878172587 ---> True
    0.04568527918781726 0.04568527918781726 ---> True
    0.03299492385786802 0.032994923857868085 ---> True



```python
sym_pi = get_symbolic_pi(num_of_servers=num_of_servers, threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
```


```python
exp = sym.factor(sym_pi[g])
```


```python
exp
```




$\displaystyle \frac{\Lambda \left(\lambda^{A}\right)^{2} \lambda^{o} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 3 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 4 \lambda^{o} \mu + 3 \mu^{2}\right)}{\Lambda \left(\lambda^{A}\right)^{4} \lambda^{o} + \Lambda \left(\lambda^{A}\right)^{4} \mu + 2 \Lambda \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} + 5 \Lambda \left(\lambda^{A}\right)^{3} \lambda^{o} \mu + 3 \Lambda \left(\lambda^{A}\right)^{3} \mu^{2} + \Lambda \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} + 5 \Lambda \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu + 8 \Lambda \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{2} + 4 \Lambda \left(\lambda^{A}\right)^{2} \mu^{3} + \Lambda \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{2} + 4 \Lambda \lambda^{A} \lambda^{o} \mu^{3} + 3 \Lambda \lambda^{A} \mu^{4} + \Lambda \lambda^{o} \mu^{4} + \Lambda \mu^{5} + \left(\lambda^{A}\right)^{2} \mu^{4} + 2 \lambda^{A} \mu^{5} + \mu^{6}}$




```python

```

# Investigating ratio relations $\frac{\pi_i}{\pi_j}$


```python
sym.init_printing(use_latex='mathjax')
def get_symbolic_pi(num_of_servers, threshold, system_capacity, buffer_capacity):
    Q_sym = abg.markov.get_symbolic_transition_matrix(num_of_servers=num_of_servers, 
                                            threshold=threshold, 
                                            system_capacity=system_capacity,
                                            buffer_capacity=buffer_capacity)
    dimension =  Q_sym.shape[0]
    if dimension > 7:
        return "Capacity of 6 exceeded"
    M_sym = sym.Matrix([Q_sym.transpose()[:-1,:], sym.ones(1,dimension)])
    b_sym = sym.Matrix([sym.zeros(dimension - 1, 1), [1]])
    system = M_sym.col_insert(dimension,b_sym)
    sol = sym.solve_linear_system_LU(system, [a,b,c,d,e,f,g])
    return sol


```

## $C=1, T=2, N=2, M=2$


```python
num_of_servers = 1
threshold = 2
system_capacity = 2
buffer_capacity = 2

sym_pi_1222 = get_symbolic_pi(num_of_servers=num_of_servers, threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
all_states_1222 = abg.markov.build_states(threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
sym_state_probs_1222 = [0 for _ in range(len(all_states_1222))]
all_states_1222

```




$\displaystyle \left[ \left( 0, \  0\right), \  \left( 0, \  1\right), \  \left( 0, \  2\right), \  \left( 1, \  2\right), \  \left( 2, \  2\right)\right]$




```python
sym_state_probs_1222[0] = sym.factor(sym_pi_1222[a]) # (0,0)
sym_state_probs_1222[1] = sym.factor(sym_pi_1222[b]) # (0,1)
sym_state_probs_1222[2] = sym.factor(sym_pi_1222[c]) # (1,1)
sym_state_probs_1222[3] = sym.factor(sym_pi_1222[d]) # (0,2)
sym_state_probs_1222[4] = sym.factor(sym_pi_1222[e]) # (1,2)

```


```python
sym_state_recursive_ratios_1222 = sym.zeros(buffer_capacity + 1, system_capacity + 1)
sym_state_recursive_ratios_1222[0,0] = 1
sym_state_recursive_ratios_1222[0,1] = sym.factor(sym_state_probs_1222[1] / sym_state_probs_1222[0])  # (0,0) -> (0,1) 
sym_state_recursive_ratios_1222[0,2] = sym.factor(sym_state_probs_1222[2] / sym_state_probs_1222[1])  # (0,1) -> (1,1)
sym_state_recursive_ratios_1222[1,2] = sym.factor(sym_state_probs_1222[3] / sym_state_probs_1222[2])  # (0,1) -> (0,2)
sym_state_recursive_ratios_1222[2,2] = sym.factor(sym_state_probs_1222[4] / sym_state_probs_1222[3])  # (0,2) -> (1,2)

```


```python
abg.markov.visualise_ambulance_markov_chain(
    num_of_servers=num_of_servers, 
    threshold=threshold, 
    system_capacity=system_capacity, 
    buffer_capacity=buffer_capacity
)
```


```python
sym_state_recursive_ratios_1222
```




$\displaystyle \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\Lambda}{\mu}\\0 & 0 & \frac{\lambda^{A}}{\mu}\\0 & 0 & \frac{\lambda^{A}}{\mu}\end{matrix}\right]$



## $C=1, T=1, N=2, M=1$


```python
num_of_servers = 1
threshold = 1
system_capacity = 2
buffer_capacity = 1

all_states_1121 = abg.markov.build_states(threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
Q_sym_1121 = abg.markov.get_symbolic_transition_matrix(num_of_servers, threshold, system_capacity, buffer_capacity)
sym_pi_1121 = get_symbolic_pi(num_of_servers=num_of_servers, threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
sym_state_probs_1121 = [0 for _ in range(len(all_states_1121))]
```


```python
sym_state_probs_1121[0] = sym.factor(sym_pi_1121[a]) # (0,0)
sym_state_probs_1121[1] = sym.factor(sym_pi_1121[b]) # (0,1)
sym_state_probs_1121[2] = sym.factor(sym_pi_1121[c]) # (1,1)
sym_state_probs_1121[3] = sym.factor(sym_pi_1121[d]) # (0,2)
sym_state_probs_1121[4] = sym.factor(sym_pi_1121[e]) # (1,2)

```


```python
sym_state_recursive_ratios_1121 = sym.zeros(buffer_capacity + 1, system_capacity + 1)
sym_state_recursive_ratios_1121[0,0] = 1
sym_state_recursive_ratios_1121[0,1] = sym.factor(sym_state_probs_1121[1] / sym_state_probs_1121[0])  # (0,0) -> (0,1) 
sym_state_recursive_ratios_1121[1,1] = sym.factor(sym_state_probs_1121[2] / sym_state_probs_1121[1])  # (0,1) -> (1,1)
sym_state_recursive_ratios_1121[0,2] = sym.factor(sym_state_probs_1121[3] / sym_state_probs_1121[1])  # (0,1) -> (0,2)
sym_state_recursive_ratios_1121[1,2] = sym.factor(sym_state_probs_1121[4] / sym_state_probs_1121[3])  # (0,2) -> (1,2)

sym_state_recursive_ratios_right_1121 = sym_state_recursive_ratios_1121.copy()
sym_state_recursive_ratios_right_1121[1,2] = sym.factor(sym_state_probs_1121[4] / sym_state_probs_1121[2])  # (1,1) -> (1,2)

sym_state_recursive_ratios_P0_1121 = sym.zeros(buffer_capacity + 1, system_capacity + 1)
sym_state_recursive_ratios_P0_1121[0,0] = 1
sym_state_recursive_ratios_P0_1121[0,1] = sym.factor(sym_state_probs_1121[1] / sym_state_probs_1121[0])  # (0,0) -> (0,1) 
sym_state_recursive_ratios_P0_1121[1,1] = sym.factor(sym_state_probs_1121[2] / sym_state_probs_1121[0])  # (0,0) -> (1,1)
sym_state_recursive_ratios_P0_1121[0,2] = sym.factor(sym_state_probs_1121[3] / sym_state_probs_1121[0])  # (0,0) -> (0,2)
sym_state_recursive_ratios_P0_1121[1,2] = sym.factor(sym_state_probs_1121[4] / sym_state_probs_1121[0])  # (0,0) -> (1,2)

```


```python
abg.markov.visualise_ambulance_markov_chain(
    num_of_servers=num_of_servers, 
    threshold=threshold, 
    system_capacity=system_capacity, 
    buffer_capacity=buffer_capacity
)
```


```python
all_states_1121
```




$\displaystyle \left[ \left( 0, \  0\right), \  \left( 0, \  1\right), \  \left( 1, \  1\right), \  \left( 0, \  2\right), \  \left( 1, \  2\right)\right]$




```python
sym_state_probs_1121
```




$\displaystyle \left[ \frac{\mu^{3} \left(\lambda^{A} + \mu\right)}{\Lambda \left(\lambda^{A}\right)^{2} \lambda^{o} + \Lambda \left(\lambda^{A}\right)^{2} \mu + \Lambda \lambda^{A} \left(\lambda^{o}\right)^{2} + 3 \Lambda \lambda^{A} \lambda^{o} \mu + 2 \Lambda \lambda^{A} \mu^{2} + \Lambda \lambda^{o} \mu^{2} + \Lambda \mu^{3} + \lambda^{A} \mu^{3} + \mu^{4}}, \  \frac{\Lambda \mu^{2} \left(\lambda^{A} + \mu\right)}{\Lambda \left(\lambda^{A}\right)^{2} \lambda^{o} + \Lambda \left(\lambda^{A}\right)^{2} \mu + \Lambda \lambda^{A} \left(\lambda^{o}\right)^{2} + 3 \Lambda \lambda^{A} \lambda^{o} \mu + 2 \Lambda \lambda^{A} \mu^{2} + \Lambda \lambda^{o} \mu^{2} + \Lambda \mu^{3} + \lambda^{A} \mu^{3} + \mu^{4}}, \  \frac{\Lambda \lambda^{A} \mu \left(\lambda^{A} + \lambda^{o} + \mu\right)}{\Lambda \left(\lambda^{A}\right)^{2} \lambda^{o} + \Lambda \left(\lambda^{A}\right)^{2} \mu + \Lambda \lambda^{A} \left(\lambda^{o}\right)^{2} + 3 \Lambda \lambda^{A} \lambda^{o} \mu + 2 \Lambda \lambda^{A} \mu^{2} + \Lambda \lambda^{o} \mu^{2} + \Lambda \mu^{3} + \lambda^{A} \mu^{3} + \mu^{4}}, \  \frac{\Lambda \lambda^{o} \mu^{2}}{\Lambda \left(\lambda^{A}\right)^{2} \lambda^{o} + \Lambda \left(\lambda^{A}\right)^{2} \mu + \Lambda \lambda^{A} \left(\lambda^{o}\right)^{2} + 3 \Lambda \lambda^{A} \lambda^{o} \mu + 2 \Lambda \lambda^{A} \mu^{2} + \Lambda \lambda^{o} \mu^{2} + \Lambda \mu^{3} + \lambda^{A} \mu^{3} + \mu^{4}}, \  \frac{\Lambda \lambda^{A} \lambda^{o} \left(\lambda^{A} + \lambda^{o} + 2 \mu\right)}{\Lambda \left(\lambda^{A}\right)^{2} \lambda^{o} + \Lambda \left(\lambda^{A}\right)^{2} \mu + \Lambda \lambda^{A} \left(\lambda^{o}\right)^{2} + 3 \Lambda \lambda^{A} \lambda^{o} \mu + 2 \Lambda \lambda^{A} \mu^{2} + \Lambda \lambda^{o} \mu^{2} + \Lambda \mu^{3} + \lambda^{A} \mu^{3} + \mu^{4}}\right]$




```python
Q_sym_1121
```




$\displaystyle \left[\begin{matrix}- \Lambda & \Lambda & 0 & 0 & 0\\\mu & - \lambda^{A} - \lambda^{o} - \mu & \lambda^{A} & \lambda^{o} & 0\\0 & \mu & - \lambda^{o} - \mu & 0 & \lambda^{o}\\0 & \mu & 0 & - \lambda^{A} - \mu & \lambda^{A}\\0 & 0 & \mu & 0 & - \mu\end{matrix}\right]$




```python
sym_state_recursive_ratios_1121, sym_state_recursive_ratios_right_1121
```




$\displaystyle \left( \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right)}{\mu \left(\lambda^{A} + \mu\right)} & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + 2 \mu\right)}{\mu^{2}}\end{matrix}\right], \  \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right)}{\mu \left(\lambda^{A} + \mu\right)} & \frac{\lambda^{o} \left(\lambda^{A} + \lambda^{o} + 2 \mu\right)}{\mu \left(\lambda^{A} + \lambda^{o} + \mu\right)}\end{matrix}\right]\right)$




```python
sym.fraction(sym_state_probs_1121[0])[0], sym_state_recursive_ratios_P0_1121

```




$\displaystyle \left( \mu^{3} \left(\lambda^{A} + \mu\right), \  \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\Lambda \lambda^{o}}{\mu \left(\lambda^{A} + \mu\right)}\\0 & \frac{\Lambda \lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right)}{\mu^{2} \left(\lambda^{A} + \mu\right)} & \frac{\Lambda \lambda^{A} \lambda^{o} \left(\lambda^{A} + \lambda^{o} + 2 \mu\right)}{\mu^{3} \left(\lambda^{A} + \mu\right)}\end{matrix}\right]\right)$




```python

```

## $C=1, T=1, N=2, M=2$


```python
num_of_servers = 1
threshold = 1
system_capacity = 2
buffer_capacity = 2

all_states_1122 = abg.markov.build_states(threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
Q_sym_1122 = abg.markov.get_symbolic_transition_matrix(num_of_servers, threshold, system_capacity, buffer_capacity)
sym_pi_1122 = get_symbolic_pi(num_of_servers=num_of_servers, threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
sym_state_probs_1122 = [0 for _ in range(len(all_states_1122))]
```


```python
sym_Lambda = sym.symbols("Lambda")
sym_lambda_1 = sym.symbols("lambda_1")
sym_lambda_2 = sym.symbols("lambda_2")
sym_mu = sym.symbols("mu")
```


```python
sym_state_probs_1122[0] = (sym_mu ** 6) + 2 * (sym_lambda_2) * (sym_mu ** 5) + (sym_lambda_2 ** 2) * (sym_mu ** 4) # (0,0)
sym_state_probs_1122[1] = (sym_Lambda * sym_mu ** 3) * (sym_mu ** 2 + 2 * sym_mu * sym_lambda_2 + sym_lambda_2 ** 2)  # (0,1)
sym_state_probs_1122[2] = (sym_Lambda * sym_lambda_2 * sym_mu ** 2) * (sym_lambda_2 ** 2 + sym_lambda_2 * sym_lambda_1 + sym_lambda_1 * sym_mu + sym_mu ** 2 + 2 * sym_lambda_2 * sym_mu) # (1,1)
sym_state_probs_1122[3] = (sym_Lambda * sym_lambda_2 ** 2 * sym_mu) * (sym_lambda_2 ** 2 + 2 * sym_lambda_1 * sym_lambda_2 + 3 * sym_lambda_1 * sym_mu + sym_mu ** 2 + 2 * sym_lambda_2 * sym_mu + sym_lambda_1 ** 2) # (2,1)
sym_state_probs_1122[4] = (sym_Lambda * sym_lambda_1 * sym_mu ** 3) * (sym_lambda_2 + sym_mu)  # (0,2)
sym_state_probs_1122[5] = (sym_Lambda * sym_lambda_1 * sym_lambda_2 * sym_mu ** 2) * (2 * sym_mu + sym_lambda_1 + sym_lambda_2)   # (1,2)
sym_state_probs_1122[6] = (sym_Lambda * sym_lambda_1 * sym_lambda_2 ** 2) * (sym_lambda_1 ** 2 + 4 * sym_lambda_1 * sym_mu + 2 * sym_lambda_1 * sym_lambda_2 + 3 * sym_mu ** 2 + sym_lambda_2 ** 2 + 3 * sym_lambda_2 * sym_mu)    # (2,2)
```


```python
sym_state_recursive_ratios_1122 = sym.zeros(buffer_capacity + 1, system_capacity + 1)
sym_state_recursive_ratios_1122[0,0] = 1
sym_state_recursive_ratios_1122[0,1] = sym.factor(sym_state_probs_1122[1] / sym_state_probs_1122[0])  # (0,0) -> (0,1) 
sym_state_recursive_ratios_1122[1,1] = sym.factor(sym_state_probs_1122[2] / sym_state_probs_1122[1])  # (0,1) -> (1,1)
sym_state_recursive_ratios_1122[2,1] = sym.factor(sym_state_probs_1122[3] / sym_state_probs_1122[2])  # (1,1) -> (2,1)

sym_state_recursive_ratios_1122[0,2] = sym.factor(sym_state_probs_1122[4] / sym_state_probs_1122[1])  # (0,1) -> (0,2)
sym_state_recursive_ratios_1122[1,2] = sym.factor(sym_state_probs_1122[5] / sym_state_probs_1122[4])  # (0,2) -> (1,2)
sym_state_recursive_ratios_1122[2,2] = sym.factor(sym_state_probs_1122[6] / sym_state_probs_1122[5])  # (1,2) -> (2,2)

sym_state_recursive_ratios_right_1122 = sym_state_recursive_ratios_1122.copy()
sym_state_recursive_ratios_right_1122[1,2] = sym.factor(sym_state_probs_1122[5] / sym_state_probs_1122[2])  # (1,1) -> (1,2)
sym_state_recursive_ratios_right_1122[2,2] = sym.factor(sym_state_probs_1122[6] / sym_state_probs_1122[3])  # (2,1) -> (2,2)

sym_state_recursive_ratios_P0_1122 = sym.zeros(buffer_capacity + 1, system_capacity + 1)
sym_state_recursive_ratios_P0_1122[0,0] = 1
sym_state_recursive_ratios_P0_1122[0,1] = sym.factor(sym_state_probs_1122[1] / sym_state_probs_1122[0])  # (0,0) -> (0,1) 
sym_state_recursive_ratios_P0_1122[1,1] = sym.factor(sym_state_probs_1122[2] / sym_state_probs_1122[0])  # (0,0) -> (1,1)
sym_state_recursive_ratios_P0_1122[2,1] = sym.factor(sym_state_probs_1122[3] / sym_state_probs_1122[0])  # (0,0) -> (2,1)

sym_state_recursive_ratios_P0_1122[0,2] = sym.factor(sym_state_probs_1122[4] / sym_state_probs_1122[0])  # (0,0) -> (0,2)
sym_state_recursive_ratios_P0_1122[1,2] = sym.factor(sym_state_probs_1122[5] / sym_state_probs_1122[0])  # (0,0) -> (1,2)
sym_state_recursive_ratios_P0_1122[2,2] = sym.factor(sym_state_probs_1122[6] / sym_state_probs_1122[0])  # (0,0) -> (2,2)

```


```python
abg.markov.visualise_ambulance_markov_chain(
    num_of_servers=num_of_servers, 
    threshold=threshold, 
    system_capacity=system_capacity, 
    buffer_capacity=buffer_capacity
)
```


```python
all_states_1122
```




$\displaystyle \left[ \left( 0, \  0\right), \  \left( 0, \  1\right), \  \left( 1, \  1\right), \  \left( 2, \  1\right), \  \left( 0, \  2\right), \  \left( 1, \  2\right), \  \left( 2, \  2\right)\right]$




```python
Q_sym_1122
```




$\displaystyle \left[\begin{matrix}- \Lambda & \Lambda & 0 & 0 & 0 & 0 & 0\\\mu & - \lambda^{A} - \lambda^{o} - \mu & \lambda^{A} & 0 & \lambda^{o} & 0 & 0\\0 & \mu & - \lambda^{A} - \lambda^{o} - \mu & \lambda^{A} & 0 & \lambda^{o} & 0\\0 & 0 & \mu & - \lambda^{o} - \mu & 0 & 0 & \lambda^{o}\\0 & \mu & 0 & 0 & - \lambda^{A} - \mu & \lambda^{A} & 0\\0 & 0 & \mu & 0 & 0 & - \lambda^{A} - \mu & \lambda^{A}\\0 & 0 & 0 & \mu & 0 & 0 & - \mu\end{matrix}\right]$




```python
sym_state_recursive_ratios_1122, sym_state_recursive_ratios_right_1122
```




$\displaystyle \left( \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right)}{\mu \left(\lambda^{A} + \mu\right)} & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + 2 \mu\right)}{\mu \left(\lambda^{A} + \mu\right)}\\0 & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 3 \lambda^{o} \mu + \mu^{2}\right)}{\mu \left(\lambda^{A} + \mu\right) \left(\lambda^{A} + \lambda^{o} + \mu\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 3 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 4 \lambda^{o} \mu + 3 \mu^{2}\right)}{\mu^{2} \left(\lambda^{A} + \lambda^{o} + 2 \mu\right)}\end{matrix}\right], \  \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right)}{\mu \left(\lambda^{A} + \mu\right)} & \frac{\lambda^{o} \left(\lambda^{A} + \lambda^{o} + 2 \mu\right)}{\left(\lambda^{A} + \mu\right) \left(\lambda^{A} + \lambda^{o} + \mu\right)}\\0 & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 3 \lambda^{o} \mu + \mu^{2}\right)}{\mu \left(\lambda^{A} + \mu\right) \left(\lambda^{A} + \lambda^{o} + \mu\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 3 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 4 \lambda^{o} \mu + 3 \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 3 \lambda^{o} \mu + \mu^{2}\right)}\end{matrix}\right]\right)$




```python
sym_state_probs_1122[0], sym_state_recursive_ratios_P0_1122
```




$\displaystyle \left( \left(\lambda^{A}\right)^{2} \mu^{4} + 2 \lambda^{A} \mu^{5} + \mu^{6}, \  \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\Lambda \lambda^{o}}{\mu \left(\lambda^{A} + \mu\right)}\\0 & \frac{\Lambda \lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right)}{\mu^{2} \left(\lambda^{A} + \mu\right)} & \frac{\Lambda \lambda^{A} \lambda^{o} \left(\lambda^{A} + \lambda^{o} + 2 \mu\right)}{\mu^{2} \left(\lambda^{A} + \mu\right)^{2}}\\0 & \frac{\Lambda \left(\lambda^{A}\right)^{2} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 3 \lambda^{o} \mu + \mu^{2}\right)}{\mu^{3} \left(\lambda^{A} + \mu\right)^{2}} & \frac{\Lambda \left(\lambda^{A}\right)^{2} \lambda^{o} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 3 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 4 \lambda^{o} \mu + 3 \mu^{2}\right)}{\mu^{4} \left(\lambda^{A} + \mu\right)^{2}}\end{matrix}\right]\right)$




```python

```

## $C=1, T=3, N=4, M=1$


```python
num_of_servers = 1
threshold = 3
system_capacity = 4
buffer_capacity = 1

all_states_1341 = abg.markov.build_states(threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
Q_sym_1341 = abg.markov.get_symbolic_transition_matrix(num_of_servers, threshold, system_capacity, buffer_capacity)
sym_pi_1341 = get_symbolic_pi(num_of_servers=num_of_servers, threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
sym_state_probs_1341 = [0 for _ in range(len(all_states_1341))]
```


```python
sym_Lambda = sym.symbols("Lambda")
sym_lambda_1 = sym.symbols("lambda_1")
sym_lambda_2 = sym.symbols("lambda_2")
sym_mu = sym.symbols("mu")
```


```python
sym_state_probs_1341[0] = (sym_lambda_2) * (sym_mu ** 5) + (sym_mu ** 6)  # (0,0)
sym_state_probs_1341[1] = sym_Lambda * sym_lambda_2 * (sym_mu ** 4) + sym_Lambda * (sym_mu ** 5)  # (0,1)
sym_state_probs_1341[2] = (sym_Lambda ** 2) * sym_lambda_2 * (sym_mu ** 3) + (sym_Lambda ** 2) * (sym_mu ** 4)    # (0,2)
sym_state_probs_1341[3] = (sym_Lambda ** 3) * sym_lambda_2 * (sym_mu ** 2) + (sym_Lambda ** 3) * (sym_mu ** 3)    # (0,3)
sym_state_probs_1341[4] = (sym_Lambda ** 3) * sym_lambda_1 * sym_lambda_2 * sym_mu + (sym_Lambda ** 3) * sym_lambda_2 * (sym_mu ** 2) + (sym_Lambda ** 3) * sym_lambda_2 * sym_lambda_2 * sym_mu     # (1,3)
sym_state_probs_1341[5] = (sym_Lambda ** 3) * sym_lambda_1 * (sym_mu ** 2)    # (0,4)
sym_state_probs_1341[6] = (sym_Lambda ** 3) * (sym_lambda_1 ** 2) * sym_lambda_2 + (sym_Lambda ** 3) * sym_lambda_1 * (sym_lambda_2 ** 2) + 2 * (sym_Lambda ** 3) * sym_lambda_1 * sym_lambda_2 * sym_mu    # (1,4)
```


```python
sym_state_recursive_ratios_1341 = sym.zeros(buffer_capacity + 1, system_capacity + 1)
sym_state_recursive_ratios_1341[0,0] = 1
sym_state_recursive_ratios_1341[0,1] = sym.factor(sym_state_probs_1341[1] / sym_state_probs_1341[0])  # (0,0) -> (0,1) 
sym_state_recursive_ratios_1341[0,2] = sym.factor(sym_state_probs_1341[2] / sym_state_probs_1341[1])  # (0,1) -> (0,2)
sym_state_recursive_ratios_1341[0,3] = sym.factor(sym_state_probs_1341[3] / sym_state_probs_1341[2])  # (0,2) -> (0,3)
sym_state_recursive_ratios_1341[0,4] = sym.factor(sym_state_probs_1341[5] / sym_state_probs_1341[3])  # (0,3) -> (0,4)

sym_state_recursive_ratios_1341[1,3] = sym.factor(sym_state_probs_1341[4] / sym_state_probs_1341[3])  # (0,3) -> (1,3)
sym_state_recursive_ratios_1341[1,4] = sym.factor(sym_state_probs_1341[6] / sym_state_probs_1341[5])  # (0,4) -> (1,4)

sym_state_recursive_ratios_right_1341 = sym_state_recursive_ratios_1341.copy()
sym_state_recursive_ratios_right_1341[1,4] = sym.factor(sym_state_probs_1341[6] / sym_state_probs_1341[4])  # (1,3) -> (1,4)

sym_state_recursive_ratios_P0_1341 = sym.zeros(buffer_capacity + 1, system_capacity + 1)
sym_state_recursive_ratios_P0_1341[0,0] = 1
sym_state_recursive_ratios_P0_1341[0,1] = sym.factor(sym_state_probs_1341[1] / sym_state_probs_1341[0])  # (0,0) -> (0,1) 
sym_state_recursive_ratios_P0_1341[0,2] = sym.factor(sym_state_probs_1341[2] / sym_state_probs_1341[0])  # (0,0) -> (0,2)
sym_state_recursive_ratios_P0_1341[0,3] = sym.factor(sym_state_probs_1341[3] / sym_state_probs_1341[0])  # (0,0) -> (0,3)

sym_state_recursive_ratios_P0_1341[1,3] = sym.factor(sym_state_probs_1341[4] / sym_state_probs_1341[0])  # (0,0) -> (1,3)
sym_state_recursive_ratios_P0_1341[0,4] = sym.factor(sym_state_probs_1341[5] / sym_state_probs_1341[0])  # (0,0) -> (0,4)
sym_state_recursive_ratios_P0_1341[1,4] = sym.factor(sym_state_probs_1341[6] / sym_state_probs_1341[0])  # (0,0) -> (1,4)

```


```python
abg.markov.visualise_ambulance_markov_chain(
    num_of_servers=num_of_servers, 
    threshold=threshold, 
    system_capacity=system_capacity, 
    buffer_capacity=buffer_capacity
)
```


```python
all_states_1341
```




$\displaystyle \left[ \left( 0, \  0\right), \  \left( 0, \  1\right), \  \left( 0, \  2\right), \  \left( 0, \  3\right), \  \left( 1, \  3\right), \  \left( 0, \  4\right), \  \left( 1, \  4\right)\right]$




```python
Q_sym_1341
```




$\displaystyle \left[\begin{matrix}- \Lambda & \Lambda & 0 & 0 & 0 & 0 & 0\\\mu & - \Lambda - \mu & \Lambda & 0 & 0 & 0 & 0\\0 & \mu & - \Lambda - \mu & \Lambda & 0 & 0 & 0\\0 & 0 & \mu & - \lambda^{A} - \lambda^{o} - \mu & \lambda^{A} & \lambda^{o} & 0\\0 & 0 & 0 & \mu & - \lambda^{o} - \mu & 0 & \lambda^{o}\\0 & 0 & 0 & \mu & 0 & - \lambda^{A} - \mu & \lambda^{A}\\0 & 0 & 0 & 0 & \mu & 0 & - \mu\end{matrix}\right]$




```python
sym_state_recursive_ratios_1341, sym_state_recursive_ratios_right_1341
```




$\displaystyle \left( \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\Lambda}{\mu} & \frac{\Lambda}{\mu} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & 0 & 0 & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right)}{\mu \left(\lambda^{A} + \mu\right)} & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + 2 \mu\right)}{\mu^{2}}\end{matrix}\right], \  \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\Lambda}{\mu} & \frac{\Lambda}{\mu} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & 0 & 0 & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right)}{\mu \left(\lambda^{A} + \mu\right)} & \frac{\lambda^{o} \left(\lambda^{A} + \lambda^{o} + 2 \mu\right)}{\mu \left(\lambda^{A} + \lambda^{o} + \mu\right)}\end{matrix}\right]\right)$




```python
sym_state_recursive_ratios_P0_1341
```




$\displaystyle \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\Lambda^{2}}{\mu^{2}} & \frac{\Lambda^{3}}{\mu^{3}} & \frac{\Lambda^{3} \lambda^{o}}{\mu^{3} \left(\lambda^{A} + \mu\right)}\\0 & 0 & 0 & \frac{\Lambda^{3} \lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right)}{\mu^{4} \left(\lambda^{A} + \mu\right)} & \frac{\Lambda^{3} \lambda^{A} \lambda^{o} \left(\lambda^{A} + \lambda^{o} + 2 \mu\right)}{\mu^{5} \left(\lambda^{A} + \mu\right)}\end{matrix}\right]$




```python

```


```python

```

# $C=1, T=1, N=3, M=1$


```python
num_of_servers = 1
threshold = 1
system_capacity = 3
buffer_capacity = 1

all_states_1131 = abg.markov.build_states(threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
Q_sym_1131 = abg.markov.get_symbolic_transition_matrix(num_of_servers, threshold, system_capacity, buffer_capacity)
sym_pi_1131 = get_symbolic_pi(num_of_servers=num_of_servers, threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
sym_state_probs_1131 = [0 for _ in range(len(all_states_1131))]
```


```python
sym_Lambda = sym.symbols("Lambda")
sym_lambda_1 = sym.symbols("lambda_1")
sym_lambda_2 = sym.symbols("lambda_2")
sym_mu = sym.symbols("mu")
```


```python
# (0,0)
sym_state_probs_1131[0] = (sym_mu ** 6) + 2 * (sym_lambda_2 * (sym_mu ** 5)) + ((sym_lambda_2 ** 2) * (sym_mu ** 4)) + (sym_lambda_1 * sym_lambda_2 * (sym_mu ** 4))
# (0,1)
sym_state_probs_1131[1] = sym_state_probs_1131[0] * sym_Lambda / sym_mu 
# (1,1)
sym_state_probs_1131[2] = (sym_Lambda * (sym_lambda_1 ** 2) * sym_lambda_2 * (sym_mu ** 2)) + (sym_Lambda * sym_lambda_2 * sym_lambda_1 * (sym_mu ** 3)) + 2 * (sym_Lambda * sym_lambda_1 * (sym_lambda_2 ** 2) * (sym_mu ** 2)) + 2 * (sym_Lambda * (sym_lambda_2 ** 2) * (sym_mu ** 3)) + (sym_Lambda * (sym_lambda_2 ** 3) * (sym_mu ** 2)) + (sym_Lambda * sym_lambda_2 * (sym_mu ** 4)) 
# (0,2)
sym_state_probs_1131[3] = sym_Lambda * sym_lambda_1 * sym_mu ** 3 * (sym_lambda_2 + sym_mu)
# (1,2)
sym_state_probs_1131[4] = (sym_Lambda * sym_lambda_2 * sym_lambda_1 * sym_mu) * ((sym_lambda_2 ** 2) + 2 * sym_lambda_2 * sym_lambda_1 + 3 * sym_lambda_2 * sym_mu + (sym_lambda_1 ** 2) + 2 * sym_lambda_1 * sym_mu + 2 * (sym_mu ** 2)) 
# (0,3)
sym_state_probs_1131[5] = sym_Lambda * (sym_lambda_1 ** 2) * (sym_mu ** 3) 
# (1,3)
sym_state_probs_1131[6] = (sym_Lambda * sym_lambda_2 * (sym_lambda_1 ** 2)) * ((sym_lambda_2 ** 2) + 2 * sym_lambda_2 * sym_lambda_1 + 3 * sym_lambda_2 * sym_mu + (sym_lambda_1 ** 2) + 2 * sym_lambda_1 * sym_mu + 3 * (sym_mu ** 2))

denominator = sym_Lambda*sym_lambda_2**3*sym_lambda_1**2 + sym_Lambda*sym_lambda_2**3*sym_lambda_1*sym_mu + sym_Lambda*sym_lambda_2**3*sym_mu**2 + 2*sym_Lambda*sym_lambda_2**2*sym_lambda_1**3 + 5*sym_Lambda*sym_lambda_2**2*sym_lambda_1**2*sym_mu + 5*sym_Lambda*sym_lambda_2**2*sym_lambda_1*sym_mu**2 + 3*sym_Lambda*sym_lambda_2**2*sym_mu**3 + sym_Lambda*sym_lambda_2*sym_lambda_1**4 + 3*sym_Lambda*sym_lambda_2*sym_lambda_1**3*sym_mu + 6*sym_Lambda*sym_lambda_2*sym_lambda_1**2*sym_mu**2 + 5*sym_Lambda*sym_lambda_2*sym_lambda_1*sym_mu**3 + 3*sym_Lambda*sym_lambda_2*sym_mu**4 + sym_Lambda*sym_lambda_1**2*sym_mu**3 + sym_Lambda*sym_lambda_1*sym_mu**4 + sym_Lambda*sym_mu**5 + sym_lambda_2**2*sym_mu**4 + sym_lambda_2*sym_lambda_1*sym_mu**4 + 2*sym_lambda_2*sym_mu**5 + sym_mu**6

sym_state_probs_1131 = [i/denominator for i in sym_state_probs_1131]


```


```python
sym_state_recursive_ratios_1131 = sym.zeros(buffer_capacity + 1, system_capacity + 1)
sym_state_recursive_ratios_1131[0,0] = 1
sym_state_recursive_ratios_1131[0,1] = sym.factor(sym_state_probs_1131[1] / sym_state_probs_1131[0])  # (0,0) -> (0,1) 
sym_state_recursive_ratios_1131[1,1] = sym.factor(sym_state_probs_1131[2] / sym_state_probs_1131[1])  # (0,1) -> (1,1)
sym_state_recursive_ratios_1131[0,2] = sym.factor(sym_state_probs_1131[3] / sym_state_probs_1131[1])  # (0,1) -> (0,2)
sym_state_recursive_ratios_1131[1,2] = sym.factor(sym_state_probs_1131[4] / sym_state_probs_1131[3])  # (0,2) -> (1,2)
sym_state_recursive_ratios_1131[0,3] = sym.factor(sym_state_probs_1131[5] / sym_state_probs_1131[3])  # (0,2) -> (0,3)
sym_state_recursive_ratios_1131[1,3] = sym.factor(sym_state_probs_1131[6] / sym_state_probs_1131[5])  # (0,3) -> (1,3)

sym_state_recursive_ratios_right_1131 = sym_state_recursive_ratios_1131.copy()
sym_state_recursive_ratios_right_1131[1,2] = sym.factor(sym_state_probs_1131[4] / sym_state_probs_1131[2])  # (1,1) -> (1,2)
sym_state_recursive_ratios_right_1131[1,3] = sym.factor(sym_state_probs_1131[6] / sym_state_probs_1131[4])  # (1,2) -> (1,3)

sym_state_recursive_ratios_P0_1131 = sym.zeros(buffer_capacity + 1, system_capacity + 1)
sym_state_recursive_ratios_P0_1131[0,0] = 1
sym_state_recursive_ratios_P0_1131[0,1] = sym.factor(sym_state_probs_1131[1] / sym_state_probs_1131[0])  # (0,0) -> (0,1) 
sym_state_recursive_ratios_P0_1131[1,1] = sym.factor(sym_state_probs_1131[2] / sym_state_probs_1131[0])  # (0,0) -> (1,1)
sym_state_recursive_ratios_P0_1131[0,2] = sym.factor(sym_state_probs_1131[3] / sym_state_probs_1131[0])  # (0,0) -> (0,2)
sym_state_recursive_ratios_P0_1131[1,2] = sym.factor(sym_state_probs_1131[4] / sym_state_probs_1131[0])  # (0,0) -> (1,2)
sym_state_recursive_ratios_P0_1131[0,3] = sym.factor(sym_state_probs_1131[5] / sym_state_probs_1131[0])  # (0,0) -> (0,3)
sym_state_recursive_ratios_P0_1131[1,3] = sym.factor(sym_state_probs_1131[6] / sym_state_probs_1131[0])  # (0,0) -> (1,3)

```


```python
abg.markov.visualise_ambulance_markov_chain(
    num_of_servers=num_of_servers, 
    threshold=threshold, 
    system_capacity=system_capacity, 
    buffer_capacity=buffer_capacity
)
```


```python
all_states_1131
```




$\displaystyle \left[ \left( 0, \  0\right), \  \left( 0, \  1\right), \  \left( 1, \  1\right), \  \left( 0, \  2\right), \  \left( 1, \  2\right), \  \left( 0, \  3\right), \  \left( 1, \  3\right)\right]$




```python
Q_sym_1131
```




$\displaystyle \left[\begin{matrix}- \Lambda & \Lambda & 0 & 0 & 0 & 0 & 0\\\mu & - \lambda^{A} - \lambda^{o} - \mu & \lambda^{A} & \lambda^{o} & 0 & 0 & 0\\0 & \mu & - \lambda^{o} - \mu & 0 & \lambda^{o} & 0 & 0\\0 & \mu & 0 & - \lambda^{A} - \lambda^{o} - \mu & \lambda^{A} & \lambda^{o} & 0\\0 & 0 & \mu & 0 & - \lambda^{o} - \mu & 0 & \lambda^{o}\\0 & 0 & 0 & \mu & 0 & - \lambda^{A} - \mu & \lambda^{A}\\0 & 0 & 0 & 0 & \mu & 0 & - \mu\end{matrix}\right]$




```python
sym_state_recursive_ratios_1131, sym_state_recursive_ratios_right_1131
```




$\displaystyle \left( \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o} \left(\lambda^{A} + \mu\right)}{\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \lambda^{o} \mu + \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 3 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 2 \lambda^{o} \mu + 2 \mu^{2}\right)}{\mu^{2} \left(\lambda^{A} + \mu\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 3 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 2 \lambda^{o} \mu + 3 \mu^{2}\right)}{\mu^{3}}\end{matrix}\right], \  \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o} \left(\lambda^{A} + \mu\right)}{\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \lambda^{o} \mu + \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 3 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 2 \lambda^{o} \mu + 2 \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \lambda^{o} \mu + \mu^{2}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 3 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 2 \lambda^{o} \mu + 3 \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 3 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 2 \lambda^{o} \mu + 2 \mu^{2}\right)}\end{matrix}\right]\right)$




```python
sym_state_recursive_ratios_P0_1131
```




$\displaystyle \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\Lambda \lambda^{o} \left(\lambda^{A} + \mu\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)} & \frac{\Lambda \left(\lambda^{o}\right)^{2}}{\mu \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)}\\0 & \frac{\Lambda \lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \lambda^{o} \mu + \mu^{2}\right)}{\mu^{2} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)} & \frac{\Lambda \lambda^{A} \lambda^{o} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 3 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 2 \lambda^{o} \mu + 2 \mu^{2}\right)}{\mu^{3} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)} & \frac{\Lambda \lambda^{A} \left(\lambda^{o}\right)^{2} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 3 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 2 \lambda^{o} \mu + 3 \mu^{2}\right)}{\mu^{4} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)}\end{matrix}\right]$




```python

```


```python

```

## $C=1, T=1, N=3, M=2$


```python
num_of_servers = 1
threshold = 1
system_capacity = 3
buffer_capacity = 2
```


```python
abg.markov.visualise_ambulance_markov_chain(num_of_servers=1, threshold=1, system_capacity=3, buffer_capacity=2)
```


```python
all_states_1132 = abg.markov.build_states(threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
Q_sym_1132 = abg.markov.get_symbolic_transition_matrix(num_of_servers, threshold, system_capacity, buffer_capacity)

p00, p01, p11, p21, p02, p12, p22, p03, p13, p23 = sym.symbols('p00, p01, p11, p21, p02, p12, p22, p03, p13, p23')
pi_1132 = sym.Matrix([p00, p01, p11, p21, p02, p12, p22, p03, p13, p23])
dimension_1132 = Q_sym_1132.shape[0]

M_sym_1132 = sym.Matrix([Q_sym_1132.transpose()[:-1,:], sym.ones(1,dimension_1132)])
sym_diff_equations_1132 = (M_sym_1132 @ pi_1132)

b_sym_1132 = sym.Matrix([sym.zeros(dimension_1132 - 1, 1), [1]])
```


```python
eq0_1132 = sym.Eq(sym_diff_equations_1132[0],b_sym_1132[0])
eq1_1132 = sym.Eq(sym_diff_equations_1132[1],b_sym_1132[1])
eq2_1132 = sym.Eq(sym_diff_equations_1132[2],b_sym_1132[2])
eq3_1132 = sym.Eq(sym_diff_equations_1132[3],b_sym_1132[3])
eq4_1132 = sym.Eq(sym_diff_equations_1132[4],b_sym_1132[4])
eq5_1132 = sym.Eq(sym_diff_equations_1132[5],b_sym_1132[5])
eq6_1132 = sym.Eq(sym_diff_equations_1132[6],b_sym_1132[6])
eq7_1132 = sym.Eq(sym_diff_equations_1132[7],b_sym_1132[7])
eq8_1132 = sym.Eq(sym_diff_equations_1132[8],b_sym_1132[8])
eq9_1132 = sym.Eq(sym_diff_equations_1132[9],b_sym_1132[9])
```


```python
sym_state_probs_1132 = sym.solve([eq0_1132,eq1_1132,eq2_1132,eq3_1132,eq4_1132,eq5_1132,eq6_1132,eq7_1132,eq8_1132,eq9_1132],(p00,p01,p11,p21,p02,p12,p22,p03,p13,p23))
```


```python
sym_state_recursive_ratios_1132 = sym.zeros(buffer_capacity + 1, system_capacity + 1)
sym_state_recursive_ratios_1132[0,0] = 1
sym_state_recursive_ratios_1132[0,1] = sym.factor(sym_state_probs_1132[p01] / sym_state_probs_1132[p00])  # (0,0) -> (0,1) 
sym_state_recursive_ratios_1132[1,1] = sym.factor(sym_state_probs_1132[p11] / sym_state_probs_1132[p01])  # (0,1) -> (1,1)
sym_state_recursive_ratios_1132[2,1] = sym.factor(sym_state_probs_1132[p21] / sym_state_probs_1132[p11])  # (1,1) -> (2,1)
sym_state_recursive_ratios_1132[0,2] = sym.factor(sym_state_probs_1132[p02] / sym_state_probs_1132[p01])  # (0,1) -> (0,2)
sym_state_recursive_ratios_1132[1,2] = sym.factor(sym_state_probs_1132[p12] / sym_state_probs_1132[p02])  # (0,2) -> (1,2)
sym_state_recursive_ratios_1132[2,2] = sym.factor(sym_state_probs_1132[p22] / sym_state_probs_1132[p12])  # (1,2) -> (2,2)
sym_state_recursive_ratios_1132[0,3] = sym.factor(sym_state_probs_1132[p03] / sym_state_probs_1132[p02])  # (0,2) -> (0,3)
sym_state_recursive_ratios_1132[1,3] = sym.factor(sym_state_probs_1132[p13] / sym_state_probs_1132[p03])  # (0,3) -> (1,3)
sym_state_recursive_ratios_1132[2,3] = sym.factor(sym_state_probs_1132[p23] / sym_state_probs_1132[p13])  # (1,3) -> (2,3)

sym_state_recursive_ratios_right_1132 = sym_state_recursive_ratios_1132.copy()
sym_state_recursive_ratios_right_1132[1,2] = sym.factor(sym_state_probs_1132[p12] / sym_state_probs_1132[p11])  # (1,1) -> (1,2)
sym_state_recursive_ratios_right_1132[1,3] = sym.factor(sym_state_probs_1132[p13] / sym_state_probs_1132[p12])  # (1,2) -> (1,3)
sym_state_recursive_ratios_right_1132[2,2] = sym.factor(sym_state_probs_1132[p22] / sym_state_probs_1132[p21])  # (2,1) -> (2,2)
sym_state_recursive_ratios_right_1132[2,3] = sym.factor(sym_state_probs_1132[p23] / sym_state_probs_1132[p22])  # (2,2) -> (2,3)

sym_state_recursive_ratios_P0_1132 = sym.zeros(buffer_capacity + 1, system_capacity + 1)
sym_state_recursive_ratios_P0_1132[0,0] = 1
sym_state_recursive_ratios_P0_1132[0,1] = sym.factor(sym_state_probs_1132[p01] / sym_state_probs_1132[p00])  # (0,0) -> (0,1) 
sym_state_recursive_ratios_P0_1132[1,1] = sym.factor(sym_state_probs_1132[p11] / sym_state_probs_1132[p00])  # (0,0) -> (1,1)
sym_state_recursive_ratios_P0_1132[2,1] = sym.factor(sym_state_probs_1132[p21] / sym_state_probs_1132[p00])  # (0,0) -> (2,1)
sym_state_recursive_ratios_P0_1132[0,2] = sym.factor(sym_state_probs_1132[p02] / sym_state_probs_1132[p00])  # (0,0) -> (0,2)
sym_state_recursive_ratios_P0_1132[1,2] = sym.factor(sym_state_probs_1132[p12] / sym_state_probs_1132[p00])  # (0,0) -> (1,2)
sym_state_recursive_ratios_P0_1132[2,2] = sym.factor(sym_state_probs_1132[p22] / sym_state_probs_1132[p00])  # (0,0) -> (2,2)
sym_state_recursive_ratios_P0_1132[0,3] = sym.factor(sym_state_probs_1132[p03] / sym_state_probs_1132[p00])  # (0,0) -> (0,3)
sym_state_recursive_ratios_P0_1132[1,3] = sym.factor(sym_state_probs_1132[p13] / sym_state_probs_1132[p00])  # (0,0) -> (1,3)
sym_state_recursive_ratios_P0_1132[2,3] = sym.factor(sym_state_probs_1132[p23] / sym_state_probs_1132[p00])  # (0,0) -> (2,3)
```


```python
sym_state_recursive_ratios_1132
```




$\displaystyle \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o} \left(\lambda^{A} + \mu\right)}{\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \lambda^{o} \mu + \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 3 \lambda^{A} \lambda^{o} \mu + 5 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{2} \mu + 2 \lambda^{o} \mu^{2} + 2 \mu^{3}\right)}{\mu \left(\lambda^{A} + \mu\right) \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 4 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 2 \lambda^{o} \mu + 3 \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)}\\0 & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{4} + 4 \left(\lambda^{A}\right)^{3} \lambda^{o} + 4 \left(\lambda^{A}\right)^{3} \mu + 6 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 11 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 6 \left(\lambda^{A}\right)^{2} \mu^{2} + 4 \lambda^{A} \left(\lambda^{o}\right)^{3} + 10 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 10 \lambda^{A} \lambda^{o} \mu^{2} + 4 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{4} + 3 \left(\lambda^{o}\right)^{3} \mu + 6 \left(\lambda^{o}\right)^{2} \mu^{2} + 3 \lambda^{o} \mu^{3} + \mu^{4}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \lambda^{o} \mu + \mu^{2}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{4} + 4 \left(\lambda^{A}\right)^{3} \lambda^{o} + 5 \left(\lambda^{A}\right)^{3} \mu + 6 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 14 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 10 \left(\lambda^{A}\right)^{2} \mu^{2} + 4 \lambda^{A} \left(\lambda^{o}\right)^{3} + 13 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 17 \lambda^{A} \lambda^{o} \mu^{2} + 9 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{4} + 4 \left(\lambda^{o}\right)^{3} \mu + 9 \left(\lambda^{o}\right)^{2} \mu^{2} + 8 \lambda^{o} \mu^{3} + 3 \mu^{4}\right)}{\mu^{2} \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 3 \lambda^{A} \lambda^{o} \mu + 5 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{2} \mu + 2 \lambda^{o} \mu^{2} + 2 \mu^{3}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{4} + 4 \left(\lambda^{A}\right)^{3} \lambda^{o} + 5 \left(\lambda^{A}\right)^{3} \mu + 6 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 14 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 11 \left(\lambda^{A}\right)^{2} \mu^{2} + 4 \lambda^{A} \left(\lambda^{o}\right)^{3} + 13 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 19 \lambda^{A} \lambda^{o} \mu^{2} + 13 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{4} + 4 \left(\lambda^{o}\right)^{3} \mu + 10 \left(\lambda^{o}\right)^{2} \mu^{2} + 10 \lambda^{o} \mu^{3} + 6 \mu^{4}\right)}{\mu^{3} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 4 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 2 \lambda^{o} \mu + 3 \mu^{2}\right)}\end{matrix}\right]$




```python
sym_state_recursive_ratios_right_1132
```




$\displaystyle \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o} \left(\lambda^{A} + \mu\right)}{\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \lambda^{o} \mu + \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 3 \lambda^{A} \lambda^{o} \mu + 5 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{2} \mu + 2 \lambda^{o} \mu^{2} + 2 \mu^{3}\right)}{\left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \lambda^{o} \mu + \mu^{2}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 4 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 2 \lambda^{o} \mu + 3 \mu^{2}\right)}{\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 3 \lambda^{A} \lambda^{o} \mu + 5 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{2} \mu + 2 \lambda^{o} \mu^{2} + 2 \mu^{3}}\\0 & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{4} + 4 \left(\lambda^{A}\right)^{3} \lambda^{o} + 4 \left(\lambda^{A}\right)^{3} \mu + 6 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 11 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 6 \left(\lambda^{A}\right)^{2} \mu^{2} + 4 \lambda^{A} \left(\lambda^{o}\right)^{3} + 10 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 10 \lambda^{A} \lambda^{o} \mu^{2} + 4 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{4} + 3 \left(\lambda^{o}\right)^{3} \mu + 6 \left(\lambda^{o}\right)^{2} \mu^{2} + 3 \lambda^{o} \mu^{3} + \mu^{4}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \lambda^{o} \mu + \mu^{2}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{4} + 4 \left(\lambda^{A}\right)^{3} \lambda^{o} + 5 \left(\lambda^{A}\right)^{3} \mu + 6 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 14 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 10 \left(\lambda^{A}\right)^{2} \mu^{2} + 4 \lambda^{A} \left(\lambda^{o}\right)^{3} + 13 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 17 \lambda^{A} \lambda^{o} \mu^{2} + 9 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{4} + 4 \left(\lambda^{o}\right)^{3} \mu + 9 \left(\lambda^{o}\right)^{2} \mu^{2} + 8 \lambda^{o} \mu^{3} + 3 \mu^{4}\right)}{\mu \left(\left(\lambda^{A}\right)^{4} + 4 \left(\lambda^{A}\right)^{3} \lambda^{o} + 4 \left(\lambda^{A}\right)^{3} \mu + 6 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 11 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 6 \left(\lambda^{A}\right)^{2} \mu^{2} + 4 \lambda^{A} \left(\lambda^{o}\right)^{3} + 10 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 10 \lambda^{A} \lambda^{o} \mu^{2} + 4 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{4} + 3 \left(\lambda^{o}\right)^{3} \mu + 6 \left(\lambda^{o}\right)^{2} \mu^{2} + 3 \lambda^{o} \mu^{3} + \mu^{4}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{4} + 4 \left(\lambda^{A}\right)^{3} \lambda^{o} + 5 \left(\lambda^{A}\right)^{3} \mu + 6 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 14 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 11 \left(\lambda^{A}\right)^{2} \mu^{2} + 4 \lambda^{A} \left(\lambda^{o}\right)^{3} + 13 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 19 \lambda^{A} \lambda^{o} \mu^{2} + 13 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{4} + 4 \left(\lambda^{o}\right)^{3} \mu + 10 \left(\lambda^{o}\right)^{2} \mu^{2} + 10 \lambda^{o} \mu^{3} + 6 \mu^{4}\right)}{\mu \left(\left(\lambda^{A}\right)^{4} + 4 \left(\lambda^{A}\right)^{3} \lambda^{o} + 5 \left(\lambda^{A}\right)^{3} \mu + 6 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 14 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 10 \left(\lambda^{A}\right)^{2} \mu^{2} + 4 \lambda^{A} \left(\lambda^{o}\right)^{3} + 13 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 17 \lambda^{A} \lambda^{o} \mu^{2} + 9 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{4} + 4 \left(\lambda^{o}\right)^{3} \mu + 9 \left(\lambda^{o}\right)^{2} \mu^{2} + 8 \lambda^{o} \mu^{3} + 3 \mu^{4}\right)}\end{matrix}\right]$




```python
sym_state_recursive_ratios_P0_1132
```




$\displaystyle \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\Lambda \lambda^{o} \left(\lambda^{A} + \mu\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)} & \frac{\Lambda \left(\lambda^{o}\right)^{2}}{\mu \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)}\\0 & \frac{\Lambda \lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \lambda^{o} \mu + \mu^{2}\right)}{\mu^{2} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)} & \frac{\Lambda \lambda^{A} \lambda^{o} \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 3 \lambda^{A} \lambda^{o} \mu + 5 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{2} \mu + 2 \lambda^{o} \mu^{2} + 2 \mu^{3}\right)}{\mu^{2} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)^{2}} & \frac{\Lambda \lambda^{A} \left(\lambda^{o}\right)^{2} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 4 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 2 \lambda^{o} \mu + 3 \mu^{2}\right)}{\mu^{2} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)^{2}}\\0 & \frac{\Lambda \left(\lambda^{A}\right)^{2} \left(\left(\lambda^{A}\right)^{4} + 4 \left(\lambda^{A}\right)^{3} \lambda^{o} + 4 \left(\lambda^{A}\right)^{3} \mu + 6 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 11 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 6 \left(\lambda^{A}\right)^{2} \mu^{2} + 4 \lambda^{A} \left(\lambda^{o}\right)^{3} + 10 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 10 \lambda^{A} \lambda^{o} \mu^{2} + 4 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{4} + 3 \left(\lambda^{o}\right)^{3} \mu + 6 \left(\lambda^{o}\right)^{2} \mu^{2} + 3 \lambda^{o} \mu^{3} + \mu^{4}\right)}{\mu^{3} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)^{2}} & \frac{\Lambda \left(\lambda^{A}\right)^{2} \lambda^{o} \left(\left(\lambda^{A}\right)^{4} + 4 \left(\lambda^{A}\right)^{3} \lambda^{o} + 5 \left(\lambda^{A}\right)^{3} \mu + 6 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 14 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 10 \left(\lambda^{A}\right)^{2} \mu^{2} + 4 \lambda^{A} \left(\lambda^{o}\right)^{3} + 13 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 17 \lambda^{A} \lambda^{o} \mu^{2} + 9 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{4} + 4 \left(\lambda^{o}\right)^{3} \mu + 9 \left(\lambda^{o}\right)^{2} \mu^{2} + 8 \lambda^{o} \mu^{3} + 3 \mu^{4}\right)}{\mu^{4} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)^{2}} & \frac{\Lambda \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \left(\left(\lambda^{A}\right)^{4} + 4 \left(\lambda^{A}\right)^{3} \lambda^{o} + 5 \left(\lambda^{A}\right)^{3} \mu + 6 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 14 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 11 \left(\lambda^{A}\right)^{2} \mu^{2} + 4 \lambda^{A} \left(\lambda^{o}\right)^{3} + 13 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 19 \lambda^{A} \lambda^{o} \mu^{2} + 13 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{4} + 4 \left(\lambda^{o}\right)^{3} \mu + 10 \left(\lambda^{o}\right)^{2} \mu^{2} + 10 \lambda^{o} \mu^{3} + 6 \mu^{4}\right)}{\mu^{5} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)^{2}}\end{matrix}\right]$




```python

```


```python

```

## $C=1, T=1, N=4, M=1$


```python
num_of_servers = 1
threshold = 1
system_capacity = 4
buffer_capacity = 1
```


```python
abg.markov.visualise_ambulance_markov_chain(num_of_servers=1, threshold=1, system_capacity=4, buffer_capacity=1)
```


```python
all_states_1141 = abg.markov.build_states(threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
Q_sym_1141 = abg.markov.get_symbolic_transition_matrix(num_of_servers, threshold, system_capacity, buffer_capacity)

p00, p01, p11, p02, p12, p03, p13, p04, p14 = sym.symbols('p00, p01, p11, p02, p12, p03, p13, p04, p14')
pi_1141 = sym.Matrix([p00, p01, p11, p02, p12, p03, p13, p04, p14])
dimension_1141 = Q_sym_1141.shape[0]

M_sym_1141 = sym.Matrix([Q_sym_1141.transpose()[:-1,:], sym.ones(1,dimension_1141)])
sym_diff_equations_1141 = (M_sym_1141 @ pi_1141)

b_sym_1141 = sym.Matrix([sym.zeros(dimension_1141 - 1, 1), [1]])
```


```python
eq0_1141 = sym.Eq(sym_diff_equations_1141[0],b_sym_1141[0])
eq1_1141 = sym.Eq(sym_diff_equations_1141[1],b_sym_1141[1])
eq2_1141 = sym.Eq(sym_diff_equations_1141[2],b_sym_1141[2])
eq3_1141 = sym.Eq(sym_diff_equations_1141[3],b_sym_1141[3])
eq4_1141 = sym.Eq(sym_diff_equations_1141[4],b_sym_1141[4])
eq5_1141 = sym.Eq(sym_diff_equations_1141[5],b_sym_1141[5])
eq6_1141 = sym.Eq(sym_diff_equations_1141[6],b_sym_1141[6])
eq7_1141 = sym.Eq(sym_diff_equations_1141[7],b_sym_1141[7])
eq8_1141 = sym.Eq(sym_diff_equations_1141[8],b_sym_1141[8])
```


```python
sym_state_probs_1141 = sym.solve([eq0_1141,eq1_1141,eq2_1141,eq3_1141,eq4_1141,eq5_1141,eq6_1141,eq7_1141,eq8_1141],(p00, p01, p11, p02, p12, p03, p13, p04, p14))
```


```python
sym_state_recursive_ratios_1141 = sym.zeros(buffer_capacity + 1, system_capacity + 1)
sym_state_recursive_ratios_1141[0,0] = 1
sym_state_recursive_ratios_1141[0,1] = sym.factor(sym_state_probs_1141[p01] / sym_state_probs_1141[p00])  # (0,0) -> (0,1) 
sym_state_recursive_ratios_1141[1,1] = sym.factor(sym_state_probs_1141[p11] / sym_state_probs_1141[p01])  # (0,1) -> (1,1)
sym_state_recursive_ratios_1141[0,2] = sym.factor(sym_state_probs_1141[p02] / sym_state_probs_1141[p01])  # (0,1) -> (0,2)
sym_state_recursive_ratios_1141[1,2] = sym.factor(sym_state_probs_1141[p12] / sym_state_probs_1141[p02])  # (0,2) -> (1,2)
sym_state_recursive_ratios_1141[0,3] = sym.factor(sym_state_probs_1141[p03] / sym_state_probs_1141[p02])  # (0,2) -> (0,3)
sym_state_recursive_ratios_1141[1,3] = sym.factor(sym_state_probs_1141[p13] / sym_state_probs_1141[p03])  # (0,3) -> (1,3)
sym_state_recursive_ratios_1141[0,4] = sym.factor(sym_state_probs_1141[p04] / sym_state_probs_1141[p03])  # (0,3) -> (0,4)
sym_state_recursive_ratios_1141[1,4] = sym.factor(sym_state_probs_1141[p14] / sym_state_probs_1141[p04])  # (0,4) -> (1,4)

sym_state_recursive_ratios_right_1141 = sym_state_recursive_ratios_1141.copy()
sym_state_recursive_ratios_right_1141[1,2] = sym.factor(sym_state_probs_1141[p12] / sym_state_probs_1141[p11])  # (1,1) -> (1,2)
sym_state_recursive_ratios_right_1141[1,3] = sym.factor(sym_state_probs_1141[p13] / sym_state_probs_1141[p12])  # (1,2) -> (1,3)
sym_state_recursive_ratios_right_1141[1,4] = sym.factor(sym_state_probs_1141[p14] / sym_state_probs_1141[p13])  # (1,3) -> (1,4)

sym_state_recursive_ratios_P0_1141 = sym.zeros(buffer_capacity + 1, system_capacity + 1)
sym_state_recursive_ratios_P0_1141[0,0] = 1
sym_state_recursive_ratios_P0_1141[0,1] = sym.factor(sym_state_probs_1141[p01] / sym_state_probs_1141[p00])  # (0,0) -> (0,1) 
sym_state_recursive_ratios_P0_1141[1,1] = sym.factor(sym_state_probs_1141[p11] / sym_state_probs_1141[p00])  # (0,0) -> (1,1)
sym_state_recursive_ratios_P0_1141[0,2] = sym.factor(sym_state_probs_1141[p02] / sym_state_probs_1141[p00])  # (0,0) -> (0,2)
sym_state_recursive_ratios_P0_1141[1,2] = sym.factor(sym_state_probs_1141[p12] / sym_state_probs_1141[p00])  # (0,0) -> (1,2)
sym_state_recursive_ratios_P0_1141[0,3] = sym.factor(sym_state_probs_1141[p03] / sym_state_probs_1141[p00])  # (0,0) -> (0,3)
sym_state_recursive_ratios_P0_1141[1,3] = sym.factor(sym_state_probs_1141[p13] / sym_state_probs_1141[p00])  # (0,0) -> (1,3)
sym_state_recursive_ratios_P0_1141[0,4] = sym.factor(sym_state_probs_1141[p04] / sym_state_probs_1141[p00])  # (0,0) -> (0,4)
sym_state_recursive_ratios_P0_1141[1,4] = sym.factor(sym_state_probs_1141[p14] / sym_state_probs_1141[p00])  # (0,0) -> (1,4)

```


```python
sym_state_recursive_ratios_1141
```




$\displaystyle \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)}{\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}} & \frac{\lambda^{o} \left(\lambda^{A} + \mu\right)}{\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 6 \lambda^{A} \lambda^{o} \mu + 5 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 2 \lambda^{o} \mu^{2} + 2 \mu^{3}\right)}{\mu^{2} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 6 \lambda^{A} \lambda^{o} \mu + 6 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 3 \lambda^{o} \mu^{2} + 3 \mu^{3}\right)}{\mu^{3} \left(\lambda^{A} + \mu\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 6 \lambda^{A} \lambda^{o} \mu + 6 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 3 \lambda^{o} \mu^{2} + 4 \mu^{3}\right)}{\mu^{4}}\end{matrix}\right]$




```python
sym_state_recursive_ratios_right_1141
```




$\displaystyle \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)}{\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}} & \frac{\lambda^{o} \left(\lambda^{A} + \mu\right)}{\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 6 \lambda^{A} \lambda^{o} \mu + 5 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 2 \lambda^{o} \mu^{2} + 2 \mu^{3}\right)}{\mu \left(\lambda^{A} + \lambda^{o} + \mu\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \mu^{2}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 6 \lambda^{A} \lambda^{o} \mu + 6 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 3 \lambda^{o} \mu^{2} + 3 \mu^{3}\right)}{\mu \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 6 \lambda^{A} \lambda^{o} \mu + 5 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 2 \lambda^{o} \mu^{2} + 2 \mu^{3}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 6 \lambda^{A} \lambda^{o} \mu + 6 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 3 \lambda^{o} \mu^{2} + 4 \mu^{3}\right)}{\mu \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 6 \lambda^{A} \lambda^{o} \mu + 6 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 3 \lambda^{o} \mu^{2} + 3 \mu^{3}\right)}\end{matrix}\right]$




```python
sym_state_recursive_ratios_P0_1141
```




$\displaystyle \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\Lambda \lambda^{o} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\Lambda \left(\lambda^{o}\right)^{2} \left(\lambda^{A} + \mu\right)}{\mu \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\Lambda \left(\lambda^{o}\right)^{3}}{\mu \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)}\\0 & \frac{\Lambda \lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \mu^{2}\right)}{\mu^{2} \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\Lambda \lambda^{A} \lambda^{o} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 6 \lambda^{A} \lambda^{o} \mu + 5 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 2 \lambda^{o} \mu^{2} + 2 \mu^{3}\right)}{\mu^{3} \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\Lambda \lambda^{A} \left(\lambda^{o}\right)^{2} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 6 \lambda^{A} \lambda^{o} \mu + 6 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 3 \lambda^{o} \mu^{2} + 3 \mu^{3}\right)}{\mu^{4} \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\Lambda \lambda^{A} \left(\lambda^{o}\right)^{3} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 6 \lambda^{A} \lambda^{o} \mu + 6 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 3 \lambda^{o} \mu^{2} + 4 \mu^{3}\right)}{\mu^{5} \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)}\end{matrix}\right]$




```python

```

## $C=1, T=1, N=4, M=2$


```python
num_of_servers = 1
threshold = 1
system_capacity = 4
buffer_capacity = 2
```


```python
abg.markov.visualise_ambulance_markov_chain(num_of_servers=num_of_servers, threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
```


```python
all_states_1142 = abg.markov.build_states(threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)
Q_sym_1142 = abg.markov.get_symbolic_transition_matrix(num_of_servers=num_of_servers, threshold=threshold, system_capacity=system_capacity, buffer_capacity=buffer_capacity)

p00, p01, p11, p21, p02, p12, p22, p03, p13, p23, p04, p14, p24 = sym.symbols('p00, p01, p11, p21, p02, p12, p22, p03, p13, p23, p04, p14, p24')
pi_1142 = sym.Matrix([p00, p01, p11, p21, p02, p12, p22, p03, p13, p23, p04, p14, p24])
dimension_1142 = Q_sym_1142.shape[0]

M_sym_1142 = sym.Matrix([Q_sym_1142.transpose()[:-1,:], sym.ones(1,dimension_1142)])
sym_diff_equations_1142 = (M_sym_1142 @ pi_1142)

b_sym_1142 = sym.Matrix([sym.zeros(dimension_1142 - 1, 1), [1]])
```


```python
eq0_1142 = sym.Eq(sym_diff_equations_1142[0],b_sym_1142[0])
eq1_1142 = sym.Eq(sym_diff_equations_1142[1],b_sym_1142[1])
eq2_1142 = sym.Eq(sym_diff_equations_1142[2],b_sym_1142[2])
eq3_1142 = sym.Eq(sym_diff_equations_1142[3],b_sym_1142[3])
eq4_1142 = sym.Eq(sym_diff_equations_1142[4],b_sym_1142[4])
eq5_1142 = sym.Eq(sym_diff_equations_1142[5],b_sym_1142[5])
eq6_1142 = sym.Eq(sym_diff_equations_1142[6],b_sym_1142[6])
eq7_1142 = sym.Eq(sym_diff_equations_1142[7],b_sym_1142[7])
eq8_1142 = sym.Eq(sym_diff_equations_1142[8],b_sym_1142[8])
eq9_1142 = sym.Eq(sym_diff_equations_1142[9],b_sym_1142[9])
eq10_1142 = sym.Eq(sym_diff_equations_1142[10],b_sym_1142[10])
eq11_1142 = sym.Eq(sym_diff_equations_1142[11],b_sym_1142[11])
eq12_1142 = sym.Eq(sym_diff_equations_1142[12],b_sym_1142[12])
```


```python
sym_state_probs_1142 = sym.solve([eq0_1142,eq1_1142,eq2_1142,eq3_1142,eq4_1142,eq5_1142,eq6_1142,eq7_1142,eq8_1142,eq9_1142,eq10_1142,eq11_1142,eq12_1142],(p00, p01, p11, p21, p02, p12, p22, p03, p13, p23, p04, p14, p24))
```


```python
sym_state_recursive_ratios_1142 = sym.zeros(buffer_capacity + 1, system_capacity + 1)
sym_state_recursive_ratios_1142[0,0] = 1
sym_state_recursive_ratios_1142[0,1] = sym.factor(sym_state_probs_1142[p01] / sym_state_probs_1142[p00])  # (0,0) -> (0,1) 
sym_state_recursive_ratios_1142[1,1] = sym.factor(sym_state_probs_1142[p11] / sym_state_probs_1142[p01])  # (0,1) -> (1,1)
sym_state_recursive_ratios_1142[2,1] = sym.factor(sym_state_probs_1142[p21] / sym_state_probs_1142[p11])  # (1,1) -> (2,1)
sym_state_recursive_ratios_1142[0,2] = sym.factor(sym_state_probs_1142[p02] / sym_state_probs_1142[p01])  # (0,1) -> (0,2)
sym_state_recursive_ratios_1142[1,2] = sym.factor(sym_state_probs_1142[p12] / sym_state_probs_1142[p02])  # (0,2) -> (1,2)
sym_state_recursive_ratios_1142[2,2] = sym.factor(sym_state_probs_1142[p22] / sym_state_probs_1142[p12])  # (1,2) -> (2,2)
sym_state_recursive_ratios_1142[0,3] = sym.factor(sym_state_probs_1142[p03] / sym_state_probs_1142[p02])  # (0,2) -> (0,3)
sym_state_recursive_ratios_1142[1,3] = sym.factor(sym_state_probs_1142[p13] / sym_state_probs_1142[p03])  # (0,3) -> (1,3)
sym_state_recursive_ratios_1142[2,3] = sym.factor(sym_state_probs_1142[p23] / sym_state_probs_1142[p13])  # (1,3) -> (2,3)
sym_state_recursive_ratios_1142[0,4] = sym.factor(sym_state_probs_1142[p04] / sym_state_probs_1142[p03])  # (0,3) -> (0,4)
sym_state_recursive_ratios_1142[1,4] = sym.factor(sym_state_probs_1142[p14] / sym_state_probs_1142[p04])  # (0,4) -> (1,4)
sym_state_recursive_ratios_1142[2,4] = sym.factor(sym_state_probs_1142[p24] / sym_state_probs_1142[p14])  # (1,4) -> (2,4)

sym_state_recursive_ratios_right_1142 = sym_state_recursive_ratios_1142.copy()
sym_state_recursive_ratios_right_1142[1,2] = sym.factor(sym_state_probs_1142[p12] / sym_state_probs_1142[p11])  # (1,1) -> (1,2)
sym_state_recursive_ratios_right_1142[1,3] = sym.factor(sym_state_probs_1142[p13] / sym_state_probs_1142[p12])  # (1,2) -> (1,3)
sym_state_recursive_ratios_right_1142[1,4] = sym.factor(sym_state_probs_1142[p14] / sym_state_probs_1142[p13])  # (1,3) -> (1,4)
sym_state_recursive_ratios_right_1142[2,2] = sym.factor(sym_state_probs_1142[p22] / sym_state_probs_1142[p21])  # (2,1) -> (2,2)
sym_state_recursive_ratios_right_1142[2,3] = sym.factor(sym_state_probs_1142[p23] / sym_state_probs_1142[p22])  # (2,2) -> (2,3)
sym_state_recursive_ratios_right_1142[2,4] = sym.factor(sym_state_probs_1142[p24] / sym_state_probs_1142[p23])  # (2,3) -> (2,4)

sym_state_recursive_ratios_P0_1142 = sym.zeros(buffer_capacity + 1, system_capacity + 1)
sym_state_recursive_ratios_P0_1142[0,0] = 1
sym_state_recursive_ratios_P0_1142[0,1] = sym.factor(sym_state_probs_1142[p01] / sym_state_probs_1142[p00])  # (0,0) -> (0,1) 
sym_state_recursive_ratios_P0_1142[1,1] = sym.factor(sym_state_probs_1142[p11] / sym_state_probs_1142[p00])  # (0,0) -> (1,1)
sym_state_recursive_ratios_P0_1142[2,1] = sym.factor(sym_state_probs_1142[p21] / sym_state_probs_1142[p00])  # (0,0) -> (2,1)

sym_state_recursive_ratios_P0_1142[0,2] = sym.factor(sym_state_probs_1142[p02] / sym_state_probs_1142[p00])  # (0,0) -> (0,2)
sym_state_recursive_ratios_P0_1142[1,2] = sym.factor(sym_state_probs_1142[p12] / sym_state_probs_1142[p00])  # (0,0) -> (1,2)
sym_state_recursive_ratios_P0_1142[2,2] = sym.factor(sym_state_probs_1142[p22] / sym_state_probs_1142[p00])  # (0,0) -> (2,2)

sym_state_recursive_ratios_P0_1142[0,3] = sym.factor(sym_state_probs_1142[p03] / sym_state_probs_1142[p00])  # (0,0) -> (0,3)
sym_state_recursive_ratios_P0_1142[1,3] = sym.factor(sym_state_probs_1142[p13] / sym_state_probs_1142[p00])  # (0,0) -> (1,3)
sym_state_recursive_ratios_P0_1142[2,3] = sym.factor(sym_state_probs_1142[p23] / sym_state_probs_1142[p00])  # (0,0) -> (2,3)

sym_state_recursive_ratios_P0_1142[0,4] = sym.factor(sym_state_probs_1142[p04] / sym_state_probs_1142[p00])  # (0,0) -> (0,4)
sym_state_recursive_ratios_P0_1142[1,4] = sym.factor(sym_state_probs_1142[p14] / sym_state_probs_1142[p00])  # (0,0) -> (1,4)
sym_state_recursive_ratios_P0_1142[2,4] = sym.factor(sym_state_probs_1142[p24] / sym_state_probs_1142[p00])  # (0,0) -> (2,4)

```


```python
sym_state_recursive_ratios_1142
```




$\displaystyle \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)}{\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}} & \frac{\lambda^{o} \left(\lambda^{A} + \mu\right)}{\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{5} + 4 \left(\lambda^{A}\right)^{4} \lambda^{o} + 6 \left(\lambda^{A}\right)^{4} \mu + 6 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} + 15 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu + 14 \left(\lambda^{A}\right)^{3} \mu^{2} + 4 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} + 12 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu + 20 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{2} + 16 \left(\lambda^{A}\right)^{2} \mu^{3} + \lambda^{A} \left(\lambda^{o}\right)^{4} + 3 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu + 6 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{2} + 11 \lambda^{A} \lambda^{o} \mu^{3} + 9 \lambda^{A} \mu^{4} + \left(\lambda^{o}\right)^{3} \mu^{2} + 2 \left(\lambda^{o}\right)^{2} \mu^{3} + 2 \lambda^{o} \mu^{4} + 2 \mu^{5}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right) \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{4} + 3 \left(\lambda^{A}\right)^{3} \lambda^{o} + 6 \left(\lambda^{A}\right)^{3} \mu + 3 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 9 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 12 \left(\lambda^{A}\right)^{2} \mu^{2} + \lambda^{A} \left(\lambda^{o}\right)^{3} + 4 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 9 \lambda^{A} \lambda^{o} \mu^{2} + 10 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{3} \mu + 2 \left(\lambda^{o}\right)^{2} \mu^{2} + 3 \lambda^{o} \mu^{3} + 3 \mu^{4}\right)}{\mu \left(\lambda^{A} + \mu\right) \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 6 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 8 \lambda^{A} \lambda^{o} \mu + 9 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 3 \lambda^{o} \mu^{2} + 4 \mu^{3}\right)}{\mu \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)}\\0 & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 6 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 27 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 15 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 48 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 48 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 42 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 57 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 42 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 18 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 30 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 30 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 18 \lambda^{A} \lambda^{o} \mu^{4} + 6 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 3 \left(\lambda^{o}\right)^{5} \mu + 6 \left(\lambda^{o}\right)^{4} \mu^{2} + 10 \left(\lambda^{o}\right)^{3} \mu^{3} + 6 \left(\lambda^{o}\right)^{2} \mu^{4} + 3 \lambda^{o} \mu^{5} + \mu^{6}\right)}{\mu \left(\lambda^{A} + \lambda^{o} + \mu\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \mu^{2}\right) \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 7 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 32 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 21 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 58 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 69 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 34 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 52 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 84 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 74 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 31 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 23 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 45 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 54 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 39 \lambda^{A} \lambda^{o} \mu^{4} + 15 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 4 \left(\lambda^{o}\right)^{5} \mu + 9 \left(\lambda^{o}\right)^{4} \mu^{2} + 16 \left(\lambda^{o}\right)^{3} \mu^{3} + 15 \left(\lambda^{o}\right)^{2} \mu^{4} + 8 \lambda^{o} \mu^{5} + 3 \mu^{6}\right)}{\mu^{2} \left(\left(\lambda^{A}\right)^{5} + 4 \left(\lambda^{A}\right)^{4} \lambda^{o} + 6 \left(\lambda^{A}\right)^{4} \mu + 6 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} + 15 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu + 14 \left(\lambda^{A}\right)^{3} \mu^{2} + 4 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} + 12 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu + 20 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{2} + 16 \left(\lambda^{A}\right)^{2} \mu^{3} + \lambda^{A} \left(\lambda^{o}\right)^{4} + 3 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu + 6 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{2} + 11 \lambda^{A} \lambda^{o} \mu^{3} + 9 \lambda^{A} \mu^{4} + \left(\lambda^{o}\right)^{3} \mu^{2} + 2 \left(\lambda^{o}\right)^{2} \mu^{3} + 2 \lambda^{o} \mu^{4} + 2 \mu^{5}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 7 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 32 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 22 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 58 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 73 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 40 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 52 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 90 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 89 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 43 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 23 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 49 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 66 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 57 \lambda^{A} \lambda^{o} \mu^{4} + 25 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 4 \left(\lambda^{o}\right)^{5} \mu + 10 \left(\lambda^{o}\right)^{4} \mu^{2} + 19 \left(\lambda^{o}\right)^{3} \mu^{3} + 20 \left(\lambda^{o}\right)^{2} \mu^{4} + 15 \lambda^{o} \mu^{5} + 6 \mu^{6}\right)}{\mu^{3} \left(\left(\lambda^{A}\right)^{4} + 3 \left(\lambda^{A}\right)^{3} \lambda^{o} + 6 \left(\lambda^{A}\right)^{3} \mu + 3 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 9 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 12 \left(\lambda^{A}\right)^{2} \mu^{2} + \lambda^{A} \left(\lambda^{o}\right)^{3} + 4 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 9 \lambda^{A} \lambda^{o} \mu^{2} + 10 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{3} \mu + 2 \left(\lambda^{o}\right)^{2} \mu^{2} + 3 \lambda^{o} \mu^{3} + 3 \mu^{4}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 7 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 32 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 22 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 58 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 73 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 41 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 52 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 90 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 92 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 49 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 23 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 49 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 69 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 65 \lambda^{A} \lambda^{o} \mu^{4} + 34 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 4 \left(\lambda^{o}\right)^{5} \mu + 10 \left(\lambda^{o}\right)^{4} \mu^{2} + 20 \left(\lambda^{o}\right)^{3} \mu^{3} + 22 \left(\lambda^{o}\right)^{2} \mu^{4} + 18 \lambda^{o} \mu^{5} + 10 \mu^{6}\right)}{\mu^{4} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 6 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 8 \lambda^{A} \lambda^{o} \mu + 9 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 3 \lambda^{o} \mu^{2} + 4 \mu^{3}\right)}\end{matrix}\right]$




```python
sym_state_recursive_ratios_right_1142
```




$\displaystyle \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)}{\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}} & \frac{\lambda^{o} \left(\lambda^{A} + \mu\right)}{\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{5} + 4 \left(\lambda^{A}\right)^{4} \lambda^{o} + 6 \left(\lambda^{A}\right)^{4} \mu + 6 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} + 15 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu + 14 \left(\lambda^{A}\right)^{3} \mu^{2} + 4 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} + 12 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu + 20 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{2} + 16 \left(\lambda^{A}\right)^{2} \mu^{3} + \lambda^{A} \left(\lambda^{o}\right)^{4} + 3 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu + 6 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{2} + 11 \lambda^{A} \lambda^{o} \mu^{3} + 9 \lambda^{A} \mu^{4} + \left(\lambda^{o}\right)^{3} \mu^{2} + 2 \left(\lambda^{o}\right)^{2} \mu^{3} + 2 \lambda^{o} \mu^{4} + 2 \mu^{5}\right)}{\left(\lambda^{A} + \lambda^{o} + \mu\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \mu^{2}\right) \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{4} + 3 \left(\lambda^{A}\right)^{3} \lambda^{o} + 6 \left(\lambda^{A}\right)^{3} \mu + 3 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 9 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 12 \left(\lambda^{A}\right)^{2} \mu^{2} + \lambda^{A} \left(\lambda^{o}\right)^{3} + 4 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 9 \lambda^{A} \lambda^{o} \mu^{2} + 10 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{3} \mu + 2 \left(\lambda^{o}\right)^{2} \mu^{2} + 3 \lambda^{o} \mu^{3} + 3 \mu^{4}\right)}{\left(\lambda^{A}\right)^{5} + 4 \left(\lambda^{A}\right)^{4} \lambda^{o} + 6 \left(\lambda^{A}\right)^{4} \mu + 6 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} + 15 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu + 14 \left(\lambda^{A}\right)^{3} \mu^{2} + 4 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} + 12 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu + 20 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{2} + 16 \left(\lambda^{A}\right)^{2} \mu^{3} + \lambda^{A} \left(\lambda^{o}\right)^{4} + 3 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu + 6 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{2} + 11 \lambda^{A} \lambda^{o} \mu^{3} + 9 \lambda^{A} \mu^{4} + \left(\lambda^{o}\right)^{3} \mu^{2} + 2 \left(\lambda^{o}\right)^{2} \mu^{3} + 2 \lambda^{o} \mu^{4} + 2 \mu^{5}} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 6 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 8 \lambda^{A} \lambda^{o} \mu + 9 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 3 \lambda^{o} \mu^{2} + 4 \mu^{3}\right)}{\left(\lambda^{A}\right)^{4} + 3 \left(\lambda^{A}\right)^{3} \lambda^{o} + 6 \left(\lambda^{A}\right)^{3} \mu + 3 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 9 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 12 \left(\lambda^{A}\right)^{2} \mu^{2} + \lambda^{A} \left(\lambda^{o}\right)^{3} + 4 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 9 \lambda^{A} \lambda^{o} \mu^{2} + 10 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{3} \mu + 2 \left(\lambda^{o}\right)^{2} \mu^{2} + 3 \lambda^{o} \mu^{3} + 3 \mu^{4}}\\0 & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 6 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 27 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 15 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 48 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 48 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 42 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 57 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 42 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 18 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 30 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 30 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 18 \lambda^{A} \lambda^{o} \mu^{4} + 6 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 3 \left(\lambda^{o}\right)^{5} \mu + 6 \left(\lambda^{o}\right)^{4} \mu^{2} + 10 \left(\lambda^{o}\right)^{3} \mu^{3} + 6 \left(\lambda^{o}\right)^{2} \mu^{4} + 3 \lambda^{o} \mu^{5} + \mu^{6}\right)}{\mu \left(\lambda^{A} + \lambda^{o} + \mu\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \mu^{2}\right) \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 7 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 32 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 21 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 58 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 69 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 34 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 52 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 84 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 74 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 31 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 23 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 45 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 54 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 39 \lambda^{A} \lambda^{o} \mu^{4} + 15 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 4 \left(\lambda^{o}\right)^{5} \mu + 9 \left(\lambda^{o}\right)^{4} \mu^{2} + 16 \left(\lambda^{o}\right)^{3} \mu^{3} + 15 \left(\lambda^{o}\right)^{2} \mu^{4} + 8 \lambda^{o} \mu^{5} + 3 \mu^{6}\right)}{\mu \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 6 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 27 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 15 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 48 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 48 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 42 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 57 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 42 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 18 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 30 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 30 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 18 \lambda^{A} \lambda^{o} \mu^{4} + 6 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 3 \left(\lambda^{o}\right)^{5} \mu + 6 \left(\lambda^{o}\right)^{4} \mu^{2} + 10 \left(\lambda^{o}\right)^{3} \mu^{3} + 6 \left(\lambda^{o}\right)^{2} \mu^{4} + 3 \lambda^{o} \mu^{5} + \mu^{6}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 7 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 32 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 22 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 58 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 73 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 40 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 52 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 90 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 89 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 43 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 23 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 49 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 66 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 57 \lambda^{A} \lambda^{o} \mu^{4} + 25 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 4 \left(\lambda^{o}\right)^{5} \mu + 10 \left(\lambda^{o}\right)^{4} \mu^{2} + 19 \left(\lambda^{o}\right)^{3} \mu^{3} + 20 \left(\lambda^{o}\right)^{2} \mu^{4} + 15 \lambda^{o} \mu^{5} + 6 \mu^{6}\right)}{\mu \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 7 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 32 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 21 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 58 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 69 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 34 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 52 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 84 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 74 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 31 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 23 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 45 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 54 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 39 \lambda^{A} \lambda^{o} \mu^{4} + 15 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 4 \left(\lambda^{o}\right)^{5} \mu + 9 \left(\lambda^{o}\right)^{4} \mu^{2} + 16 \left(\lambda^{o}\right)^{3} \mu^{3} + 15 \left(\lambda^{o}\right)^{2} \mu^{4} + 8 \lambda^{o} \mu^{5} + 3 \mu^{6}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 7 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 32 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 22 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 58 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 73 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 41 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 52 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 90 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 92 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 49 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 23 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 49 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 69 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 65 \lambda^{A} \lambda^{o} \mu^{4} + 34 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 4 \left(\lambda^{o}\right)^{5} \mu + 10 \left(\lambda^{o}\right)^{4} \mu^{2} + 20 \left(\lambda^{o}\right)^{3} \mu^{3} + 22 \left(\lambda^{o}\right)^{2} \mu^{4} + 18 \lambda^{o} \mu^{5} + 10 \mu^{6}\right)}{\mu \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 7 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 32 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 22 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 58 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 73 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 40 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 52 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 90 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 89 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 43 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 23 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 49 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 66 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 57 \lambda^{A} \lambda^{o} \mu^{4} + 25 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 4 \left(\lambda^{o}\right)^{5} \mu + 10 \left(\lambda^{o}\right)^{4} \mu^{2} + 19 \left(\lambda^{o}\right)^{3} \mu^{3} + 20 \left(\lambda^{o}\right)^{2} \mu^{4} + 15 \lambda^{o} \mu^{5} + 6 \mu^{6}\right)}\end{matrix}\right]$




```python
sym_state_recursive_ratios_P0_1142
```




$\displaystyle \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\Lambda \lambda^{o} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\Lambda \left(\lambda^{o}\right)^{2} \left(\lambda^{A} + \mu\right)}{\mu \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\Lambda \left(\lambda^{o}\right)^{3}}{\mu \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)}\\0 & \frac{\Lambda \lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \mu^{2}\right)}{\mu^{2} \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\Lambda \lambda^{A} \lambda^{o} \left(\left(\lambda^{A}\right)^{5} + 4 \left(\lambda^{A}\right)^{4} \lambda^{o} + 6 \left(\lambda^{A}\right)^{4} \mu + 6 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} + 15 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu + 14 \left(\lambda^{A}\right)^{3} \mu^{2} + 4 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} + 12 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu + 20 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{2} + 16 \left(\lambda^{A}\right)^{2} \mu^{3} + \lambda^{A} \left(\lambda^{o}\right)^{4} + 3 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu + 6 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{2} + 11 \lambda^{A} \lambda^{o} \mu^{3} + 9 \lambda^{A} \mu^{4} + \left(\lambda^{o}\right)^{3} \mu^{2} + 2 \left(\lambda^{o}\right)^{2} \mu^{3} + 2 \lambda^{o} \mu^{4} + 2 \mu^{5}\right)}{\mu^{2} \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)^{2}} & \frac{\Lambda \lambda^{A} \left(\lambda^{o}\right)^{2} \left(\left(\lambda^{A}\right)^{4} + 3 \left(\lambda^{A}\right)^{3} \lambda^{o} + 6 \left(\lambda^{A}\right)^{3} \mu + 3 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 9 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 12 \left(\lambda^{A}\right)^{2} \mu^{2} + \lambda^{A} \left(\lambda^{o}\right)^{3} + 4 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 9 \lambda^{A} \lambda^{o} \mu^{2} + 10 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{3} \mu + 2 \left(\lambda^{o}\right)^{2} \mu^{2} + 3 \lambda^{o} \mu^{3} + 3 \mu^{4}\right)}{\mu^{2} \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)^{2}} & \frac{\Lambda \lambda^{A} \left(\lambda^{o}\right)^{3} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 6 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 8 \lambda^{A} \lambda^{o} \mu + 9 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 3 \lambda^{o} \mu^{2} + 4 \mu^{3}\right)}{\mu^{2} \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)^{2}}\\0 & \frac{\Lambda \left(\lambda^{A}\right)^{2} \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 6 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 27 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 15 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 48 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 48 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 42 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 57 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 42 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 18 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 30 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 30 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 18 \lambda^{A} \lambda^{o} \mu^{4} + 6 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 3 \left(\lambda^{o}\right)^{5} \mu + 6 \left(\lambda^{o}\right)^{4} \mu^{2} + 10 \left(\lambda^{o}\right)^{3} \mu^{3} + 6 \left(\lambda^{o}\right)^{2} \mu^{4} + 3 \lambda^{o} \mu^{5} + \mu^{6}\right)}{\mu^{3} \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)^{2}} & \frac{\Lambda \left(\lambda^{A}\right)^{2} \lambda^{o} \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 7 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 32 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 21 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 58 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 69 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 34 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 52 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 84 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 74 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 31 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 23 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 45 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 54 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 39 \lambda^{A} \lambda^{o} \mu^{4} + 15 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 4 \left(\lambda^{o}\right)^{5} \mu + 9 \left(\lambda^{o}\right)^{4} \mu^{2} + 16 \left(\lambda^{o}\right)^{3} \mu^{3} + 15 \left(\lambda^{o}\right)^{2} \mu^{4} + 8 \lambda^{o} \mu^{5} + 3 \mu^{6}\right)}{\mu^{4} \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)^{2}} & \frac{\Lambda \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 7 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 32 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 22 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 58 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 73 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 40 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 52 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 90 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 89 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 43 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 23 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 49 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 66 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 57 \lambda^{A} \lambda^{o} \mu^{4} + 25 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 4 \left(\lambda^{o}\right)^{5} \mu + 10 \left(\lambda^{o}\right)^{4} \mu^{2} + 19 \left(\lambda^{o}\right)^{3} \mu^{3} + 20 \left(\lambda^{o}\right)^{2} \mu^{4} + 15 \lambda^{o} \mu^{5} + 6 \mu^{6}\right)}{\mu^{5} \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)^{2}} & \frac{\Lambda \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 7 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 32 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 22 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 58 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 73 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 41 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 52 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 90 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 92 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 49 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 23 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 49 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 69 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 65 \lambda^{A} \lambda^{o} \mu^{4} + 34 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 4 \left(\lambda^{o}\right)^{5} \mu + 10 \left(\lambda^{o}\right)^{4} \mu^{2} + 20 \left(\lambda^{o}\right)^{3} \mu^{3} + 22 \left(\lambda^{o}\right)^{2} \mu^{4} + 18 \lambda^{o} \mu^{5} + 10 \mu^{6}\right)}{\mu^{6} \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)^{2}}\end{matrix}\right]$




```python

```


```python

```

# Recursive Ratios

## $C=1, T=2, N=2, M=2$


```python
abg.markov.visualise_ambulance_markov_chain(num_of_servers=1, threshold=2, system_capacity=2, buffer_capacity=2)
```


```python
sym_state_recursive_ratios_1222
```




$\displaystyle \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\Lambda}{\mu}\\0 & 0 & \frac{\lambda^{A}}{\mu}\\0 & 0 & \frac{\lambda^{A}}{\mu}\end{matrix}\right]$



## $C=1, T=1, N=2, M=1$


```python
abg.markov.visualise_ambulance_markov_chain(num_of_servers=1, threshold=1, system_capacity=2, buffer_capacity=1)
```


```python
sym_state_recursive_ratios_1121, sym_state_recursive_ratios_right_1121
```




$\displaystyle \left( \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right)}{\mu \left(\lambda^{A} + \mu\right)} & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + 2 \mu\right)}{\mu^{2}}\end{matrix}\right], \  \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right)}{\mu \left(\lambda^{A} + \mu\right)} & \frac{\lambda^{o} \left(\lambda^{A} + \lambda^{o} + 2 \mu\right)}{\mu \left(\lambda^{A} + \lambda^{o} + \mu\right)}\end{matrix}\right]\right)$



## $C=1, T=3, N=4, M=1$


```python
abg.markov.visualise_ambulance_markov_chain(num_of_servers=1, threshold=3, system_capacity=4, buffer_capacity=1)
```


```python
sym_state_recursive_ratios_1341, sym_state_recursive_ratios_right_1341
```




$\displaystyle \left( \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\Lambda}{\mu} & \frac{\Lambda}{\mu} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & 0 & 0 & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right)}{\mu \left(\lambda^{A} + \mu\right)} & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + 2 \mu\right)}{\mu^{2}}\end{matrix}\right], \  \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\Lambda}{\mu} & \frac{\Lambda}{\mu} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & 0 & 0 & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right)}{\mu \left(\lambda^{A} + \mu\right)} & \frac{\lambda^{o} \left(\lambda^{A} + \lambda^{o} + 2 \mu\right)}{\mu \left(\lambda^{A} + \lambda^{o} + \mu\right)}\end{matrix}\right]\right)$



## $C=1, T=1, N=2, M=2$


```python
abg.markov.visualise_ambulance_markov_chain(num_of_servers=1, threshold=1, system_capacity=2, buffer_capacity=2)
```


```python
sym_state_recursive_ratios_1122, sym_state_recursive_ratios_right_1122
```




$\displaystyle \left( \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right)}{\mu \left(\lambda^{A} + \mu\right)} & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + 2 \mu\right)}{\mu \left(\lambda^{A} + \mu\right)}\\0 & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 3 \lambda^{o} \mu + \mu^{2}\right)}{\mu \left(\lambda^{A} + \mu\right) \left(\lambda^{A} + \lambda^{o} + \mu\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 3 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 4 \lambda^{o} \mu + 3 \mu^{2}\right)}{\mu^{2} \left(\lambda^{A} + \lambda^{o} + 2 \mu\right)}\end{matrix}\right], \  \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right)}{\mu \left(\lambda^{A} + \mu\right)} & \frac{\lambda^{o} \left(\lambda^{A} + \lambda^{o} + 2 \mu\right)}{\left(\lambda^{A} + \mu\right) \left(\lambda^{A} + \lambda^{o} + \mu\right)}\\0 & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 3 \lambda^{o} \mu + \mu^{2}\right)}{\mu \left(\lambda^{A} + \mu\right) \left(\lambda^{A} + \lambda^{o} + \mu\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 3 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 4 \lambda^{o} \mu + 3 \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 3 \lambda^{o} \mu + \mu^{2}\right)}\end{matrix}\right]\right)$



## $C=1, T=1, N=3, M=1$


```python
abg.markov.visualise_ambulance_markov_chain(num_of_servers=1, threshold=1, system_capacity=3, buffer_capacity=1)
```


```python
sym_state_recursive_ratios_1131
```




$\displaystyle \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o} \left(\lambda^{A} + \mu\right)}{\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \lambda^{o} \mu + \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 3 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 2 \lambda^{o} \mu + 2 \mu^{2}\right)}{\mu^{2} \left(\lambda^{A} + \mu\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 3 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 2 \lambda^{o} \mu + 3 \mu^{2}\right)}{\mu^{3}}\end{matrix}\right]$




```python
sym_state_recursive_ratios_right_1131
```




$\displaystyle \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o} \left(\lambda^{A} + \mu\right)}{\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \lambda^{o} \mu + \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 3 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 2 \lambda^{o} \mu + 2 \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \lambda^{o} \mu + \mu^{2}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 3 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 2 \lambda^{o} \mu + 3 \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 3 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 2 \lambda^{o} \mu + 2 \mu^{2}\right)}\end{matrix}\right]$



## $C=1, T=1, N=3, M=2$


```python
abg.markov.visualise_ambulance_markov_chain(num_of_servers=1, threshold=1, system_capacity=3, buffer_capacity=2)
```


```python
sym_state_recursive_ratios_1132
```




$\displaystyle \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o} \left(\lambda^{A} + \mu\right)}{\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \lambda^{o} \mu + \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 3 \lambda^{A} \lambda^{o} \mu + 5 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{2} \mu + 2 \lambda^{o} \mu^{2} + 2 \mu^{3}\right)}{\mu \left(\lambda^{A} + \mu\right) \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 4 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 2 \lambda^{o} \mu + 3 \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)}\\0 & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{4} + 4 \left(\lambda^{A}\right)^{3} \lambda^{o} + 4 \left(\lambda^{A}\right)^{3} \mu + 6 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 11 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 6 \left(\lambda^{A}\right)^{2} \mu^{2} + 4 \lambda^{A} \left(\lambda^{o}\right)^{3} + 10 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 10 \lambda^{A} \lambda^{o} \mu^{2} + 4 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{4} + 3 \left(\lambda^{o}\right)^{3} \mu + 6 \left(\lambda^{o}\right)^{2} \mu^{2} + 3 \lambda^{o} \mu^{3} + \mu^{4}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \lambda^{o} \mu + \mu^{2}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{4} + 4 \left(\lambda^{A}\right)^{3} \lambda^{o} + 5 \left(\lambda^{A}\right)^{3} \mu + 6 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 14 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 10 \left(\lambda^{A}\right)^{2} \mu^{2} + 4 \lambda^{A} \left(\lambda^{o}\right)^{3} + 13 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 17 \lambda^{A} \lambda^{o} \mu^{2} + 9 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{4} + 4 \left(\lambda^{o}\right)^{3} \mu + 9 \left(\lambda^{o}\right)^{2} \mu^{2} + 8 \lambda^{o} \mu^{3} + 3 \mu^{4}\right)}{\mu^{2} \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 3 \lambda^{A} \lambda^{o} \mu + 5 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{2} \mu + 2 \lambda^{o} \mu^{2} + 2 \mu^{3}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{4} + 4 \left(\lambda^{A}\right)^{3} \lambda^{o} + 5 \left(\lambda^{A}\right)^{3} \mu + 6 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 14 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 11 \left(\lambda^{A}\right)^{2} \mu^{2} + 4 \lambda^{A} \left(\lambda^{o}\right)^{3} + 13 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 19 \lambda^{A} \lambda^{o} \mu^{2} + 13 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{4} + 4 \left(\lambda^{o}\right)^{3} \mu + 10 \left(\lambda^{o}\right)^{2} \mu^{2} + 10 \lambda^{o} \mu^{3} + 6 \mu^{4}\right)}{\mu^{3} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 4 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 2 \lambda^{o} \mu + 3 \mu^{2}\right)}\end{matrix}\right]$




```python
sym_state_recursive_ratios_right_1132
```




$\displaystyle \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o} \left(\lambda^{A} + \mu\right)}{\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \lambda^{o} \mu + \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 3 \lambda^{A} \lambda^{o} \mu + 5 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{2} \mu + 2 \lambda^{o} \mu^{2} + 2 \mu^{3}\right)}{\left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \lambda^{o} \mu + \mu^{2}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 4 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + 2 \lambda^{o} \mu + 3 \mu^{2}\right)}{\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 3 \lambda^{A} \lambda^{o} \mu + 5 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{2} \mu + 2 \lambda^{o} \mu^{2} + 2 \mu^{3}}\\0 & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{4} + 4 \left(\lambda^{A}\right)^{3} \lambda^{o} + 4 \left(\lambda^{A}\right)^{3} \mu + 6 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 11 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 6 \left(\lambda^{A}\right)^{2} \mu^{2} + 4 \lambda^{A} \left(\lambda^{o}\right)^{3} + 10 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 10 \lambda^{A} \lambda^{o} \mu^{2} + 4 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{4} + 3 \left(\lambda^{o}\right)^{3} \mu + 6 \left(\lambda^{o}\right)^{2} \mu^{2} + 3 \lambda^{o} \mu^{3} + \mu^{4}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \lambda^{o} \mu + \mu^{2}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{4} + 4 \left(\lambda^{A}\right)^{3} \lambda^{o} + 5 \left(\lambda^{A}\right)^{3} \mu + 6 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 14 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 10 \left(\lambda^{A}\right)^{2} \mu^{2} + 4 \lambda^{A} \left(\lambda^{o}\right)^{3} + 13 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 17 \lambda^{A} \lambda^{o} \mu^{2} + 9 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{4} + 4 \left(\lambda^{o}\right)^{3} \mu + 9 \left(\lambda^{o}\right)^{2} \mu^{2} + 8 \lambda^{o} \mu^{3} + 3 \mu^{4}\right)}{\mu \left(\left(\lambda^{A}\right)^{4} + 4 \left(\lambda^{A}\right)^{3} \lambda^{o} + 4 \left(\lambda^{A}\right)^{3} \mu + 6 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 11 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 6 \left(\lambda^{A}\right)^{2} \mu^{2} + 4 \lambda^{A} \left(\lambda^{o}\right)^{3} + 10 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 10 \lambda^{A} \lambda^{o} \mu^{2} + 4 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{4} + 3 \left(\lambda^{o}\right)^{3} \mu + 6 \left(\lambda^{o}\right)^{2} \mu^{2} + 3 \lambda^{o} \mu^{3} + \mu^{4}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{4} + 4 \left(\lambda^{A}\right)^{3} \lambda^{o} + 5 \left(\lambda^{A}\right)^{3} \mu + 6 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 14 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 11 \left(\lambda^{A}\right)^{2} \mu^{2} + 4 \lambda^{A} \left(\lambda^{o}\right)^{3} + 13 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 19 \lambda^{A} \lambda^{o} \mu^{2} + 13 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{4} + 4 \left(\lambda^{o}\right)^{3} \mu + 10 \left(\lambda^{o}\right)^{2} \mu^{2} + 10 \lambda^{o} \mu^{3} + 6 \mu^{4}\right)}{\mu \left(\left(\lambda^{A}\right)^{4} + 4 \left(\lambda^{A}\right)^{3} \lambda^{o} + 5 \left(\lambda^{A}\right)^{3} \mu + 6 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 14 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 10 \left(\lambda^{A}\right)^{2} \mu^{2} + 4 \lambda^{A} \left(\lambda^{o}\right)^{3} + 13 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 17 \lambda^{A} \lambda^{o} \mu^{2} + 9 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{4} + 4 \left(\lambda^{o}\right)^{3} \mu + 9 \left(\lambda^{o}\right)^{2} \mu^{2} + 8 \lambda^{o} \mu^{3} + 3 \mu^{4}\right)}\end{matrix}\right]$



## $C=1, T=1, N=4, M=1$


```python
abg.markov.visualise_ambulance_markov_chain(num_of_servers=1, threshold=1, system_capacity=4, buffer_capacity=1)
```


```python
sym_state_recursive_ratios_1141
```




$\displaystyle \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)}{\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}} & \frac{\lambda^{o} \left(\lambda^{A} + \mu\right)}{\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 6 \lambda^{A} \lambda^{o} \mu + 5 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 2 \lambda^{o} \mu^{2} + 2 \mu^{3}\right)}{\mu^{2} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 6 \lambda^{A} \lambda^{o} \mu + 6 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 3 \lambda^{o} \mu^{2} + 3 \mu^{3}\right)}{\mu^{3} \left(\lambda^{A} + \mu\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 6 \lambda^{A} \lambda^{o} \mu + 6 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 3 \lambda^{o} \mu^{2} + 4 \mu^{3}\right)}{\mu^{4}}\end{matrix}\right]$




```python
sym_state_recursive_ratios_right_1141
```




$\displaystyle \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)}{\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}} & \frac{\lambda^{o} \left(\lambda^{A} + \mu\right)}{\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 6 \lambda^{A} \lambda^{o} \mu + 5 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 2 \lambda^{o} \mu^{2} + 2 \mu^{3}\right)}{\mu \left(\lambda^{A} + \lambda^{o} + \mu\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \mu^{2}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 6 \lambda^{A} \lambda^{o} \mu + 6 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 3 \lambda^{o} \mu^{2} + 3 \mu^{3}\right)}{\mu \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 6 \lambda^{A} \lambda^{o} \mu + 5 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 2 \lambda^{o} \mu^{2} + 2 \mu^{3}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 6 \lambda^{A} \lambda^{o} \mu + 6 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 3 \lambda^{o} \mu^{2} + 4 \mu^{3}\right)}{\mu \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 4 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 6 \lambda^{A} \lambda^{o} \mu + 6 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 3 \lambda^{o} \mu^{2} + 3 \mu^{3}\right)}\end{matrix}\right]$



## $C=1, T=1, N=4, M=2$


```python
abg.markov.visualise_ambulance_markov_chain(num_of_servers=1, threshold=1, system_capacity=4, buffer_capacity=2)
```


```python
sym_state_recursive_ratios_1142
```




$\displaystyle \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)}{\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}} & \frac{\lambda^{o} \left(\lambda^{A} + \mu\right)}{\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{5} + 4 \left(\lambda^{A}\right)^{4} \lambda^{o} + 6 \left(\lambda^{A}\right)^{4} \mu + 6 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} + 15 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu + 14 \left(\lambda^{A}\right)^{3} \mu^{2} + 4 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} + 12 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu + 20 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{2} + 16 \left(\lambda^{A}\right)^{2} \mu^{3} + \lambda^{A} \left(\lambda^{o}\right)^{4} + 3 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu + 6 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{2} + 11 \lambda^{A} \lambda^{o} \mu^{3} + 9 \lambda^{A} \mu^{4} + \left(\lambda^{o}\right)^{3} \mu^{2} + 2 \left(\lambda^{o}\right)^{2} \mu^{3} + 2 \lambda^{o} \mu^{4} + 2 \mu^{5}\right)}{\mu \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right) \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{4} + 3 \left(\lambda^{A}\right)^{3} \lambda^{o} + 6 \left(\lambda^{A}\right)^{3} \mu + 3 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 9 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 12 \left(\lambda^{A}\right)^{2} \mu^{2} + \lambda^{A} \left(\lambda^{o}\right)^{3} + 4 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 9 \lambda^{A} \lambda^{o} \mu^{2} + 10 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{3} \mu + 2 \left(\lambda^{o}\right)^{2} \mu^{2} + 3 \lambda^{o} \mu^{3} + 3 \mu^{4}\right)}{\mu \left(\lambda^{A} + \mu\right) \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 6 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 8 \lambda^{A} \lambda^{o} \mu + 9 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 3 \lambda^{o} \mu^{2} + 4 \mu^{3}\right)}{\mu \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)}\\0 & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 6 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 27 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 15 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 48 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 48 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 42 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 57 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 42 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 18 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 30 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 30 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 18 \lambda^{A} \lambda^{o} \mu^{4} + 6 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 3 \left(\lambda^{o}\right)^{5} \mu + 6 \left(\lambda^{o}\right)^{4} \mu^{2} + 10 \left(\lambda^{o}\right)^{3} \mu^{3} + 6 \left(\lambda^{o}\right)^{2} \mu^{4} + 3 \lambda^{o} \mu^{5} + \mu^{6}\right)}{\mu \left(\lambda^{A} + \lambda^{o} + \mu\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \mu^{2}\right) \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 7 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 32 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 21 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 58 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 69 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 34 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 52 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 84 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 74 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 31 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 23 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 45 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 54 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 39 \lambda^{A} \lambda^{o} \mu^{4} + 15 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 4 \left(\lambda^{o}\right)^{5} \mu + 9 \left(\lambda^{o}\right)^{4} \mu^{2} + 16 \left(\lambda^{o}\right)^{3} \mu^{3} + 15 \left(\lambda^{o}\right)^{2} \mu^{4} + 8 \lambda^{o} \mu^{5} + 3 \mu^{6}\right)}{\mu^{2} \left(\left(\lambda^{A}\right)^{5} + 4 \left(\lambda^{A}\right)^{4} \lambda^{o} + 6 \left(\lambda^{A}\right)^{4} \mu + 6 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} + 15 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu + 14 \left(\lambda^{A}\right)^{3} \mu^{2} + 4 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} + 12 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu + 20 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{2} + 16 \left(\lambda^{A}\right)^{2} \mu^{3} + \lambda^{A} \left(\lambda^{o}\right)^{4} + 3 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu + 6 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{2} + 11 \lambda^{A} \lambda^{o} \mu^{3} + 9 \lambda^{A} \mu^{4} + \left(\lambda^{o}\right)^{3} \mu^{2} + 2 \left(\lambda^{o}\right)^{2} \mu^{3} + 2 \lambda^{o} \mu^{4} + 2 \mu^{5}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 7 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 32 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 22 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 58 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 73 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 40 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 52 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 90 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 89 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 43 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 23 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 49 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 66 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 57 \lambda^{A} \lambda^{o} \mu^{4} + 25 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 4 \left(\lambda^{o}\right)^{5} \mu + 10 \left(\lambda^{o}\right)^{4} \mu^{2} + 19 \left(\lambda^{o}\right)^{3} \mu^{3} + 20 \left(\lambda^{o}\right)^{2} \mu^{4} + 15 \lambda^{o} \mu^{5} + 6 \mu^{6}\right)}{\mu^{3} \left(\left(\lambda^{A}\right)^{4} + 3 \left(\lambda^{A}\right)^{3} \lambda^{o} + 6 \left(\lambda^{A}\right)^{3} \mu + 3 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 9 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 12 \left(\lambda^{A}\right)^{2} \mu^{2} + \lambda^{A} \left(\lambda^{o}\right)^{3} + 4 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 9 \lambda^{A} \lambda^{o} \mu^{2} + 10 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{3} \mu + 2 \left(\lambda^{o}\right)^{2} \mu^{2} + 3 \lambda^{o} \mu^{3} + 3 \mu^{4}\right)} & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 7 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 32 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 22 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 58 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 73 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 41 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 52 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 90 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 92 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 49 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 23 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 49 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 69 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 65 \lambda^{A} \lambda^{o} \mu^{4} + 34 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 4 \left(\lambda^{o}\right)^{5} \mu + 10 \left(\lambda^{o}\right)^{4} \mu^{2} + 20 \left(\lambda^{o}\right)^{3} \mu^{3} + 22 \left(\lambda^{o}\right)^{2} \mu^{4} + 18 \lambda^{o} \mu^{5} + 10 \mu^{6}\right)}{\mu^{4} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 6 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 8 \lambda^{A} \lambda^{o} \mu + 9 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 3 \lambda^{o} \mu^{2} + 4 \mu^{3}\right)}\end{matrix}\right]$




```python
sym_state_recursive_ratios_right_1142
```




$\displaystyle \left[\begin{matrix}1 & \frac{\Lambda}{\mu} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)}{\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}} & \frac{\lambda^{o} \left(\lambda^{A} + \mu\right)}{\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}} & \frac{\lambda^{o}}{\lambda^{A} + \mu}\\0 & \frac{\lambda^{A} \left(\lambda^{A} + \lambda^{o} + \mu\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \mu^{2}\right)}{\mu \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{5} + 4 \left(\lambda^{A}\right)^{4} \lambda^{o} + 6 \left(\lambda^{A}\right)^{4} \mu + 6 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} + 15 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu + 14 \left(\lambda^{A}\right)^{3} \mu^{2} + 4 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} + 12 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu + 20 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{2} + 16 \left(\lambda^{A}\right)^{2} \mu^{3} + \lambda^{A} \left(\lambda^{o}\right)^{4} + 3 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu + 6 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{2} + 11 \lambda^{A} \lambda^{o} \mu^{3} + 9 \lambda^{A} \mu^{4} + \left(\lambda^{o}\right)^{3} \mu^{2} + 2 \left(\lambda^{o}\right)^{2} \mu^{3} + 2 \lambda^{o} \mu^{4} + 2 \mu^{5}\right)}{\left(\lambda^{A} + \lambda^{o} + \mu\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \mu^{2}\right) \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{4} + 3 \left(\lambda^{A}\right)^{3} \lambda^{o} + 6 \left(\lambda^{A}\right)^{3} \mu + 3 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 9 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 12 \left(\lambda^{A}\right)^{2} \mu^{2} + \lambda^{A} \left(\lambda^{o}\right)^{3} + 4 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 9 \lambda^{A} \lambda^{o} \mu^{2} + 10 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{3} \mu + 2 \left(\lambda^{o}\right)^{2} \mu^{2} + 3 \lambda^{o} \mu^{3} + 3 \mu^{4}\right)}{\left(\lambda^{A}\right)^{5} + 4 \left(\lambda^{A}\right)^{4} \lambda^{o} + 6 \left(\lambda^{A}\right)^{4} \mu + 6 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} + 15 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu + 14 \left(\lambda^{A}\right)^{3} \mu^{2} + 4 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} + 12 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu + 20 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{2} + 16 \left(\lambda^{A}\right)^{2} \mu^{3} + \lambda^{A} \left(\lambda^{o}\right)^{4} + 3 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu + 6 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{2} + 11 \lambda^{A} \lambda^{o} \mu^{3} + 9 \lambda^{A} \mu^{4} + \left(\lambda^{o}\right)^{3} \mu^{2} + 2 \left(\lambda^{o}\right)^{2} \mu^{3} + 2 \lambda^{o} \mu^{4} + 2 \mu^{5}} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{3} + 3 \left(\lambda^{A}\right)^{2} \lambda^{o} + 6 \left(\lambda^{A}\right)^{2} \mu + 3 \lambda^{A} \left(\lambda^{o}\right)^{2} + 8 \lambda^{A} \lambda^{o} \mu + 9 \lambda^{A} \mu^{2} + \left(\lambda^{o}\right)^{3} + 2 \left(\lambda^{o}\right)^{2} \mu + 3 \lambda^{o} \mu^{2} + 4 \mu^{3}\right)}{\left(\lambda^{A}\right)^{4} + 3 \left(\lambda^{A}\right)^{3} \lambda^{o} + 6 \left(\lambda^{A}\right)^{3} \mu + 3 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} + 9 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu + 12 \left(\lambda^{A}\right)^{2} \mu^{2} + \lambda^{A} \left(\lambda^{o}\right)^{3} + 4 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu + 9 \lambda^{A} \lambda^{o} \mu^{2} + 10 \lambda^{A} \mu^{3} + \left(\lambda^{o}\right)^{3} \mu + 2 \left(\lambda^{o}\right)^{2} \mu^{2} + 3 \lambda^{o} \mu^{3} + 3 \mu^{4}}\\0 & \frac{\lambda^{A} \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 6 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 27 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 15 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 48 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 48 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 42 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 57 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 42 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 18 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 30 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 30 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 18 \lambda^{A} \lambda^{o} \mu^{4} + 6 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 3 \left(\lambda^{o}\right)^{5} \mu + 6 \left(\lambda^{o}\right)^{4} \mu^{2} + 10 \left(\lambda^{o}\right)^{3} \mu^{3} + 6 \left(\lambda^{o}\right)^{2} \mu^{4} + 3 \lambda^{o} \mu^{5} + \mu^{6}\right)}{\mu \left(\lambda^{A} + \lambda^{o} + \mu\right) \left(\left(\lambda^{A}\right)^{2} + 2 \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \left(\lambda^{o}\right)^{2} + \mu^{2}\right) \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 7 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 32 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 21 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 58 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 69 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 34 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 52 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 84 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 74 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 31 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 23 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 45 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 54 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 39 \lambda^{A} \lambda^{o} \mu^{4} + 15 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 4 \left(\lambda^{o}\right)^{5} \mu + 9 \left(\lambda^{o}\right)^{4} \mu^{2} + 16 \left(\lambda^{o}\right)^{3} \mu^{3} + 15 \left(\lambda^{o}\right)^{2} \mu^{4} + 8 \lambda^{o} \mu^{5} + 3 \mu^{6}\right)}{\mu \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 6 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 27 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 15 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 48 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 48 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 42 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 57 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 42 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 18 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 30 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 30 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 18 \lambda^{A} \lambda^{o} \mu^{4} + 6 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 3 \left(\lambda^{o}\right)^{5} \mu + 6 \left(\lambda^{o}\right)^{4} \mu^{2} + 10 \left(\lambda^{o}\right)^{3} \mu^{3} + 6 \left(\lambda^{o}\right)^{2} \mu^{4} + 3 \lambda^{o} \mu^{5} + \mu^{6}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 7 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 32 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 22 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 58 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 73 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 40 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 52 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 90 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 89 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 43 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 23 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 49 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 66 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 57 \lambda^{A} \lambda^{o} \mu^{4} + 25 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 4 \left(\lambda^{o}\right)^{5} \mu + 10 \left(\lambda^{o}\right)^{4} \mu^{2} + 19 \left(\lambda^{o}\right)^{3} \mu^{3} + 20 \left(\lambda^{o}\right)^{2} \mu^{4} + 15 \lambda^{o} \mu^{5} + 6 \mu^{6}\right)}{\mu \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 7 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 32 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 21 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 58 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 69 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 34 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 52 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 84 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 74 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 31 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 23 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 45 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 54 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 39 \lambda^{A} \lambda^{o} \mu^{4} + 15 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 4 \left(\lambda^{o}\right)^{5} \mu + 9 \left(\lambda^{o}\right)^{4} \mu^{2} + 16 \left(\lambda^{o}\right)^{3} \mu^{3} + 15 \left(\lambda^{o}\right)^{2} \mu^{4} + 8 \lambda^{o} \mu^{5} + 3 \mu^{6}\right)} & \frac{\lambda^{o} \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 7 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 32 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 22 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 58 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 73 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 41 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 52 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 90 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 92 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 49 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 23 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 49 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 69 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 65 \lambda^{A} \lambda^{o} \mu^{4} + 34 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 4 \left(\lambda^{o}\right)^{5} \mu + 10 \left(\lambda^{o}\right)^{4} \mu^{2} + 20 \left(\lambda^{o}\right)^{3} \mu^{3} + 22 \left(\lambda^{o}\right)^{2} \mu^{4} + 18 \lambda^{o} \mu^{5} + 10 \mu^{6}\right)}{\mu \left(\left(\lambda^{A}\right)^{6} + 6 \left(\lambda^{A}\right)^{5} \lambda^{o} + 7 \left(\lambda^{A}\right)^{5} \mu + 15 \left(\lambda^{A}\right)^{4} \left(\lambda^{o}\right)^{2} + 32 \left(\lambda^{A}\right)^{4} \lambda^{o} \mu + 22 \left(\lambda^{A}\right)^{4} \mu^{2} + 20 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{3} + 58 \left(\lambda^{A}\right)^{3} \left(\lambda^{o}\right)^{2} \mu + 73 \left(\lambda^{A}\right)^{3} \lambda^{o} \mu^{2} + 40 \left(\lambda^{A}\right)^{3} \mu^{3} + 15 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{4} + 52 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{3} \mu + 90 \left(\lambda^{A}\right)^{2} \left(\lambda^{o}\right)^{2} \mu^{2} + 89 \left(\lambda^{A}\right)^{2} \lambda^{o} \mu^{3} + 43 \left(\lambda^{A}\right)^{2} \mu^{4} + 6 \lambda^{A} \left(\lambda^{o}\right)^{5} + 23 \lambda^{A} \left(\lambda^{o}\right)^{4} \mu + 49 \lambda^{A} \left(\lambda^{o}\right)^{3} \mu^{2} + 66 \lambda^{A} \left(\lambda^{o}\right)^{2} \mu^{3} + 57 \lambda^{A} \lambda^{o} \mu^{4} + 25 \lambda^{A} \mu^{5} + \left(\lambda^{o}\right)^{6} + 4 \left(\lambda^{o}\right)^{5} \mu + 10 \left(\lambda^{o}\right)^{4} \mu^{2} + 19 \left(\lambda^{o}\right)^{3} \mu^{3} + 20 \left(\lambda^{o}\right)^{2} \mu^{4} + 15 \lambda^{o} \mu^{5} + 6 \mu^{6}\right)}\end{matrix}\right]$




```python

```


```python

```

# $P_0$ rate

## $C=1, T=2, N=2, M=2$


```python
sym.factor(sym.fraction(sym_state_probs_1222[0])[0])
```




$\displaystyle \mu^{4}$



## $C=1, T=1, N=2, M=1$


```python
sym.factor(sym.fraction(sym_state_probs_1121[0])[0])
```




$\displaystyle \mu^{3} \left(\lambda^{A} + \mu\right)$



## $C=1, T=3, N=4, M=1$


```python
sym.factor(sym.fraction(sym_state_probs_1341[0])[0])
```




$\displaystyle \mu^{5} \left(\lambda^{A} + \mu\right)$



## $C=1, T=1, N=2, M=2$


```python
sym.factor(sym.fraction(sym_state_probs_1122[0])[0])
```




$\displaystyle \mu^{4} \left(\lambda^{A} + \mu\right)^{2}$



## $C=1, T=1, N=3, M=1$


```python
sym.factor(sym.fraction(sym_state_probs_1131[0])[0])
```




$\displaystyle \mu^{4} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)$



## $C=1, T=1, N=3, M=2$


```python
sym.factor(sym.fraction(sym_state_probs_1132[p00])[0])
```




$\displaystyle \mu^{5} \left(\left(\lambda^{A}\right)^{2} + \lambda^{A} \lambda^{o} + 2 \lambda^{A} \mu + \mu^{2}\right)^{2}$



## $C=1, T=1, N=4, M=1$


```python
sym.factor(sym.fraction(sym_state_probs_1141[p00])[0])
```




$\displaystyle \mu^{5} \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)$



## $C=1, T=1, N=4, M=2$


```python
sym.factor(sym.fraction(sym_state_probs_1142[p00])[0])
```




$\displaystyle \mu^{6} \left(\left(\lambda^{A}\right)^{3} + 2 \left(\lambda^{A}\right)^{2} \lambda^{o} + 3 \left(\lambda^{A}\right)^{2} \mu + \lambda^{A} \left(\lambda^{o}\right)^{2} + 2 \lambda^{A} \lambda^{o} \mu + 3 \lambda^{A} \mu^{2} + \mu^{3}\right)^{2}$




```python

```

50ecbf11c2bf66e6b7adb1ed5af20901a4790874
ipynb
Jupyter Notebook
nbs/src/Markov/closed_form_formula_of_pi/investigate-close-form-pi.ipynb
11michalis11/AmbulanceDecisionGame
45164ba51da0417297f715e41716cb91facc120f
MIT
nbs/src/Markov/closed_form_formula_of_pi/investigate-close-form-pi.ipynb
11michalis11/AmbulanceDecisionGame
45164ba51da0417297f715e41716cb91facc120f
MIT
2020-04-20T09:08:31.000Z
2021-09-23T11:09:25.000Z
nbs/src/Markov/closed_form_formula_of_pi/investigate-close-form-pi.ipynb
11michalis11/AmbulanceDecisionGame
45164ba51da0417297f715e41716cb91facc120f
MIT
Qwen/Qwen-72B
1. YES
2. YES