[Maxima] Dynamically declare variables

Viktor T. Toth vttoth at vttoth.com
Wed May 9 08:31:01 CDT 2007


Try

	apply('declare, [concat('K, i, j, k), constant]);


Viktor
 

-----Original Message-----
From: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu]
On Behalf Of ptomaine
Sent: Wednesday, May 09, 2007 7:51 AM
To: maxima at math.utexas.edu
Subject: [Maxima] Dynamically declare variables

Hello.

I am a newbie to Maxima and I have a question.

I have a lot of variables: K111, K112, K113, K121, etc. And want to
declare all of them constant.

But running

for i : 1 thru 3 do
    for j : 1 thru 3 do
        for k : 1 thru 3 do
                declare( concat('K, i, j, k), constant );

Fails with

   Improper argument to declare:
   concat('K, i, j, k)
    -- an error.  To debug this try debugmode(true);

What is correct way to achive the same result as with the following?

declare( K111, constant );
declare( K112, constant );
....
declare( K333, constant );

Thanks in advance, ptomaine//
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima


More information about the Maxima mailing list