for



Something seems fishy here:

(%i1) sp:2;
(%o1)                                  2
(%i2) sm:-2;
(%o2)                                 - 2
(%i3) for i:0 thru 4 step sp do print(i);
0 
2 
4 
(%o3)                                done
(%i4) for i:0 thru -4 step sm do print(i);
(%o4)                                done
(%i5) for i:0 thru -4 step ''sm do print(i);
0 
- 2 
- 4 
(%o5)                                done
(%i6) for i:0 thru -4 step -sp do print(i);
0 
- 2 
- 4 
(%o6)                                done
(%i7) for i:0 thru 4 step -sm do print(i);
(%o7)                                done
(%i8) for i:0 thru 4 step ''-sm do print(i);
(%o8)                                done
(%i9) for i:0 thru 4 step -''sm do print(i);
0 
2 
4 


It does seem to me that there is something inconsistent in the way for()
handles the sign of its stepsize argument.


Viktor

 

-----Original Message-----
From: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu]
On Behalf Of Michel Talon
Sent: Saturday, May 09, 2009 11:38 AM
To: maxima at math.utexas.edu
Subject: Re: [Maxima] for

Adam Majewski wrote:

> for radius:4 thru 1 step -1 do disp(radius);
(%i5) for radius:4 thru 1 step ''s do disp(radius);
                                       4

                                       3

                                       2

                                       1



-- 
Michel Talon

_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima