Skip to main content
10 events
when toggle format what by license comment
May 12, 2012 at 14:22 comment added celtschk Note that if the functions were written with commutative multiplication in mind, there's a high probability that they don't work correctly for non-commutative multiplication (for example, they may implicitly rely on the binomial formula $(a+b)(a-b) = a^2-b^2$ which doesn't hold for non-commutative algebras; there it's $(a+b)(a-b) = a^2-b^2-[a,b]$ where $[a,b] = ab-ba$ denotes the commutator between $a$ and $b$, which of course vanishes for commutative multiplication).
May 12, 2012 at 14:14 history edited Szabolcs CC BY-SA 3.0
added 4 characters in body
May 11, 2012 at 13:38 comment added gpap For the record, I am in no way affiliated with the NCAlgebra people :) I just tried their package and it saved my life so I'm gathering karma points really.
May 11, 2012 at 13:34 comment added gpap Hmmm - you still could use NCAlgebra in this case while using the same function definitions. You'd have to use a rule /. Times -> NonCommutativeMultiply (which, granted, is what you are trying to avoid) on all your functions and then define whichever variables you want to be either commuting or noncommuting via SetCommutative, SetNonCommutative. Assuming expressions of the form (1-q)(a b) for q real, a,b noncommuting, haven't come from, say, a**b - q b**a - which would be a problem you'd have anyway - you can save yourself some time..
May 11, 2012 at 12:38 comment added jVincent Naturally, but lets assume you have a large collection of functions that do things like f[a_,b_]:=a+b-b^2-b*a, or similar. Suddenly all of these expression would obay the nocommutativity of the newly defined matrix objects, if you called f[matrix[a],matrix[b]]. Really what I want is to have the evaluation depending on the upvalues of the members, but that's not possible, since Times is orderless independent of what it's used on.
May 11, 2012 at 11:27 comment added gpap I see - in that case my answer is useless. So, in your example above, if you wanted multiplication over Z4 you would define a z4 "times" that would give you z4[a] z4[b]=Mod[a,b,4] but in your case wouldn't that transpose the problem into defining all your elements of z4 in an expression?
May 11, 2012 at 10:56 comment added jVincent No, what triggered my question is just the annoyance at the fact that Times being defined as orderless in general makes it seamingly impossible to make it non orderless in individual cases based no the elements. Mathematically the communicative nature of multiplication is dependent on the elements, not the operator, I was hoping for some clever fix that didn't involve hunting down every single occurance of times, and replacing it, or blocking it out in order to retain order information.
May 11, 2012 at 10:51 comment added gpap Yes, this is correct. But Mathematica cannot handle expansions in NonCommutativeMultiply and you'd need to type long expressions with **s yourself. I thought that's what triggered the question in the first place (?)
May 11, 2012 at 10:45 comment added jVincent Looking thought the example notebooks from this package, it appears that they just use NonCommutativeMultiply exclusively, and provide an external framework for doing other manipulations.
May 11, 2012 at 10:24 history answered gpap CC BY-SA 3.0