Re: Demonstrate that 1==-1

*To*: mathgroup at smc.vnet.net*Subject*: [mg23200] Re: [mg23171] Demonstrate that 1==-1*From*: Adam Strzebonski <adams at wolfram.com>*Date*: Mon, 24 Apr 2000 01:12:07 -0400 (EDT)*Organization*: Wolfram Reasearch, Inc*References*: <B52619D5.624D%andrzej@tuins.ac.jp>*Sender*: owner-wri-mathgroup at wolfram.com

Andrzej Kozlowski wrote: > > I do not think this has anything to do with Limit. In fact both answers are > incorrect. The correct answer depends on whether Abs[a]>1 or Abs[a]<1. The > case Abs[a]==1 is special, since clearly for a=1 the integral does not > converge at all! So you should expect to get into trouble with an example > like this. Mathematica can actually give the correct answer, but it takes a > bit of work and knowing what you are doing (pretty common situation). Let's > start by assuming that a is real. Mathematica deals with this case pretty > well. > > Define two functions, say g and h which for a given u are the real and > imaginary parts of your expression, i. e. > > In[1]:= > f[u_] := (a/E^(I*u) + 1)/(a/E^(I*u) - 1) > > In[2]:= > g[u_] := ComplexExpand[Re[f[u]], TargetFunctions -> {Re, Im}] > > In[3]:= > h[u_] := ComplexExpand[Im[f[u]], TargetFunctions -> {Re, Im}] > > In[4]:= > Integrate[h[u], {u, 0, 2Pi}] // Simplify > > Out[4]= > 0 > > In[5]:= > Simplify[Integrate[g[u], {u, 0, 2Pi}], a > 1] > > Out[5]= > 2 Pi > > In[6]:= > Simplify[Integrate[g[u], {u, 0, 2Pi}], a < -1] > > Out[6]= > 2 Pi > > In[7]:= > Simplify[Integrate[g[u], {u, 0, 2Pi}], -1 < a < 1] > > Out[7]= > -2 Pi > > (To Adam Strzebonski: unfortunately the following does to work > > In[8]:= > Simplify[(2*Sqrt[(-1 + a)^2/(1 + a)^2]*(1 + a)*Pi)/(-1 + a), > Element[a ,Reals] && Abs[a] < 1] > > Out[8]= > 2 > (-1 + a) > 2 Sqrt[---------] (1 + a) Pi > 2 > (1 + a) > ---------------------------- > -1 + a It has been fixed in the later releases of Mathematica 4. In[1]:= Simplify[(2*Sqrt[(-1 + a)^2/(1 + a)^2]*(1 + a)*Pi)/(-1 + a), Element[a ,Reals] && Abs[a] < 1] Out[1]= -2 Pi > > In[9]:= > Simplify[(2*Sqrt[(-1 + a)^2/(1 + a)^2]*(1 + a)*Pi)/(-1 + a), > Element[a,Reals] && Abs[a] > 1] > > Out[9]= > 2 (1 + a) Pi Abs[-1 + a] > ------------------------ > (-1 + a) Abs[1 + a]) > This is more tricky. Abs[-1 + a] and Abs[1 + a], when taken separately, cannot be further simplified, because -1 + a and 1 + a do not have constant signs on the set of a satisfying the assumptions. Only the ratio Abs[-1 + a]/Abs[1 + a] can be simplified. So Simplify would need to use a rule like In[1]:= t[Abs[f_]^n_. Abs[g_]^m_. h_., assum_] := f^n g^m h /; OddQ[m] && OddQ[n] && Experimental`ImpliesQ[assum, f*g>0] In[2]:= t[other_, assum_] := other In[3]:= mySimplify[expr_, assum_] := Simplify[expr, assum, TransformationFunctions->{Automatic, t[#, assum]&}] In[4]:= mySimplify[(2*Sqrt[(-1 + a)^2/(1 + a)^2]*(1 + a)*Pi)/(-1 + a), Element[a,Reals] && Abs[a] > 1] Out[4]= 2 Pi (and similar rules for f*g<0, and Sign instead of Abs etc.) The rules have a rather bad complexity (searching for pairs of elements in every Times expression), so probably FullSimplify would be a better place to put them in. > Should not Simplify be able to manage these, at least when a is real? For > the complex case see below.) > > If a is not real one can still show that we get the answer 2Pi for Abs[a]<1 > and -2Pi for Abs[a]<1. However, in this case Mathematica needs more help. We > again define, f,g, and h > > In[1]:= > Clear[f, g, h] > > In[2]:= > f[u_] := (a/E^(I*u) + 1)/(a/E^(I*u) - 1) > > In[3]:= > g[u_] := ComplexExpand[Re[f[u]], {a}, TargetFunctions -> {Re, Im}] > > In[4]:= > h[u_] := ComplexExpand[Im[f[u]], {a}, TargetFunctions -> {Re, Im}] > > Note that now we told Mathematica not to assume that a is real. Integrating > the imaginary part still gives 0: > > In[5]:= > Integrate[h[u], {u, 0, 2Pi}] // Simplify > > Out[5]= > 0 > > If we integrate the real parts we get identical looking answers: > > In[6]:= > Simplify[Integrate[g[u], {u, 0, 2Pi}], Abs[a] > 1] > > Out[6]= > 2 2 > 2 Pi (-1 + Im[a] + Re[a] ) > --------------------------- > 2 2 > Abs[-1 + Im[a] + Re[a] ] > > In[7]:= > Simplify[Integrate[g[u], {u, 0, 2Pi}], Abs[a] < 1] > > Out[7]= > 2 2 > 2 Pi (-1 + Im[a] + Re[a] ) > --------------------------- > 2 2 > Abs[-1 + Im[a] + Re[a] ] > > Although the answers look identical they are in fact not! In the case > Abs[a]>1 the numerator is positive while in the case Abs[a]<1 it is > negative. So in the former case the answer is 2Pi while in the latter -2Pi. > Perhaps Mathematica also ought to be able to get this right without human > help? FullSimplify can do this (it has more rules relating Re, Im, and Abs). In[5]:= f[u_] := (a/E^(I*u) + 1)/(a/E^(I*u) - 1) In[6]:= g[u_] := ComplexExpand[Re[f[u]], {a}, TargetFunctions -> {Re, Im}] In[7]:= FullSimplify[Integrate[g[u], {u, 0, 2Pi}], Abs[a] > 1] Out[7]= 2 Pi In[8]:= FullSimplify[Integrate[g[u], {u, 0, 2Pi}], Abs[a] < 1] Out[8]= -2 Pi Best Regards, Adam Strzebonski Wolfram Research > > Andrzej Kozlowski > > on 00.4.21 12:48 PM, Alberto Verga at verga at marius.univ-mrs.fr wrote: > > > Compute > > Integrate[(1 + a/E^(I*u))/(-1 + a/E^(I*u)), {u, 0, 2*Pi}] > > > > Mathematica gives -2Pi > > > > Now multiply the numerator and the denominator by -1 > > > > Integrate[(-1 - a/E^(I*u))/(1 - a/E^(I*u)), {u, 0, 2*Pi}] > > > > Mathematica gets 2*Pi > > > > This is only possible if 1==-1 > > > > Is this another bug in Limit? > > > > Alberto Verga > > irphe - Marseille > > > > > > > > -- > Andrzej Kozlowski > Toyama International University > Toyama, Japan > http://sigma.tuins.ac.jp/

**Follow-Ups**:**Re: Re: Demonstrate that 1==-1***From:*John Wallace <jwx@mindspring.com>