Re: Simple integral wrong

*To*: mathgroup at smc.vnet.net*Subject*: [mg25085] Re: [mg25021] Simple integral wrong*From*: Richard Fateman <fateman at cs.berkeley.edu>*Date*: Thu, 7 Sep 2000 22:28:38 -0400 (EDT)*Organization*: University of California, Berkeley*References*: <8ov0d6$9ol@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

The problem pointed out here is that Mathematica gives, for the indefinite integral, a form that cannot be used via the fundamental theorem of calculus, to compute the definite integral. First of all it would be nice if the result were "simplified" to Sqrt[Sin[z]^2]. Then it would be nice if it were noted that integration through points at which Sqrt[0] were computed would result in possible problems. Rather than saying "I understand how Mathematica might compute this wrong result" and it is therefore forgivable, I would recommend trying to figure out how to conditionalize the result so that illegal substitutions can be avoided. I would like to think we can get BETTER results from computer programs, (compared to humans) not worse. How can we build more sophisticated routines on top of computer algebra systems if all lower level steps have to be checked by humans? (like ooh... you used an absolute value function: no telling what might be broken. or even worse ... you used Sqrt as in Sqrt[Cos[x]^2] which Mathematica might not distinguish from Abs... RJF Andrzej Kozlowski wrote: > > 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/ | > > +--------------------------------------------------------------------------+ > > > > > > > > > >