First off, to ensure data integrity, we use the @WARN function to verify that the probabilities in each row of the state transition matrix sum to 1 using:

! Check the input data, warn the user if the sum of

 probabilities in a row does not equal 1.;

 @FOR( STATE( I):

  @WARN( 'Probabilities in a row must sum to 1.',

   @ABS( 1 - @SUM( SXS( I, K): TPROB( I, K)))

    #GT# .000001);

Due to the potential for roundoff error, we allow for a modest transgression by using a tolerance factor of .000001. If the probabilities in a row sum up to more that 1.000001 or less than .999999 the user will receive a warning.

Next, the steady state probabilities must be exhaustive. We guarantee this by setting their sum to 1 with:

! The steady state probabilities must sum to 1;

 @SUM( STATE: SPROB) = 1;

Finally, in addition to this last equation, we need an additional n-1 equations to solve for the n steady state probabilities. We get these equations from the RIRO derivation above using:

!  Steady state equations;

!   Only need N equations, so drop last;

 @FOR( STATE( J)| J #LT# @SIZE( STATE):

  SPROB( J) = @SUM( SXS( I, J): SPROB( I) *

   TPROB( I, J))

 );