On 05/03/2012 12:32 PM, maxima at peutch.e4ward.com wrote:
> I would like to create variables for each of the 2x2 possible states of
> my model. Along the first dimension, the state is either a or b. Along
> the second: x or y.
>
> I started by creating manually:
> variable_ax: 1;
> variable_ay: 33;
> variable_bx: 4;
> variable_by: 50;
>
> What I would like to do is something like being able to assign:
> variable['a]['x] : 1;
> variable['a]['y] : 33;
>
> and so on. But i get an error (assignment: cannot assign to
> (variable['a])['x]).
(%i2) concat('variable_,'a,'x) :: 1;
(%o2) 1
(%i3) concat('variable_,'a,'y) :: 33;
(%o3) 33
(%i4) variable_ax;
(%o4) 1
(%i5) variable_ay;
(%o5) 33
Cheers,
Jaime