Re: Simple integral wrong

*To*: mathgroup at smc.vnet.net*Subject*: [mg25043] Re: [mg25021] Simple integral wrong*From*: Andrzej Kozlowski <andrzej at tuins.ac.jp>*Date*: Sun, 3 Sep 2000 22:11:03 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

My mathematica 4 (for MacOS) gives: In[1]:= Table[Integrate[Abs[Cos[x]], {x, 0, (Pi/2)*n}], {n, 1, 5, 2}] Out[2]= {1, 3, 5} which undobtedly is correct, so I suppose you must be referring to something else. Perhaps you have in mind something like this: In[3]:= Integrate[Abs[Cos[x]], {x, 0, (Pi)*a}] /. a -> 3/4 Out[3]= 1 -(-------) Sqrt[2] In[4]:= Integrate[Abs[Cos[x]], {x, 0, (Pi)*(3/4)}] Out[4]= 1 2 - ------- Sqrt[2] The first answer is "wrong" but it is quite understandable and, in a way, reasonable how it is obtained. To see this note that Mathematica gives: In[5]:= Integrate[Abs[Cos[x]], {x, 0, z}] Out[5]= 2 Sqrt[Cos[z] ] Tan[z] The indefinite integral is interpreted as a path integral in the complex plane. Is this answer right or wrong? There is nothing mathematically wrong with it, except that the function Abs[Cos[z]] is not analytic everywhere and there is no "unique" correct answer, independent of the path chosen (and hence also of z). In my opinion Mathematica does here as much as could be reasonably expected of it in this sort of situation. The alternative would be for it not to give any answer to "path integrals" involving non-analytic functions. At least then there would be less complaint about "bugs" in integration. -- Andrzej Kozlowski Toyama International University, JAPAN For Mathematica related links and resources try: <http://www.sstreams.com/Mathematica/> on 9/2/00 2:57 AM, Paul Cally at cally at kronos.maths.monash.edu.au wrote: > Try integrating | cos u| from u=0 to u = Pi x. Despite the integrand > being everywhere > non-negative, Mathematica 4 gives a result which jumps DOWNWARDS by 2 at > > x=1/2, 3/2, 5/2, .... I thought these simple integration errors had been > sorted out by > Wolfram years ago! > > Paul Cally > > -- > > +--------------------------------------------------------------------------+ > |Assoc Prof Paul Cally | Ph: +61 3 9905-4471 | > |Dept of Mathematics & Statistics | Fax: +61 3 9905-3867 | > |Monash University | paul.cally at sci.monash.edu.au | > |PO Box 28M, Victoria 3800 | | > |AUSTRALIA | http://www.maths.monash.edu.au/~cally/ | > +--------------------------------------------------------------------------+ > > > > >