Stumped by infinite loop in Maxima 5.13.0 (using wxMaxima 0.7.3a)



On Dec 6, 2007 5:14 PM, George Leeman <george.leeman at sbcglobal.net> wrote:

> If I define the function
>  nonzerosines(m):=
>    block([h,i,j,s],
>      s:[],h:2*m-1,
>      for i:1 thru h do
>        s:cons(makelist(0,j,1,m),s),
>      for i:1 thru h do
>        if sin(i*%pi/2)#0 then do s[i][1]:sin(i*%pi/2),
>      return(s));
> then running 'nonzerosines(1)' produces an infinite loop


"do" is the loop operator in Maxima ("for", "while", and "unless" modify
"do"); "do xxx" is equivalent to "while true do xxx".

You should write simply

       if sin(i*%pi/2)#0 then s[i][1]:sin(i*%pi/2),

Let us know if you have other difficulties.

        -s