Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #2700 > unrolled thread

Precedence question

Started byArturas.Acus@tfai.vu.lt
First post2011-05-25 09:57 +0000
Last post2011-05-25 23:32 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Precedence  question Arturas.Acus@tfai.vu.lt - 2011-05-25 09:57 +0000
    Re: Precedence  question David Bailey <dave@removedbailey.co.uk> - 2011-05-25 23:32 +0000

#2700 — Precedence question

FromArturas.Acus@tfai.vu.lt
Date2011-05-25 09:57 +0000
SubjectPrecedence question
Message-ID<irijqf$qfi$1@smc.vnet.net>
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















[toc] | [next] | [standalone]


#2712

FromDavid Bailey <dave@removedbailey.co.uk>
Date2011-05-25 23:32 +0000
Message-ID<irk3it$79b$1@smc.vnet.net>
In reply to#2700
On 25/05/2011 10:57, Arturas.Acus@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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web