From: Zbigniew Komarnicki on 7 Jul 2010 12:40 Hello, I try to write fuction that return a list of number in range [a,b] with step k, but first i try in command window this code: /* This work in command window without variables */ kill(all); m:[]; for i:0 step -3 thru 10 do (m:append(m, [i]), display(i)); display(m); Here is OK, but this below is not OK: /* This does NOT work in command window with variables */ kill(all); a:0; b:10; k:-3; m:[]; for i:a step k thru b do (m:append(m, [i]), display(i)); display(m); /* here is the intresting the output */ (%i7) for i:a step k thru b do (m:append(m, [i]), display(i)); i = 0 i = - 3 i = - 6 .... and so on. I work in Linux, Debian Lenny i386 with this version of Maxima: Maxima 5.13.0 http://maxima.sourceforge.net Using Lisp GNU Common Lisp (GCL) GCL 2.6.7 (aka GCL) Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. This is a development version of Maxima. The function bug_report() provides bug reporting information. (%i1) build_info(); Maxima version: 5.13.0 Maxima build date: 22:7 9/5/2008 host type: i686-pc-linux-gnu lisp-implementation-type: GNU Common Lisp (GCL) lisp-implementation-version: GCL 2.6.7 (%o1) -- To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org Archive: http://lists.debian.org/201007071831.35168.cblasius(a)gmail.com
From: Mario Rodriguez on 7 Jul 2010 14:10 Zbigniew Komarnicki escribi�: > Hello, > > I try to write fuction that return a list of number in range [a,b] with step > k, but first i try in command window this code: > > /* This work in command window without variables */ > kill(all); > m:[]; > for i:0 step -3 thru 10 do (m:append(m, [i]), display(i)); > display(m); > > Here is OK > If you want to reach 10, shouldn't step be a positive number? -- Mario -- To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org Archive: http://lists.debian.org/4C34BD7E.5000006(a)telefonica.net
From: Zbigniew Komarnicki on 7 Jul 2010 14:30 On Wednesday 07 of July 2010 19:46:38 you wrote: > Zbigniew Komarnicki escribió: > > Hello, > > > > I try to write fuction that return a list of number in range [a,b] with > > step k, but first i try in command window this code: > > > > /* This work in command window without variables */ > > kill(all); > > m:[]; > > for i:0 step -3 thru 10 do (m:append(m, [i]), display(i)); > > display(m); > > > > Here is OK > > If you want to reach 10, shouldn't step be a positive number? Thank you. No, I try exactly from 0 to 10 with step -3. I know that it should be empty list (empty matrix I got in octave, see below) Form 0 to 10 with step 3 it work excellent - there is no problem. (%i1) m:[]$ (%i2) for i:0 step 3 thru 10 do (m:append(m, [i]), display(i))$ i = 0 i = 3 i = 6 i = 9 (%i4) display(m)$ m = [0, 3, 6, 9] The problem is when I go with 0 to 10 with -3 or in general when: a < b and k is negative number. In Octave I write something like: From 0 to 10 with step -3 I got empty matrix in octave: octave:1> 0:-3:10 ans = [](1x0) I got empty matrix it is correct. From 0 to 10 with step 3 I got as expected octave:2> 0:3:10 ans = 0 3 6 9 I got results as expected. The problem in Maxima is when we use variables: a:0; b:10; k:-3; m:[]; and write the code: for i:a step k thru b do (m:append(m, [i]), display(i))$ This loop shouldn't execute, but this loop go forever (!!!) writing: i=0, i=-3, i=-6, ..., i=infinity, but when I write this same code with numbers in the loop, it work as expected: m:[]; for i:0 step -3 thru 10 do (m:append(m, [i]), display(i))$ display(m)$ m = [] and the result is empty list m=[]. > -- > Mario -- To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org Archive: http://lists.debian.org/201007072023.20380.cblasius(a)gmail.com
From: Zbigniew Komarnicki on 7 Jul 2010 15:00 On Wednesday 07 of July 2010 20:20:19 Raymond Toy wrote: > > kill(all); > > m:[]; > > for i:0 step -3 thru 10 do (m:append(m, [i]), display(i)); > > display(m); > > What were you expecting? I get m being an empty list. Empty list is OK. > > /* This does NOT work in command window with variables */ > > kill(all); > > a:0; > > b:10; > > k:-3; > > m:[]; > > for i:a step k thru b do (m:append(m, [i]), display(i)); > > display(m); This code not work in Debian Lenny, because this loop shouldn't execute! In Debian it go forever. It is a bug in a stable system and stable Maxima (I know in Debian every thing is very old but should be stable and very well tested). > > > I work in Linux, Debian Lenny i386 with this version of Maxima: > > > > Maxima 5.13.0 http://maxima.sourceforge.net > > That's pretty ancient, even by maxima standards. :-) I know that is very old, but I try compile in Debian (Lenny) Maxima from source, but without success. First, the GCL in Debian is not compiled with ANSI standard, so, I download the latest GCL from ftp://ftp.gnu.org/pub/gnu/gcl/gcl-2.6.7.tar.gz and compiled it with ANSI (--enable-ansi), but there was some errors. So I couldn't go. Maybe is here somebody who will be show me and maybe others how to compile GCL from source and then Maxima from source the latest version? http://sourceforge.net/projects/maxima/files/Maxima-source/5.21.1-source/maxima-5.21.1.tar.gz/download Maybe is there any how to, step by step what should be installed first and what options should be used to compile first GCL and then Maxima especially in Debian Lenny? Thank you for any help. > FWIW, I don't have this problem with your second example. I get m being > the empty list. Yes this is correct answer but not in Debian Lenny Maxima. Thank you. > Ray Zbigniew > _______________________________________________ > Maxima mailing list > Maxima(a)math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima -- To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org Archive: http://lists.debian.org/201007072058.23325.cblasius(a)gmail.com
From: Camm Maguire on 8 Jul 2010 17:40 Greetings! Zbigniew Komarnicki <cblasius(a)gmail.com> writes: > On Wednesday 07 of July 2010 20:20:19 Raymond Toy wrote: > >> > kill(all); >> > m:[]; >> > for i:0 step -3 thru 10 do (m:append(m, [i]), display(i)); >> > display(m); >> >> What were you expecting? I get m being an empty list. > > Empty list is OK. > >> > /* This does NOT work in command window with variables */ >> > kill(all); >> > a:0; >> > b:10; >> > k:-3; >> > m:[]; >> > for i:a step k thru b do (m:append(m, [i]), display(i)); >> > display(m); > > This code not work in Debian Lenny, because this loop shouldn't execute! > In Debian it go forever. It is a bug in a stable system and stable Maxima (I > know in Debian every thing is very old but should be stable and very well > tested). > >> >> > I work in Linux, Debian Lenny i386 with this version of Maxima: >> > >> > Maxima 5.13.0 http://maxima.sourceforge.net >> >> That's pretty ancient, even by maxima standards. :-) > > I know that is very old, but I try compile in Debian (Lenny) Maxima from > source, but without success. First, the GCL in Debian is not compiled with > ANSI standard, so, I download the latest GCL from > ftp://ftp.gnu.org/pub/gnu/gcl/gcl-2.6.7.tar.gz > and compiled it with ANSI (--enable-ansi), but there was some errors. So I > couldn't go. > apt-get install gcl GCL_ANSI=t gcl gives ansi gcl promt, and export GCL_ANSI=t ; cd maxima-5.13.0 ; ./configure --enable-gcl && make or apt-get -q source maxima cd maxima-5.13.0 ; debian/rules build Take care, > Maybe is here somebody who will be show me and maybe others how to compile GCL > from source and then Maxima from source the latest version? > http://sourceforge.net/projects/maxima/files/Maxima-source/5.21.1-source/maxima-5.21.1.tar.gz/download > > Maybe is there any how to, step by step what should be installed first and > what options should be used to compile first GCL and then Maxima especially > in Debian Lenny? > > Thank you for any help. > >> FWIW, I don't have this problem with your second example. I get m being >> the empty list. > > Yes this is correct answer but not in Debian Lenny Maxima. > > Thank you. > >> Ray > > Zbigniew > >> _______________________________________________ >> Maxima mailing list >> Maxima(a)math.utexas.edu >> http://www.math.utexas.edu/mailman/listinfo/maxima > > _______________________________________________ > Maxima mailing list > Maxima(a)math.utexas.edu > http://www.math.utexas.edu/mailman/listinfo/maxima > > > > -- Camm Maguire camm(a)maguirefamily.org ========================================================================== "The earth is but one country, and mankind its citizens." -- Baha'u'llah -- To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org Archive: http://lists.debian.org/87pqyxvfx8.fsf(a)maguirefamily.org
|
Next
|
Last
Pages: 1 2 Prev: missing bluetooth headset support in Ekiga in Squeeze Next: Key logger |