Re: Precedence

*To*: mathgroup at smc.vnet.net*Subject*: [mg60284] Re: Precedence*From*: "Carl K. Woll" <carlw at u.washington.edu>*Date*: Sat, 10 Sep 2005 06:46:35 -0400 (EDT)*Organization*: University of Washington*References*: <dfrgpu$fr6$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

"Xerxes" <Xerxes314 at gmail.com> wrote in message news:dfrgpu$fr6$1 at smc.vnet.net... > Hi all, > > I've been writing a package using Mathematica to do lattice > perturbation theory. As a part of my package, I'd like to > define my own matrix multiplication, which I call dotm. Since > CenterDot looks pretty and has no previous assignment, I've > used it as both the input and output format of dotm. However, > I run into problems when I try to type things like > > Y[x].g A[x].Y[x+a] > > where the . should be imagined to be CenterDot. Because the > precedence of the . is higher than the precedence of the > multiplication, this gives (Y.g)(A.Y) instead of Y.(gA).Y. > The way to change the precedences is to edit the file UnicodeCharacters.tr in the directory SystemFiles/FrontEnd/TextResources. Open the file with a text editor, look for CenterDot. One of the entries for CenterDot (in 5.2) is 530, and the same entry for Times is 520. These numbers are the precedences of the operators. Change 530 to something less than 520, such as 510. You may need to reset your preferences. In Windows this is done by holding down Ctrl and Shift when starting Mathematica. These precedence numbers change with different versions so your version may be different. > I know I can attach a TagBox to the CenterDot to force it to > have lower precedence, but that ruins the convenience of typing > esc-.-esc to get the dot. Is there some other way to teach > Mathematica to use a lower precedence? > > Xerxes > Carl Woll Wolfram Research