       Re: Problem with Mathematica 6

• To: mathgroup at smc.vnet.net
• Subject: [mg77080] Re: [mg77065] Problem with Mathematica 6
• From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
• Date: Sun, 3 Jun 2007 06:05:27 -0400 (EDT)
• References: <200706020819.EAA29947@smc.vnet.net>

```On 2 Jun 2007, at 17:19, Michael Weyrauch wrote:

> Hello,
>
>   the following code fragment runs under Mathematica 5.2 but
> produces an infinite recursion error in Mathematica 6.0 in certain
> cases:
>
> First I define a number of commands and slightly change the
> built-in command "NonCommutativeMultiply":
> Fermion[a__] := ((Grading[#1] = 1) & ) /@ {a};
> Fermion[a, b];
>
> Unprotect[NonCommutativeMultiply];
> NonCommutativeMultiply[a___] /; (Length[GetGradeds[a]] <= 1) :=
> Times[a];
> Protect[NonCommutativeMultiply];
>
> If you now e.g. evaluate
>
> In:= k ** l
> Out= k*l
>
> or
>
> In:= a ** l
> Out= a*l
>
> BUT in Mathematica 6.0:
>
> In:= a ** b
>
> \$IterationLimit::"itlim" : "Iteration limit of 4096 exceeded. \
> \!\(\*ButtonBox["\[RightSkeleton]",
> ButtonData:>"paclet:ref/message/\$IterationLimit/itlim",
> ButtonFrame->None,
> ButtonNote->"\$IterationLimit::itlim"]\)"
> Out= Hold[(Times[a]) ** b]
>
> However in Mathematica 5.2 one gets
>
> In:= a ** b
> Out=a**b
>
> which is what I expect and I want to have.
>
> I.e., whenever I NonCommutativeMultiply two variables which are
> explicitly declared as fermions by the command Fermion[], I get an
> infinite recursion error in Mathematica 6.
>
> This behaviour of Mathematica 6.0 is rather confusing to me, since
> I believe that I just use very basic and elementary assignments
> in my code. Why shouldn't it work  under Mathematica 6.0 if it
> works under 5.2? It appears that the 6.0 kernel behaves differently
> than the
> 5.2 kernel in such basic situations. Very unpleasant!
>
> (For anyone who wonders about the purpose of  this (strange) code:
> It is a small fragment of a package  that implements the handling
> of Grassmann variables. I just extracted that bit in order to show
> the Mathematica 6.0 problem.)
>
> Furthermore, beyond an explanation of this unexpected behaviour of
> Mathematica 6, I would like to find a workaround in Mathematica 6
> such that I get
> the same result as in Mathematica 5.2.
>
> Thanks for any suggestions.
>
> Michael Weyrauch
>

On of the most basic principles in Mathematica programming, stated,
over the years, a number of times on this list by WRI employees,
(particularly by David Withoff) is if you choose to Unprotect and
modify any built-in functions you can only blame yourself for any
unpleasantness that might occur. The workaround is: don't do it.

One think you can do instead is to do essentially the same thing
without modifying NonCompputativeMultiply. If you want to use a
symbol that looks like multiplication you could choose SmallCircle.
You could then do something like this:

In:= Fermion[a__] := ((Grading[#1] = 1) &) /@ {a};
In:= Fermion[a, b]
Out= {1, 1}
= 0 &];
In:= SmallCircle[z___] /; (Length[GetGradeds[z]] <= 1) := Times[z];
In:= SmallCircle[z___] := NonCommutativeMultiply[z]

In:= SmallCircle[a, l]
Out= a l

SmallCircle[a,b]

In:= SmallCircle[a, b]
Out= a ** b

In:= SmallCircle[a, l, m]
Out= a l m

Of course instead of writing SmallCircle[a,l,m] you can use as
input  a escape sc escape l escape sc escape m .

Andrzej Kozlowski

```

• Prev by Date: Re: Problem with Mathematica 6
• Next by Date: Re: What to do in v. 6 in place of Miscellaneous`RealOnly
• Previous by thread: Re: Re: Problem with Mathematica 6
• Next by thread: Re: Problem with Mathematica 6