Re: Distributing square-root (1/2) power through exponential equation
- To: mathgroup at smc.vnet.net
- Subject: [mg101322] Re: Distributing square-root (1/2) power through exponential equation
- From: pfalloon <pfalloon at gmail.com>
- Date: Wed, 1 Jul 2009 06:34:52 -0400 (EDT)
- References: <h2cprm$agj$1@smc.vnet.net>
On Jun 30, 8:36 pm, Steven Matthew Anderson <AdAstr... at mac.com> wrote: > I'm playing with normal distributions, Two random points 1 and 2 with x and y coordinates given by: > > px1=PDF[NormalDistribution[Mu,Sx],X1] > px2=PDF[NormalDistribution[Mu,Sx],X1] > py1=PDF[NormalDistribution[Mu,Sy],Y1] > py2=PDF[NormalDistribution[Mu,Sy],Y2] > > The square of the Euclidean Distance between them is > > SqD = (px2-px1)^2+(py2-py1)^2 > > Take the square root and expand of that to get > > Dist = Sqrt[Expand[SqD]] > > Now the question: > > How do I get the square root to act just like another power so I can simplify this mess? I have tried PowerExpand, FullSimplify, Expand, Simplify, and various combinations. Not sure what I'm missing here. I think the general answer is that you CAN'T get square root to behave like "just another power" -- if by that you mean an integer power. For example: Sqrt[x^2] is NOT the same thing as x (try x=-1), and it is one of the great advantages of Mathematica's implementation that this distinction is carefully respected. More generally, branch cuts of complex-valued functions are handled in a consistent manner, which can lead to some bewildering expressions in simple cases, but can be extremely powerful. One thing that you may find useful is to provide Assumptions when you think that will help to simplify an expression. So, in the trivial case I just mentioned, if x > 0 then you can get Mathematica to simplify appropriately: Simplify[Sqrt[x^2], x > 0] There are many cases where this is useful (e.g. Sin[n*Pi], (-1)^(2*n +1), where n is an integer). However, for the example you mention, I can't see how you would expect it to simplify? The best that I can imagine is pretty much what's returned when you give assumptions (I'm assuming there was a typo in your definition of px2? and note that the built-in EuclideanDistance function): px1=PDF[NormalDistribution[Mu,Sx],X1]; px2=PDF[NormalDistribution[Mu,Sx],X2]; py1=PDF[NormalDistribution[Mu,Sy],Y1]; py2=PDF[NormalDistribution[Mu,Sy],Y2]; assumptions = Element[{Mu,X1,X2,Y1,Y2}, Reals] && Sx>0 && Sy>0; FullSimplify[EuclideanDistance[{px1,py1}, {px2,py2}], assumptions]