Re: PowerExpand in version 6

*To*: mathgroup at smc.vnet.net*Subject*: [mg85860] Re: PowerExpand in version 6*From*: sashap <pavlyk at gmail.com>*Date*: Mon, 25 Feb 2008 07:38:47 -0500 (EST)*References*: <fpoonm$1ev$1@smc.vnet.net>

Dear Andrzej, Assuming works by setting $Assumptions, and this has the desired effect for most of the functions, because their Assumptions options is defaulted to $Assumptions. Here is a list of all System` context symbols with Assumptions option: In[184]:= ToExpression /@ Quiet[Select[Names["System`*"], MemberQ[ToExpression[#, StandardForm, Options[Unevaluated[#]] &][[All, 1]], Assumptions] &]] Out[184]= {ExpectedValue, FourierCosTransform, FourierSinTransform, \ FourierTransform, FullSimplify, FunctionExpand, Integrate, \ InverseFourierCosTransform, InverseFourierSinTransform, \ InverseFourierTransform, LaplaceTransform, Limit, PiecewiseExpand, \ PossibleZeroQ, PowerExpand, Refine, Residue, Series, Simplify} We now select the one where Assumptions is not set to $Assumptions: In[185]:= Select[{#, Options[#, Assumptions]} & /@ %, FreeQ[#, HoldPattern[$Assumptions]] &] Out[185]= {{PowerExpand, {Assumptions -> Automatic}}} This was done for backwards compatibility. Unfortunately resetting this option globally might not be a very good idea, because it would change the behavior of some of internal code which uses PowerExpand. As to other issues you point out to, they follow from behavior of Refine: In[193]:= res = PowerExpand[Sqrt[x*y], Assumptions -> True] Out[193]= E^( I \[Pi] Floor[ 1/2 - Arg[x]/(2 \[Pi]) - Arg[y]/(2 \[Pi])]) Sqrt[x] Sqrt[y] In[195]:= Refine[res, Assumptions -> x > 0] Out[195]= Sqrt[x] Sqrt[y] In[196]:= Refine[res, Assumptions -> x > 0 && y > 0] Out[196]= Sqrt[x y] In[197]:= Refine[res, Assumptions -> x > 0 && Arg[y] == 0] Out[197]= Sqrt[x] Sqrt[y] Oleksandr Pavlyk On Feb 23, 3:24 am, Andrzej Kozlowski <a... at mimuw.edu.pl> wrote: > The ancient function PowerExpand, indispensable before the > Assumptions mechanism was introduced in version 4 of Mathematica, > became a bit of an embarrassment in later versions and there were even > voices, I can remember, arguing that it ought to be deprecated. > Instead, PowerExpand was modified in version 6 by making it possible > to use the Assumptions mechanism with it and this giving this almost > dead function a new lease of life. This is indeed very nice when it > works, but unfortunately the implementation still leaves some things > to be desired. > > The main example in the documentation is: > > PowerExpand[Sqrt[x*y], Assumptions -> True] > > E^(I*Pi*Floor[-(Arg[x]/(2*Pi)) + 1/2 - Arg[y]/(2*Pi)])* > Sqrt[x]*Sqrt[y] > > which gives a general expansion that is valid for all x and y. But > note that the normally equivalent form Assuming will not work: > > Assuming[True, PowerExpand[Sqrt[x*y]]] > Sqrt[x]*Sqrt[y] > > In fact Assuming is simply ignored and the answer returned is the same > as that given by PowerExpand without any assumptions. This is > disappointing for those (like myself) who prefer to use Assuming to > Assumptions -> , but may perhaps be a matter of deliberate design > (why?). But the next problem is certainly a bug. > > First note that: > > PowerExpand[Sqrt[x*y], Assumptions -> x > 0] > Sqrt[x]*Sqrt[y] > > which is quite correct but suppose we make an even stronger assumption: > > PowerExpand[Sqrt[x*y], Assumptions -> x > 0 && y > 0] > Sqrt[x*y] > > We do not get the expansion we should obtain. Curiously we can get the > correct expansion if we use a more complicated way of stating the same > assumption, e.g. > > PowerExpand[Sqrt[x*y], Assumptions -> x > 0 && Arg[y] == 0] > Sqrt[x]*Sqrt[y] > > or > > PowerExpand[Sqrt[x*y], Assumptions -> x > 0 && Re[y] > 0] > Sqrt[x]*Sqrt[y] > > Andrzej Kozlowski