Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-01 - decus/20-0020/tchain.prb
There are 2 other files named tchain.prb in the archive. Click here to see a list.
100'  NAME--TCHAIN
110'
120'  DESCRIPTION--COMPUTES BASIC QUANTITIES FOR A TRANSIENT MARKOV CHAIN
130'
140'  SOURCE--REVISED 11/13/67 BY PROF. KEMENY
150'
160'  INSTRUCTIONS--USER SUPPLIES AS DATA IN 900: 
170'  M (NUMBER OF ABSORBING STATES), N (NO. TRANSIENT STATES)
180'  TWO MATRICES ARE FURNISHED BY ROWS AS DATA STARTING IN LINE 9000:
190'  Q   (TRANSIENT TO TRANSIENT TRANSITION PROBS.)
200'  R   (TRANSIENT TO ABSORBING PROBS.)
210'  THE PROGRAM COMPUTES THE FOLLOWING QUANTITIES:
220'  FUNDAMENTAL MATRIX (MEAN NUMBER OF TIMES IN STATES)
230'  VARIANCE OF SAME
240'  MEAN AND VARIANCE OF TIMES TO ABSORPTION
250'  ABSORPTION PROBABILITIES.
260'  NOTE:MATRICES MAY BE COMPUTED INSTEAD OF SUPPLYING THEM AS DATA.
270'       COMPUTE Q STARTING AT 1000,COMPUTE R STARTING AT 2000.
280'
290'
300'  *  *  *  *  *  *  *  *  MAIN PROGRAM  *  *  *  *  *  *  *  *  *  *
310'
320 READ M,N
330 DIM Q(40,40),N(40,40),R(40,40),V(40,40),T(40),U(40)
340 MAT N=IDN(N,N)
350 MAT U=CON(N)
900 DATA 2,4
1000 MAT READ Q(N,N)
2000 MAT READ R(N,M)
3000 PRINT "TRANSIENT TO TRANSIENT PROBABILITIES"
3010 MAT PRINT Q
3020 GOSUB 3390
3030 PRINT "TRANSIENT TO ABSORBING PROBABILITIES"
3040 MAT PRINT R
3050 MAT V=N-Q
3060 MAT N=INV(V)
3070 GOSUB 3390
3080 PRINT "MEAN NUMBER OF TIMES IN STATES (FUNDAMENTAL MATRIX)"
3090 MAT PRINT N
3100 GOSUB 3390
3110 PRINT "VARIANCE OF TIMES IN STATES"
3120 MAT Q = ZER
3130 FOR I = 1 TO N
3140 LET Q(I,I) = 2*N(I,I)-1
3150 NEXT I
3160 MAT V = N*Q
3170 FOR I = 1 TO N
3180 FOR J = 1 TO N
3190 LET V(I,J) = V(I,J) - N(I,J)^2
3200 NEXT J
3210 NEXT I
3220 MAT PRINT V
3230 MAT T = N*U
3240 GOSUB 3390
3250 PRINT "ABSORPTION TIMES"
3260 PRINT "MEAN","VARIANCE"
3270 PRINT
3280 PRINT
3290 MAT V = (2)*N
3300 MAT U = V*T
3310 FOR I = 1 TO N
3320 PRINT T(I), U(I)-T(I)-T(I)^2
3330 NEXT I
3340 MAT V = N*R
3350 GOSUB 3390
3360 PRINT "ABSORPTION PROBABILITIES"
3370 MAT PRINT V
3380 GOTO 3430
3390 FOR I=1 TO 3
3400 PRINT
3410 NEXT I
3420 RETURN
3430 STOP
9000 DATA 0, .6667, 0, 0
9001 DATA .3333, 0, .6667, 0
9002 DATA 0, .3333, 0, .6667
9003 DATA 0, 0, .3333, 0
9004 DATA .3333, 0
9005 DATA 0,0
9006 DATA 0,0
9007 DATA 0,.6667
99999 END