Re: Strange results
- To: mathgroup at smc.vnet.net
- Subject: [mg15421] Re: [mg15389] Strange results
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Wed, 13 Jan 1999 20:57:33 -0500
- Sender: owner-wri-mathgroup at wolfram.com
The answer Mathematica gives you for n=1 (-1+Sin[x]) is completely equivalent to what you expected (Sin[x]) since they differ by a constant and thus have the same derivative: Cos[x]. The situation is somewhat more complicated in the case of n=0. The function -ArcSin[Cos[x]] =x-Pi/2 over certain ranges (e.g. 0=<x=<Pi), over others it is Pi/2-x (e.g. -Pi=<x<=0). It is easy to see why you get this strange answer. Mathematica tries to give you the most general answer it can find. It can't give you a single aswer that works for all possible values of n, and x so it gives you a "generic" one. The answer it gives is not valid for n=-1 for n=0 and certain ranges of x, but other than that it is fine. You may not be able to see this at once, but you can always check it by taking derivatives. For example, for n= -1/2 you get In[1]:= 1 v = p /. n -> -(-) 2 Out[1]= 1 1 5 2 2 Sqrt[Cos[x]] Hypergeometric2F1[-, -, -, Cos[x] ] Sin[x] 4 2 4 -(---------------------------------------------------------) 2 Sqrt[Sin[x] ] While on the other hand: In[2]:= -(1/2) w = p = Integrate[Cos[x] , x] Out[2]= x 2 EllipticF[-, 2] 2 These answers look different but In[3]:= Simplify[D[v - w, x]] Out[3]= 0 On Tue, Jan 12, 1999, Ing. Alessandro Toscano Dr. <toscano at ieee.org> wrote: >The following in/out does not make sense to me: > >In[2]:= >p=Integrate[Cos[x]^n,x] >Out[2]= >\!\(\(-\(\(Cos[x]\^\(1 + n\)\ > Hypergeometric2F1[\(1 + n\)\/2, 1\/2, \(3 + n\)\/2, >Cos[x]\^2]\ > Sin[x]\)\/\(\((1 + n)\)\ \ at Sin[x]\^2\)\)\)\) In[4]:= >p//.n->0//PowerExpand >Out[4]= >-ArcSin[Cos[x]] > >In[7]:= >p//.n->1//Simplify//PowerExpand >Out[7]= >-1+Sin[x] > > >Isn't it true that (Integrate[Cos[x]^0,x] == x? Isn't it true that >(Integrate[Cos[x]^1,x] == Sin[x]? > > >Why do I get this strange result? > >I am using Mathematica 3.01 on Pcs. > >Thanks for any info. > > >*********************************** >Ing. Alessandro Toscano Dr. > >Universite di Roma Tre >Dip. Ingegneria Elettronica >Via della Vasca Navale, 84 >00146, Roma, ITALIA > >Tel. +39-6-55177095 >Fax +39-6-5579078 >mailto:toscano at ieee.org ><http://ato.ele.uniroma3.it> > >************************************ Andrzej Kozlowski Toyama International University JAPAN http://sigma.tuins.ac.jp/ http://eri2.tuins.ac.jp/