Re: CirclePlus precedence and bigoplus
- To: mathgroup at smc.vnet.net
- Subject: [mg36320] Re: CirclePlus precedence and bigoplus
- From: "Carl K. Woll" <carlw at u.washington.edu>
- Date: Sat, 31 Aug 2002 01:26:06 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Lucas, An addendum to my previous post (by the way, did you try to change precedences as I recommended?). If you are interested in using something like the normal summation notation, the summation symbol can't be CirclePlus, as CirclePlus is not an extensible character. I don't know all of the extensible characters, but one possibility is \[UnionPlus], which looks a bit like CirclePlus, with an opening on top. Of course, the usual syntax for \[UnionPlus] is as a binary operator, and this is not what we want for our summation notation. So, we need to incorporate new syntactical rules. There are three rules needed here. A rule to convert 2 dimensional input into a mathematica internal expression, a rule to convert the internal expression into a box structure, and a rule to convert the internal expression into a regular CirclePlus expression. I give these three rules below: Clear[MakeExpression] MakeExpression[ RowBox[{UnderoverscriptBox["\[UnionPlus]",RowBox[{i_,"=",k_}],n_],y_}], StandardForm]:= MakeExpression[RowBox[{"BigCirclePlus[",y,",{",i,",",k,",",n,"}]"}],Standard Form] Clear[MakeBoxes] MakeBoxes[BigCirclePlus[y_, {i_, k_, n_}], f_] := RowBox[{UnderoverscriptBox["\[UnionPlus]", RowBox[{MakeBoxes[i, f], "=", MakeBoxes[k, f]}], MakeBoxes[n, f]], MakeBoxes[y, f]}] BigCirclePlus[y_, {i_, k_Integer, n_Integer}] := CirclePlus @@ Table[y, {i, k, n}] As you can see, BigCirclePlus is used in the Mathematica internal representation. If BigCirclePlus can be converted into a CirclePlus expression (when the summation indices are integers), then the BigCirclePlus rule acts. Here are a couple of examples: \!\(\(\[UnionPlus]\+\(i = 1\)\%M g[i]\)\) \!\(\(\[UnionPlus]\+\(i = 1\)\%5 g[i]\/\(1 + h[i]\/5\)\)\) Just copy each of the above expressions into Mathematica and evaluate after evaluating the above rules. Of course, if \[UnionPlus] is not an acceptable substitute for an extensible CirclePlus, then you will just need to petition Mathematica to include such a feature in the future. Carl Woll Physics Dept U of Washington ----- Original Message ----- From: "Carl K. Woll" <carlw at u.washington.edu> To: mathgroup at smc.vnet.net Subject: [mg36320] Re: CirclePlus precedence and bigoplus > Lucas, > > One way to change the precedence of CirclePlus is to change the file > UnicodeCharacters.tr. > > On my machine the file is located under > > ../4.1/SystemFiles/FrontEnd/TextResources > > Open up the file, search for CirclePlus, change the precedence from 450 to > 420, and then save. Of course, it would be wise to make a backup copy of the > file before you make any changes. Also, 420 is low enough to get the > behavior you desire, but you may want to experiment with other precedences. > Then, start mathematica and you will get the behavior you want. > > Carl Woll > Physics Dept > U of Washington > > "Lucas" <lscharen at d.umn.edu> wrote in message > news:ak4dvm$6e$1 at smc.vnet.net... > > Hello, > > > > I'm attempting to implement an abstract mathematica package in > > mathematica that utilized the \[CirclePlus] operator in an unusual > > way. Specifically, the \[CirclePlus] has a precidence lower than + > > and introduces barriers in the computation. So, an expression such as > > > > a + b \[CirclePlus] c + d --> (a+b) \[CirclePlus] (c+d) > > > > The mathematica ouput of > > > > a + d + (b \[CirclePlus] c) is incorrect. I've tried playing with the > > PrecedenceForm[] function, but that does not seem able to produce the > > desired effect. > > > > Also, I would like to introduce a notation like > > > > N > > \[BigCirclePlus] x[[i]] --> x[[1]] \[CirclePlus] x[[2]] \[CirclePlus] > > .... > > i=0 > > > > analagous to summation, but mathematica does not appear to offer the > > CirclePlus in a large format. to relate this to the case above, x[1] > > = (a + b) and > > x[2] = (c + d), so each indexed element is a subexpression. > > > > Finally, I would like to be able to set up the CirclePlus operator > > such that the following algebraic relations hold: > > > > > > \Sum \BigCirclePlus E = \BigCirclePlus \Sum E > > i j ij j i ij > > > > d d > > -- \BigCirclePlus E = \BigCirclePlus -- E > > dx j j j dx j > > > > > > Thanks in advance for any help on the above. > > > > -Lucas Scharenbroich > > -MLS Group / JPL > > > > >