Re: Re: Overriding Power

*To*: mathgroup at smc.vnet.net*Subject*: [mg26966] Re: [mg26868] Re: Overriding Power*From*: "Carl K. Woll" <carlw at u.washington.edu>*Date*: Tue, 30 Jan 2001 03:38:17 -0500 (EST)*References*: <94m9e5$3nu@smc.vnet.net> <94oh4k$ee1@smc.vnet.net> <200101260627.BAA18659@smc.vnet.net> <6SJc6.6841$nn4.184149@ralph.vnet.net> <frumple*NOSPAM*-65C139.12194828012001@news>*Sender*: owner-wri-mathgroup at wolfram.com

Jeff, Ok, I didn't want to mention this possibility before, as it is a bit risky. However, I tried it, and it seems to work. Find the file UnicodeCharacters.tr. In my Windows installation, it can be found in the directory: Program Files\Wolfram Research\Mathematica\4.0\SystemFiles\FrontEnd\TextResources If you take a look at the contents of this file, you will find information listed for each character that can be entered into Mathematica. In particular, you should look for the entry under the operators you are interested in, such as \[Wedge], which includes the precedence of that operator. For example, the precedence of \[Wedge] is 560, and the precedence of \[CircleDot] is 605. If you change the 560 to 607, then restart Mathematica, you will find that the input a \[CircleDot] b \[Wedge] c will be interpreted as a \[CircleDot] (b \[Wedge] c), showing that on input, \[Wedge] does have higher precedence. On the other hand, the printed output obviously still considers \[CircleDot] to have higher precedence than \[Wedge], as is evidenced by the paranthesis. I haven't investigated how to change this, although PrecedenceForm may be the way to do so. Of course, before you make any changes to this file, you should probably save an old copy somewhere just in case you accidentally render it, and Mathematica, unuseable. Also, it doesn't appear that you can change the precedence of the operators which have built in meanings, like +,.,*, etc., as they are not included in UnicodeCharacters.tr. Good luck. Carl Woll Physics Dept U of Washington ----- Original Message ----- From: "Jeff Hersh" <frumple*NOSPAM* at home.com> To: mathgroup at smc.vnet.net Subject: [mg26966] Re: [mg26868] Re: Overriding Power > Carl, > > The problem is that I am trying to mimic the standard notation that is > used for Geometric Algebra. The precedence is as follows... > > Outer Products (designated by \[Wedge]) > Inner Products (designated by \[Dot]) > Commutator and Scalar Products (designated by \[CircleTimes] and > \[CircleDot] respectfully). > Geometric Product (designated by white space, i.e. \[Times]). > > I know you can force different parethesiation via PrecedeceForm for > individual items but this doesn't seem to work in general. > > Jeff > > > In article <6SJc6.6841$nn4.184149 at ralph.vnet.net>, Carl Woll > <carlw at u.washington.edu> wrote: > > > Jeff, > > > > I don't know how to change the precedence of a function, but why don't > > you use > > a built in operator which already has the precedence you want. For > > example, if > > you want to have a function whose precedence is greater than > > NonCommutativeMultiply, you could look up in help for precedence, which > > will > > lead you to section A.2.7. Section A.2.7 contains a list of the > > precedences of > > all the built in operators. You will see that there are two built in > > operators, > > SmallCircle and CircleDot which carry a higher precedence than > > NonCommutativeMultiply and which have no built in definitions. Hence, we > > have > > > > a**b\[SmallCircle]c//FullForm > > > > NonCommutativeMultiply[a, SmallCircle[b, c]] > > > > Since SmallCircle has no built in definitions, simply give it the > > definitions > > you want. > > > > Carl Woll > > Physics Dept > > U of Washington > > > > Jeff Hersh wrote: > > > > > In article <94oh4k$ee1 at smc.vnet.net>, Roland Franzius > > > <Roland.Franzius at uos.de> wrote: > > > > > > > Jeff Hersh wrote: > > > > > > > > > I am working on a package that deals with non-communative > > > > > multiplication > > > > > and I have run into a problem with the Power function. As we know > > > > > Power[a b,n] (where n is an integer) automatically gets converted > > > > > to > > > > > Power[a,n] Power[b,n]. However, with non-communative multiplication > > > > > (I > > > > > have removed the Orderless attribute from Times to make it > > > > > non-communative) this isn't valid. Is there any way I can stop > > > > > Mathematica from automatically doing this conversion? > > > > > > > > Hi Jeff, > > > > I recommend to avoid overloading the existing algebraic functions > > > > with > > > > arguments from a noncommutive algebra. Write your own functions and > > > > use > > > > Format for pretty printing the results. Especially for Power, Exp > > > > there > > > > are MatrixPower, MatrixExp which have build features you are > > > > requiring. > > > > > > > > regards, Roland > > > > > > In that case does anyone know how to change the precedence of a > > > function > > > so it is parenthesied correctly? In other words I want the power > > > function to have the same precedence as Power. > > > > > > Jeff > > > -- > > > Jeffrey Hersh,PhD > > > > > > Remove the *NOSPAM* to reply. > > > > > > <insert amusing quote here> > > > > > > > -- > Jeffrey Hersh,PhD > > Remove the *NOSPAM* to reply. > > <insert amusing quote here>

**References**:**Re: Overriding Power***From:*Jeff Hersh <frumple*NOSPAM*@home.com>