On Tue, 22 Dec 2009, Edwin Woollett wrote:
< I am having trouble with keeping local lists unchanged
< in some programming.
<
< I call simp_ddgL (dlist,glist) to do contractions among
< dirac matrices (in glist) and dlist which represents a set of
< D(p,nu) or D(al,be) elements which are all multiplied
< together (lorentz indices except for p).
<
< simp_ddgL returns the list: [ fac, ddlist, gglist ] .
<
< The following illustrates my troubles in an interactive use, where
< the three element list g2 is changed to the contents of gglist.
<
< (%i1) load(dirac);
< (%o1) "c:/work3/dirac.mac"
< (%i2) d1 : [si, be, la, al, p, al];
< (%o2) [si,be,la,al,p,al]
< (%i3) g1 : [be, rh, ta];
< (%o3) [be,rh,ta]
<
< /* make a copy of g1 for later use */
<
< (%i4) g2 : g1;
Try
g2 : copylist(g1);
instead. Your assignment creates g2 as an alias for g1,
whereas you want to copy g1.
Leo
< (%o4) [be,rh,ta]
< (%i5) g2;
< (%o5) [be,rh,ta]
<
< /* now call simp_ddgL */
<
< (%i6) rr : simp_ddgL (d1, g1);
< (%o6) [ 1, [p, la], [si, rh, ta ] ]
<
< (%i7) d11 : rr[2];
< (%o7) [p, la]
< (%i8) g11 : rr[3];
< (%o8) [si, rh, ta]
<
< /* now check g2 assignment */
<
< (%i9) g2;
< (%o9) [si, rh, ta]
<
< -------------
< How does the assignment of g2 get
< changed in this scenario??
<
< Thanks for any help,
<
< Ted Woollett
<
<
< _______________________________________________
< Maxima mailing list
< Maxima at math.utexas.edu
< http://www.math.utexas.edu/mailman/listinfo/maxima
<
<
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.