Infinitesimal Generator Solver

Input matrix

Example:
0 2 7 2 4
0 0 0 7 22
0 2 0 2 0
1 1 0 0 0
0 0 2 0 0
 



If you prefer, you can use GNU Octave:
#author: Ricardo M. Czekster
#created: 01/27/2010

clear;

#infinitesimal generator definition
#every line must sums to zero (diagonal has the negative sum of the line)
Q = [-109.3154, 100, 0, 0, 0, 9.1854, 0, 0, 0.13, 0, 0;
200, -205.13, 5, 0, 0, 0, 0, 0, 0, 0, 0.13;
0, 0.0004, -135.0004, 8, 0, 0, 127, 0, 0, 0, 0;
0, 0, 41.58, -58.58, 17, 0, 0, 0, 0, 0, 0;
0, 0, 0, 1.69, -3.04, 1.35, 0, 0, 0, 0, 0;
87, 0, 0, 0, 0.18, -87.18, 0, 0, 0, 0, 0;
0, 0, 14, 0, 0, 0, -17.5, 3.5, 0, 0, 0;
0, 0, 0, 0, 0, 0, 4.2336, -104.4436, 100, 0.21, 0;
100, 0, 0, 0, 0, 0, 0, 419.58, -519.58, 0, 0;
0, 0, 0, 0, 0, 0, 0, 2.77, 0, -10.57, 7.8;
0, 0.013, 0, 0, 0, 0, 0, 0, 0, 30.24, -30.253];

#just saves original matrix before manipulation (uncomment here if needed)
#O = Q;

#last column set to one
for i=1:11
  Q(i,11) = 1;
endfor

b = [0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 1];

#transpose matrix Q
QT = Q';

#linear solution (results in vector P)
P = QT \ b;

#probability output (times 100)
#P *= 100;