Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2001
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

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

Search the Archive

Re: Re: Overriding Power

  • To: mathgroup at smc.vnet.net
  • Subject: [mg26926] Re: [mg26868] Re: Overriding Power
  • From: Carl Woll <carlw at u.washington.edu>
  • Date: Fri, 26 Jan 2001 23:30:03 -0500 (EST)
  • References: <94m9e5$3nu@smc.vnet.net> <94oh4k$ee1@smc.vnet.net> <200101260627.BAA18659@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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>



  • Prev by Date: Re: The Integrator (Wolfram)
  • Next by Date: Re: Re: Overriding Power
  • Previous by thread: Re: Overriding Power
  • Next by thread: Re: Re: Overriding Power