Question

Is there a way in Maxima to assign values to a list of variables? Say I have two lists:

var : [a, b, c]; val : [1, 2, 3];

... and I want to assign 1 to a, 2 to b etc. Of course by iterating over the lists somehow, not "manually", i.e. a : 1; b : 2 ...

Thanks!

Was it helpful?

Solution

Use the :: operator.

(%i4) x : '[a, b, c];
(%o4)                       [a, b, c]
(%i5) x :: [11, 22, 33];
(%o5)                     [11, 22, 33]
(%i6) a;
(%o6)                          11
(%i7) b;
(%o7)                          22
(%i8) c;
(%o8)                          33
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top