Re: Re: Overriding Power
- To: mathgroup at smc.vnet.net
- Subject: [mg26924] Re: [mg26869] Re: [mg26808] Overriding Power
- From: Carl Woll <carlw at u.washington.edu>
- Date: Fri, 26 Jan 2001 23:30:02 -0500 (EST)
- References: <200101240918.EAA03605@smc.vnet.net> <94ohvc$efs@smc.vnet.net> <200101260627.BAA18664@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Jeff, I don't know how to remove whitespace and replace it with **. How about using a different character other than whitespace in your input. For example, suppose you decide that noncommutative multiplication should be input using a period, and the usual Dot function should be input using two periods. This can be accomplished by using InputAutoReplacements. To do this, go to the option inspector, and type InputAutoReplacements in the lookup box. Then change the selection at the top to Notebook. In the InputAutoReplacements box put in {"."->"**", ".."->"."}, apply it and close the inspector. Now, try typing a.b and a..b and see what Mathematica does to the input. As soon as the b is typed, Mathematica instantly changes a.b to a**b and a..b to a.b. Try it and let me know if this is the sort of thing you were looking for. Carl Woll Physics Dept U of Washington Jeff Hersh wrote: > In article <94ohvc$efs at smc.vnet.net>, Daniel Lichtblau > <danl at wolfram.com> wrote: > > > Jeff Hersh wrote: > > > > > > Hello, > > > > > > 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? > > > > > > Jeff > > > -- > > > Jeffrey Hersh,PhD > > > > > > Remove the *NOSPAM* to reply. > > > > > > <insert amusing quote here> > > > > This is a known bug (I reported it in-house around four years ago). > > > > In[5]:= (a*b)^3 > > > > 3 3 > > Out[5]= a b > > > > In some ways I am happy to see this bug remain alive. The reason is > > that, while it is well and good for us to pretend that ordered Times is > > fully supported, in actual fact this is essentially impossible to do. > > Changing attributes of low-level arithmetic functions is problematic, > > and the better we appear to support it, the more likely are users to > > encounter really unobvious problems. > > > > We generally advocate using e.g. NonCommutativeMultiply with rules > > attached to support scalar multiplication, powers, commutators, and > > whatever else is required for your particular needs. > > > > > > Daniel Lichtblau > > Wolfram Research > > > > In that case is there a way, either by the Notation utility or some > other means, to remove white space as Times and make it > NonCommunativeMultiply? In other words I want a b = > NonCommunitiveMultiply[a,b] not Times[a,b]. > > FYI, so far I have just removed the attribute Orderless from Times and > it works fine except in the case of powers. > > Jeff > -- > Jeffrey Hersh,PhD > > Remove the *NOSPAM* to reply. > > <insert amusing quote here>
- References:
- Overriding Power
- From: Jeff Hersh <frumple*NOSPAM*@home.com>
- Re: Overriding Power
- From: Jeff Hersh <frumple*NOSPAM*@home.com>
- Overriding Power