Re: Preventing Times[x,x] from becoming Power[x,2]
- To: mathgroup at smc.vnet.net
- Subject: [mg53668] Re: [mg53661] Preventing Times[x,x] from becoming Power[x,2]
- From: yehuda ben-shimol <benshimo at bgumail.bgu.ac.il>
- Date: Sat, 22 Jan 2005 03:51:51 -0500 (EST)
- References: <200501211137.GAA01454@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Josef Karthauser wrote: >I was wondering whether anyone knows the answer to this one. > >I've got a function, let's call it F[...]. If I enter F[s] F[s] >into mathematica it "simplifies" the resulting expression, making it >become Power[F[s],2]. Is there any way to prevent this automatic >simplification on F[] objects? > >Joe > > You can use upvalues and HoldForm[] f[x_] f[x_]^=HoldForm[f[x] f[x]] Now when you use it as in f[a+b+c] f[a+b+c] it will not be simplified to f[a+b+c]^2 and will be displayed as you wanted yehuda
- References:
- Preventing Times[x,x] from becoming Power[x,2]
- From: Josef Karthauser <joe@tao.org.uk>
- Preventing Times[x,x] from becoming Power[x,2]