Question: Procedures, procedures

Hello to everyone!

 

I was trying to implement the following proc:
 

``

restart; with(plots); with(plottools)

"AngleSpectrum  :=  proc( theta )  local A, B, C, a1,a2,col,k,n;  n := floor(2*Pi/theta):  for k from 1 to n do      a1 := theta*(k-1);   a2 := theta*(k);      if( k mod 2 = 0) then col := COLOR(RGB,.8,.3,.5);      else col := COLOR(RGB,.4,.3,.5) ; fi;      A[k] := plottools[pieslice]([0,0], 1, a1..a2, color = col  ):      C[k] := textplot( [ evalf(1.2*cos(a2)), evalf(1.2*sin(a2)),                   convert(a2, string)]):  od:  display( seq( {A[k], C[k]}, k = 1..n), scaling=constrained);  end proc:"

Error, unterminated loop

"AngleSpectrum  := proc( theta )  local A, B, C, a1,a2,col,k,n;  n := floor(2*Pi/theta):  for k from 1 to n do   a1 := theta*(k-1); a2 := theta*(k);  if( k mod 2 = 0) then col := COLOR(RGB,.8,.3,.5);      else col := COLOR(RGB,.4,.3,.5) ; fi;  A[k] := plottools[pieslice]([0,0], 1, a1..a2, color = col  ):  C[k] := textplot( [ evalf(1.2*cos(a2)), evalf(1.2*sin(a2)),   convert(a2, string)]):  od:  display( seq( {A[k], C[k]}, k = 1..n), scaling=constrained);  end proc:"

 

``


Can anyone help me to figure out my mistake?

Download proc.mw

Please Wait...