Re: Re: Overriding Power
- To: mathgroup at smc.vnet.net
- Subject: [mg26897] Re: [mg26869] Re: [mg26808] Overriding Power
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Fri, 26 Jan 2001 23:29:43 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
How about: In[1]:= ClearAttributes[Times, Orderless] In[2]:= Expand[(a + b) c] Out[2]= c a + c b ? (Some year ago I tried to do exactly what you are doing and David Withoff showed me this simple example). -- Andrzej Kozlowski Toyama International University JAPAN http://platon.c.u-tokyo.ac.jp/andrzej/ http://sigma.tuins.ac.jp/ on 01.1.26 3:27 PM, Jeff Hersh at frumple*NOSPAM* at home.com 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