Question: Filling Array with Procedure

I try to fill an Array with a procedure to have pointpairs for a plot. Here is my problem. It doesn't work I wont it to.

 

test:=proc(q)
if q=1 then RETURN(R__real(T)) end if;
if q=2 then RETURN(evalf(((((1+I*k*x/(2*cos(theta[q]))*(X+Y(T)))*test(q-1)-I*k*x/(2*cos(theta[q]))*(X-Y(T)))/((1-I*k*x/(2*cos(theta[q]))*(X+Y(T)))+I*k*x/(2*cos(theta[q]))*(X-Y(T))*test(q-1)))))) end if;
if q=3 then RETURN(evalf(((((1+I*k*x/(2*cos(theta[q]))*(X+Y(T)))*test(q-1)-I*k*x/(2*cos(theta[q]))*(X-Y(T)))/((1-I*k*x/(2*cos(theta[q]))*(X+Y(T)))+I*k*x/(2*cos(theta[q]))*(X-Y(T))*test(q-1)))))) end if;
end proc:

 

test2:=proc(Anfang,Ende,Sprung)
j:=1;
Matr:= Matrix();
for i from 1 while Anfang+Sprung*i<Ende do
Matr[1,i] = Anfang+Sprung*(i-1):
end do:
for i from Anfang by Sprung to Ende do
Oeffnungswinkel:= i;
OeffnungswinkelRad:=Oeffnungswinkel/180*Pi;
theta :=[Pi/2-OeffnungswinkelRad/2,abs(Pi/2-OeffnungswinkelRad*3/2),abs(abs(Pi/2-OeffnungswinkelRad*3/2)-OeffnungswinkelRad)];
if i<90 then Matr[j,2]:= seq(evalf(abs(test(q))),q=1)*seq(evalf(abs(test(q))),q=2)*seq(evalf(abs(test(q))),q=3) elif i<120 then Matr[j,2]:=seq(evalf(abs(test(q))),q=1)*seq(evalf(abs(test(q))),q=2) else Matr[j,2]:=seq(evalf(abs(test(q))),q=1) end if;
j:=j+1;
RETURN(Matr);
end do:
end proc

 

Can someone help my please? The first procedure works, I tested it with some numbers, but the second one is the Problem.

Please Wait...