Re: real valued expressions in Mathematica 4.0

*To*: mathgroup at smc.vnet.net*Subject*: [mg18468] Re: real valued expressions in Mathematica 4.0*From*: Adam Strzebonski <adams at wolfram.com>*Date*: Wed, 7 Jul 1999 23:08:36 -0400*References*: <9907061138.AA20188@tuins.ac.jp>*Sender*: owner-wri-mathgroup at wolfram.com

The information Simplify is missing in this example is that for x>0, ArcTan[x, y]==ArcTan[y/x]. We can add this information using the TransformationFunctions option: In[1]:= transf[e_, assum_] := e/.(ArcTan[x_, y_]:>ArcTan[y/x] /; Simplify[x>0, assum]===True) In[2]:= mySimplify[e_, assum_] := Simplify[e, assum, TransformationFunctions->{Automatic, transf[#, assum]&}] In[3]:= mySimplify[ComplexExpand[Sqrt[a + b*I] + Sqrt[a - b*I], TargetFunctions -> {Re, Im}] \[Element] Reals, a > 0 && b \[Element] Reals] Out[3]= True I have added the transformation to Simplify in the developement version of Mathematica, so in the next release Simplify will be able to handle this example. Thank you for pointing it out. Best Regards, Adam Strzebonski Wolfram Research Andrzej Kozlowski wrote: > > In general I am rather impressed with the new ability of Mathemaitca 4.0 to > handle assumptions (it was possible to do most of these things in 3.0 but > only by using the AlgebraicInequalities package, Groebner basis and doing a > bit of programming). In particular Mathematica 4.0 can now decide that > certain symbolic expressions are always real for real values of parameters. > On example, which I used a while ago when "complaining" about v.3.0 > inability to do this was: > > ComplexExpand[a + Sqrt[-b^2 - 1] + Conjugate[a + Sqrt[-b^2 - 1] > > In version 4.0 > > In[1]:= > Simplify[ComplexExpand[a + Sqrt[-b^2 - 1] + > Conjugate[a + Sqrt[-b^2 - 1]]], > Element[a,Reals] && Element[b,Reals]] > Out[1]= > 2 a > > gives the nicest possible answer. > > However, there are still some simplifications which are pretty obvious to > humans that Mathematica seems unable to manage. For example, It is easy to > prove that if f is a function holomorphic in some domain containing a real > interval and symmetric with respect to conjugation and if f takes real > values on the real interval within its domain then > f[Conjugate[z]] == Conjugate[f[z]] and hence f[z]+f[Conjugate[z]] is always > real. For example > > Sqrt[a+b*I]+Sqrt[a-b*I] is always real if a and b are real and a is > positive. Mathematica does seem to > know this: > > In[2]:= > In[1]:= > FullSimplify[ComplexExpand[Sqrt[a + b*I] + Sqrt[a - b*I], > TargetFunctions -> {Re, Im}] \[Element] Reals, > a > 0 && b \[Element] Reals] > Out[1]= > 2 2 1/4 1 1 > (a + b ) (Cos[- ArcTan[a, -b]] + Cos[- ArcTan[a, b]] + > 2 2 > > 1 1 > I (Sin[- ArcTan[a, -b]] + Sin[- ArcTan[a, b]])) \[Element] Reals > 2 2 > 2 2 > > However, Mathematica can manage some simpler cases: > > In[3]:= > Simplify[ComplexExpand[Sqrt[1 + b*I] + Sqrt[1 - b*I], > TargetFunctions -> {Re, Im}] \[Element] Reals, b \[Element] Reals] > Out[3]= > True > > It comes tantalizingly close to getting the general case right if one > writes the experssion in a slightly > different form: > > In[4]:= > FullSimplify[ > ComplexExpand[Sqrt[a]*(Sqrt[1 + (b/a)*I] + Sqrt[1 - (b/a)*I]), > TargetFunctions -> {Re, Im}] \[Element] Reals, > a > 0 && b \[Element] Reals] > Out[4]= > True > (One has to use FullSimplify here. Plain Simplify won't work) > > This is certainly much better than version 3 but it seems that human > mathematicians still need not worry about becoming redundant. > > P.S. In case somebody takes this last remark seriously, I actually do not > think that what Mathematica does is "mathematics", but this list in not the > right place to discuss such matters. > > -- > Andrzej Kozlowski > Toyama International University > JAPAN > http://sigma.tuins.ac.jp > http://eri2.tuins.ac.jp > > -- > Andrzej Kozlowski > Toyama International University > JAPAN > http://sigma.tuins.ac.jp > http://eri2.tuins.ac.jp