MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Precedence question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119233] Re: Precedence question
  • From: David Bailey <dave at removedbailey.co.uk>
  • Date: Wed, 25 May 2011 19:32:55 -0400 (EDT)
  • References: <irijqf$qfi$1@smc.vnet.net>

On 25/05/2011 10:57, Arturas.Acus at tfai.vu.lt wrote:
> Dear Group
>
> In order to implement some geometric algebra code I need
> to reverse the order of the following operators which have no built in
> meaning:
>
> Precedence/@{NonCommutativeMultiply,Wedge,CenterDot}
>
> Acording to geometric algebra rules the highest precedence has inner
> product operator  (I plan to use CenterDot symbol to denote this),
> then goes Wedge (outer multiplication) and last is geometric product
> (will definetely use NonCommutativeMultiply for that)
>
> Because of Mathematica predefined precedences the following input
>
> MV[a]\[Wedge]MV[b]\[CenterDot]MV[c]**MV[d]//FullForm
>
> is interpreted as
>
> CenterDot[Wedge[MV[a],MV[b]],NonCommutativeMultiply[MV[c],MV[d]]]
>
> whereas I need
>
> NonCommutativeMultiply[Wedge[MV[a],CenterDot[MV[b],MV[c]]],MV[d]]]
>
>
> Few hours of Mathematica documentation reading did not yield any simple solution.
>
> Sure, instead of operators with no build in meaning I can use symbols
> with user precedence level  ( for example  \[RawWedge] instead of
> \[Wedge]).
>    The problem then is to define proper Infix INPUT notation+ alias.
> This can be done with Notation package, hovewer this is what I would
> like to avoid, because the task becomes complicated from the very
> begining.
>
>
> Could anybody suggest more simple alternative?
>
>
> Sincerely, Arturas Acus
>

One possible approach would be to supply your expressions as strings, 
and then use StringReplace to replace the operator characters with 
another set with the correct order of precedences (and no built-in 
meaning). Then you could use ToExpression on the result, and work from 
there.

David Bailey
http://www.dbaileyconsultancy.co.uk


  • Prev by Date: Re: Problem with Simplify and Assumptions
  • Next by Date: Re: External software
  • Previous by thread: Precedence question
  • Next by thread: Re: Precedence question