Expected occupation count before absorption (source code)

= Expected occupation count before absorption

The expected number $u(i)$ of visits to a state $k$ before absorption satisfies the reward equation
$$
u(i)=\mathbf1_{\{i=k\}}+\sum_jP_{ij}u(j),
$$
with zero boundary data at absorbing states where counting stops.