Re: Re: Simple integral wrong

*To*: mathgroup at smc.vnet.net*Subject*: [mg25165] Re: [mg25073] Re: Simple integral wrong*From*: David Withoff <withoff at wolfram.com>*Date*: Tue, 12 Sep 2000 02:58:51 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

> A couple of people told me that > > Plot[Integrate[Abs[Cos[u]], {u, 0, x Pi]}], {x, 0, 3}] > > works fine. The result is monotonic increasing as expected. > > But try > > Plot[Evaluate[Integrate[Abs[Cos[u]],{u,0,Pi*x}]],{x,0,3}] > > and see what happens! The evaluate forces Mathematica to do the > integral symbolically. It was doing it numerically without the Evaluate. These examples behave differently because the limits of integration are numerical in the first example and non-numerical in the second. All of the integrals here are done symbolically. (You could use NIntegrate to see what happens if the integrals are done numerically.) With numerical limits for the integral Mathematica can invoke a difficult but implementable procedure to correct for the discontinuities of the corresponding indefinite integral that fall within the range of integration. Without numerical values for the limits it is not possible in general to know which discontinuities fall within the range of integration. One conceivable approach to this problem would be to add some sort of symbolic correction for the discontinuities, as suggested in: > Or just type > > Integrate[Abs[Cos[u]],{u,0,Pi x}] > > Mathematica 4 returns > > 2 > Out[1]= Sqrt[Cos[Pi x] ] Tan[Pi x] > > This plots as a saw-tooth. The true solution should be > > Sqrt[Cos[Pi x]^2] Tan[Pi x] + 2 Floor[x + 1/2] > > Mathematica misses the step functions necessary to make the solution > continuous. One problem with this is that the suggested result isn't correct for all values of x. Apparently there is an implicit assumption that x is real. Even if one makes that assumption (which exposes another set of difficulties) there is the problem that there is no known computer algorithm for constructing the necessary correction. If you try constructing the necessary correction for a non-trivial examples you can quickly come to appreciate why no one has worked out a way to construct such corrections automatically (and are not likely to do so any time soon). Examples like this are very common. If you look up the following integral in a book, for example, you will probably find a result similar to the result given by Mathematica: In[1]:= Integrate[1/(3 + Cos[2 x]), x] Out[1]= ArcTan[Tan[x]/Sqrt[2]]/(2 Sqrt[2]) This result has discontinuities along the real axis. Tables of integrals do not normally include piecewise constant functions to correct for those discontinuities, and neither does Mathematica. Changing this to a definite integral with symbolic limits of integration doesn't really change the situation. A definite integral with symbolic limits of integration is still essentially handled as an indefinite integral: In[2]:= Integrate[1/(3 + Cos[2 x]), {x, 0, t}] Out[2]= ArcTan[Tan[t]/Sqrt[2]]/(2 Sqrt[2]) There isn't a single formula that will give a correct result for this integral for any value of x and for any contour of integration. If someone figures out a better approach for handling some subset of examples like this one, that would probably make a nice addition to some future version of Mathmematica. Dave Withoff Wolfram Research

**Re: Displaying Mixed Numbers**

**Re: Re: Simple integral wrong**

**Re: Re: Simple integral wrong**

**Re: Re: Simple integral wrong**