I want a small utility function which will take four numbers or symbols
and assign then to, say, p4 (a particle 4-momentum) so that Maxima
knows that p4[0] ---> E, p4[1] ---> 0, p4[2] ----> 0,
and p4[3] ---> p, for example.
The following is too innocent, I guess, perhaps
the wrong way to assign values to hashed array
elements? Must I do something more elaborate?
----------------------------------------------------
(%i1) display2d:false$
(%i2) def4vec (a, a0, a1, a2, a3) := block (
a[0] : a0,
a[1] : a1,
a[2] : a2,
a[3] : a3 )$
(%i3) def4vec (p4, E, 0, 0, p)$
(%i4) p4[0];
(%o4) p4[0]
(%i5) p4[1];
(%o5) p4[1]
-----------------------
What array machinery can I use for this job?
Thanks in Advance,
Ted Woollett