Question: Transition Matrix

The code is from the book(SDE). I think P.n := evalm( P.(n-1)&*P0) causes the problem. I have never seen this kind of the structure before ( I did some coding with C and Java). Could you explain that? P0, P1, P2,,,, using for n from 1 to 10. Is "." between P and n the dot (period)? Thank you in advance.

restart

N := 2; A := -N; B := N

q := .3; p := .5; sa := .9; sb := .1; r := 1-p-q

with(linalg)

dimP := 2*N+1

P := matrix(dimP, dimP, [`$`(0, dimP*dimP)])

P[1, 1] := sa; P[1, 2] := 1-sa; P[dimP, dimP] := sb; P[dimP, dimP-1] := 1-sb

for i from 2 to dimP-1 do P[i, i-1] := q; P[i, i] := r; P[i, i+1] := p end do

P0 := P

for n to 10 do P.n := evalm(`&*`(P.(n-1), P0)) end do

print(P10)

P10

(1)

``


 

Download TransitionMatix.mw

Please Wait...