From: abpetrov <abpetrov@uf...>  20130807 02:53:18

06.08.2013 22:34, Rainer Schöpf пишет: > On Tue, 6 Aug 2013 at 14:32 0000, abpetrov wrote: > > > > > Hi, > > > > I tried to define rules for working with fermi operators. Here is > > the corresponding program: > > > > load_package noncom2; > > > > operator a,ac; > > noncom a,a; > > noncom ac,ac; > > noncom a,ac; > > > > for all i let a(i)*ac(i) = 1  ac(i)*a(i); > > for all i,j such that i neq j let a(i)*ac(j) = ac(j)*a(i); > > for all i,j let a(i)*a(j) = a(j)*a(i); > > for all i,j let aс(i)*aс(j) = aс(j)*aс(i); > > > > operator anticom; > > for all x,y let anticom(x,y) = x*y + y*x; > > > > > > But when I make attempt calculate an anticommutator like > > > > anticom( ac(i)*a(j), a(k)); > > > > I got error message > > > > Segmentation fault > > > > What is wrong in my rules? > > Your rules cause an infinite recursion. For example, > > a(i)*a(j) => a(j)*a(i) =>  (a(i)*a(j)) => ((a(j)*a(i) )) .... > > One possiblity to apply the rule only once is to depend on the order of the > variables: > > for all i,j such that ordp(i,j) let a(i)*a(j) = a(j)*a(i); > for all i,j such that ordp(i,j) let aс(i)*aс(j) = aс(j)*aс(i); > > Regards, > Rainer thank you 