Question: Why did I get an unterminated loop error again?

 

"with(LinearAlgebra):  T := proc(n::integer)  local t0, tn, i, t, t1;  if (n>0) then t0 := Matrix(1, 1, 1); tn := Matrix(1,1,0);  for i from 1 to n do local z := 2^i;  t := Matrix([[Add(t0, tn), x .~ t0], [t0, ZeroMatrix(z/(2))]]);  t1 := Matrix([[y .~ t0, ZeroMatrix(z/(2))], [ZeroMatrix(z/(2)), ZeroMatrix(z/(2))]]);  t0 := t; tn := t1;  end do;  else 'T'(n) end if; t0; end proc;"

Error, unterminated loop

"with(LinearAlgebra):  T := proc(n::integer)  local t0, tn, i, t, t1;  if (n>0) then t0 := Matrix(1, 1, 1); tn := Matrix(1,1,0);  for i from 1 to n do local z := 2^i;  t := Matrix([[Add(t0, tn), x .~ t0], [t0, ZeroMatrix(z/2)]]);  t1 := Matrix([[y .~ t0, ZeroMatrix(z/2)], [ZeroMatrix(z/2), ZeroMatrix(z/2)]]);  t0 := t; tn := t1;  end do;  else 'T'(n) end if; t0; end proc;"

 

T(2)

T(2)

(1)

``

 

Download G2.mw

Hello everyone. I was trying to code the recurrence relation given in the image below (without taking the mth power):

 

But, as I run the program, I am getting an "unterminated loop" error. Can someone please point out the mistake(s)?

Please Wait...