Re: Problem with Mathematica 6
- To: mathgroup at smc.vnet.net
- Subject: [mg77131] Re: Problem with Mathematica 6
- From: "Michael Weyrauch" <michael.weyrauch at gmx.de>
- Date: Mon, 4 Jun 2007 03:55:54 -0400 (EDT)
- References: <200706020819.EAA29947@smc.vnet.net> <f3u49k$2sf$1@smc.vnet.net>
Hello, in any case the suggestion of Carl Woll fixes the problem with Mathematica 6. With HoldPattern[NonCommutativeMultiply][a___] /; (Length[GetGradeds[a]] <= 1) := Times[a]; the code behaves under Mathematica 6 as it did without HoldPattern under 5.2 . It appears that the interpretation of the Attributes Flat and/or OneIdentity changed from 5.2 to 6.0. What is the reason? Obviously the HoldPattern prevents evaluation of the Head NonCommutativeMultiply for pattern matching purposes. The evaluation which seems to take place -- as Carl Woll points out -- is the following NonCommutativeMultiply[a,b] -> NonCommutativeMultiply[NonCommutativeMultiply[a],b] which is kind of a reversal of the flattening process I expected to be implied by the Attribute Flat ... (and this not surprisingly leads to infinite iteration in my code) Can anyone explain to me why this "new" behaviour of Flat/OneIdentity is more logical, useful, better? (by the way: the proposal by David Bailey, which circumvents this problem entirely, is probably a much better way of implementation, but I haven't checked the details yet.) Michael Weyrauch
- References:
- Problem with Mathematica 6
- From: "Michael Weyrauch" <michael.weyrauch@gmx.de>
- Problem with Mathematica 6