Re: assumption, supposition?
- To: mathgroup at smc.vnet.net
- Subject: [mg15356] Re: [mg15331] assumption, supposition?
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Sat, 9 Jan 1999 23:58:18 -0500
- Sender: owner-wri-mathgroup at wolfram.com
On Fri, Jan 8, 1999, Erk Jensen <Erk.Jensen at cern.ch> wrote: >Probably I'm looking up the wrong keyword in Mathematica help, but I >can't find what I'm looking for. Maybe that's because I've learned >those expressions in german... > >My problem: > >I want Mathematica to assume that a certain condition is satisfied for >the following algebraic transformations. More specifically: Let rho >describe a radius coordinate. I know it is not negative real. So, for >transformations of expressions containing rho, e.g. Sqrt[rho^2], I >want assure Mathematica that 0 <= rho is in fact satisfied, and that it >is consequently allowed to replace Sqrt[rho^2] by rho. How do I do >that? > >My solution was > >Unprotect[Sqrt]; Sqrt[rho_^2] := rho/; 0 <= rho; Protect[Sqrt]; > >rho /: 0 <= rho = True; > >and this seems to work, but I wonder whether this is really the proper >way. Since the TagSet I'm using here assigns the whole statement to >rho, and ?rho results in > >Global`rho >rho /: 0 <= rho = True > >so I still have my doubts ... > >Can some of you experts enlighten me? > >Thanks in advance > -erk- It seems to me there is nothing wrong with what you are doing, but it is rather limited. While indeed Sqrt[rho^2] will now return rho, (rho^2)^(1/2) , (rho^3)^(1/3) will all behave as before. So you need to modify the behaviour of Power rather than Sqrt. However, it seems to me that the simplest way to achieve what you want is by using Abs[rho] in place of rho in your formulas and then replacing Abs[rho] by rho in the final output. Mathematica knows that (Abs[rho]^2)^(1/2) is Abs[rho] etc. Andrzej Kozlowski Toyama International University JAPAN http://sigma.tuins.ac.jp/ http://eri2.tuins.ac.jp/