while



After your first example, r is now 256, which is greater than 200, hence the
second loop never executes. Make sure you reset r to a desired starting
value before you execute the loop in %i9.


Viktor
 

-----Original Message-----
From: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu]
On Behalf Of Adam Majewski
Sent: Tuesday, May 12, 2009 12:07 PM
To: maxima at math.utexas.edu
Subject: while

Hi,

(similar to previous for)

Here are 2 examples of using while in Maxima :

--------- first ------------------
(%i6) r:2;
(%o6) 2
(%i7) while r<200 do disp(r:r*r);
4
16
256
(%o7) done
------------second -----------------
(%i8) rmax:200;
(%o8) 200
(%i9) while r<rmax do disp(r:r*r);
(%o9) done
---------- end------------------

First works, second not.
Is it something wrong with this second example ?

Regards

Adam

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