Re: Why is NonCommutativeMultiply Protected?
- To: mathgroup at smc.vnet.net
- Subject: [mg82726] Re: Why is NonCommutativeMultiply Protected?
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Tue, 30 Oct 2007 03:21:28 -0500 (EST)
- References: <email@example.com>
Szabolcs Horvát wrote: > Why is NonCommutativeMultiply Protected? > > Is it safe to redefine NonCommutativeMultiply? Does it have any special > built-in properties (apart from being Flat and OneIdentity)? Is it used > by any of the built-in functions? > > NonCommutativeMultiply certainly does not evaluate to anything, but the > same can be said about Rule, which is not at all safe to redefine > because: 1. It has some special properties (it affects scoping, it does > not like Unevaluated, etc.) 2. It is used together with functions > such as Replace, and (most probably) built-in functions use it internally. > > So is it safe to Unprotect[NonCommutativeMultiply] and attach > definitions to it? (I know that in certain situations one can use > UpValues, but I would like to know the answer to this question.) > Yes, NonCommutativeMultiply is meant for user use, so go ahead and Unprotect it. It is, however, extremely ugly, and might get confused with the Fortran exponentiation operator! I prefer to use CircleTimes, or another built-in operator and give it the same attributes as NonCommutativeMultiply. David Bailey http://www.dbaileyconsultancy.co.uk