Re: Can Integrate[expr,{x,a,b}] give an incorrect result?
- To: mathgroup at smc.vnet.net
- Subject: [mg82639] Re: Can Integrate[expr,{x,a,b}] give an incorrect result?
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Fri, 26 Oct 2007 05:34:14 -0400 (EDT)
- References: <20071025164458.769$l2@newsreader.com> <9005304.1193373452141.JavaMail.root@m35> <op.t0sjlpotqu6oor@monster.gateway.2wire.net>
Why "defending" and why "so much"? I just pointed out where the real problem lied (at that stage you had not noticed it yet) and left it at that. I only added that these two functions are very unlikely to fail. This can be useful knowledge when looking for the cause of a problem. That was all I did and thought it was the end of it. Then I got the weird reply from David which seemed to me tobe saying that I somehow wrote something wrong and that the problem was that Mathematicas Integrate (indefinite Integral) did not return the anti-derivative which he provided. Later he tried ot withdraw from this claim, but he it was not the first time he worte this. So, I finally decied to explain (roughly) what the Risch algorithm was, which is something American educated analysts rarely known about (In the years when I was an assistant professor at a large state university I found that most analysts had not the faintest idea about algebra and most algebraists new little analyis. The only people who knew both were algebraic geometers and lagebraic topologists. I doubt that there has been any change in this respect. The point of it all is that the Risch algorithm is pure algebra). So I am curious where you found all this "defending" of Simplify and D? Andrzej Kolzowski On 26 Oct 2007, at 15:14, DrMajorBob wrote: >>> So, from that, D and/or Simplify must be wrong. > > Not to beat a dead horse, but I was going through a thought > process, investigating the problem, not giving my final conclusion. > I didn't stop there, after all, and I got to the actual problem in > the end. > > Besides, I'm not sure why D and Simplify need so much defending. > > Bobby > > On Thu, 25 Oct 2007 19:26:26 -0500, Andrzej Kozlowski > <akoz at mimuw.edu.pl> wrote: > >> *This message was transferred with a trial version of CommuniGate >> (tm) Pro* >> I think you are just making excuses, which are not worth replying >> to. If I blamed Bobby for anything it was for suggesting that >> Simplify or D or indefinite integration was at faullt. To prove >> this I will simply quote from my original mail: >> >> >> First is a quote from Bobby: >> >>> So, from that, D and/or Simplify must be wrong. >>> >> >> Must they? Even without any investigation I would say that it is much >> more likely that this integral should not be evaluated by means of >> the Leibniz rule (substituting the limits into the anti-derivative >> and subtracting). >> >> Actually, as you know very well since he sent this message also to >> you,Bobby has since apologized for claiming that, (although I >> don'ts see why one would actually have to apologize for anything >> of this kind). I see I did not actually say this happens often but >> he words "even without nay investigation" obviously sugges that >> this sort of behaviour is fairly common in Mathemaitca. >> >> Further more, I wrote: >> >> Now let's compute the indefinte integral: >> >> indef = Integrate[int, t]; >> >> Using the Liebniz rule gives clearly the wrong answer: >> >> indef = Integrate[int, t]; >> >> but why should it give the right answer? The function indef is >> clearly discontinuous in the interval 0 to 2Pi >> >> Plot[indef, {t, 0, 2 Pi}] >> >> so the Leibniz rule does not apply. There is no reason at all to >> suspect the very reliable function Simplify and almost as realiable >> Interate. >> >> Where is there here any mention of definite integration except in >> saying that the Newton-Leibniz rule should not be applied here? >> >> What is worse, you wrote that Mathematica as well as every CAS >> known to you uses the t=Tan[th/2] substituiton (which you call the >> Weierstrass substitution) even though you have no gounds for >> beleiving that and even after I wrote to you that the Risch >> algorithm (wich you clearly do not know) does not use it because >> it does not need it - it can deal with such integrals by >> converting then to Exponentials and Logs (TrigToExp). Now Daniel >> Lichblau who knows the source code has confirmed that Mathematica >> indeed does not use the "Weierstrass substitution". So much for >> your "certianty" about this matter. >> >> Andrzej Kozlowski >> >> >> >> >> >> >> >> On 26 Oct 2007, at 05:44, David W. Cantrell wrote: >> >>> [Message also posted to: comp.soft-sys.math.mathematica] >>> >>> Andrzej Kozlowski <akoz at mimuw.edu.pl> wrote: >>>> As I don't see anything concrete to reply to in your post I will >>>> just >>>> restate my version of this whole argument and leave it at that. >>>> >>>> I originally replied to Bobby's post in which he seemed to question >>>> the reliability of Simplify or D (or, perhaps, of indefinite >>>> integration). I replied that Mathematica's Simplify and D were >>>> practically 100% reliable and Integrate (by which I have always >>>> meant the function that computes indefinite integrals) was >>>> nearly as >>>> reliable except when its heuristics failed or perhaps when it >>>> entered >>>> an unimplemented branch of the Risch algorithm. I attributed the >>>> problem the OP was having to the way Mathematica evaluated the >>>> definite integral by applying the Newton-Leibniz rule without >>>> detecting that it should't do so in this case. >>> >>> You may well have made that attribution in your head. But what >>> you _wrote_ >>> made it seem to me as though you thought Mathematica was >>> faultless in this >>> matter, at least in relation to the specific problems at hand, >>> and that >>> Bobby or the OP was instead at fault. I have now re-read your >>> original >>> reply, and it still seems that way to me. That, in large measure, >>> is why I >>> replied to you, rather than to Bobby or the OP. >>> >>> BTW, if I had seen Daniel Lichtblau's reply, I most likely would >>> never have >>> replied to you. Unlike you, he made it clear that Mathematica was >>> at fault. >>> (I overlooked Daniel's post only because its severely curtailed >>> title, >>> "give an", made it seem as though it were not part of this thread.) >>> >>>> I did not comment in any way on why the latter problem occured, >>>> except for remarking that it happened rather often. >>> >>> You did not make that remark in your reply to Bobby; look at what >>> you >>> wrote. OTOH, I made such a remark when replying to you: "This >>> happens >>> fairly often, the subject of this thread being a case in point." >>> >>>> At this point you entered, with a reply to me, whose purpose I >>>> still >>>> do not understand. >>> >>> I explained that above. >>> >>>> When I read it it seemed to me that you must be >>>> disagreeing with something I had written. As there was nothing >>>> at all >>>> about Simplify or D in your message, I naturally concluded that you >>>> were criticizing the way Mathematica performed indefinite >>>> integration >>>> - what I call Integrate. You seem to be suggesting that Integrate >>>> should somehow find a different anti-derivative. >>> >>> I did not say that _per se_, but perhaps it's reasonable that you >>> thought I >>> seemed to suggest such. >>> >>> But your "should" is too strong a word since there are at least >>> two options >>> which would keep Mathematica from making the error in integration >>> from 0 to >>> 2Pi, mentioned by the OP: >>> 1. Leave the result of indefinite integration as >>> it is, but then, since that result is not an antiderivative on >>> the desired >>> interval, improve Mathematica's detection of discontinuities so >>> that it >>> will not apply Newton-Leibniz incorrectly. >>> or >>> 2. Change the result of indefinite integration in problems in >>> which the >>> classic Weierstrass substitution, u = tan(x/2), had been used so >>> that >>> discontinuities introduced as an artifact of that substitution >>> are not >>> present in the result. >>> >>> My preference is option 2. In problems such as that mentioned by >>> the OP, >>> since option 2 gives an antiderivative on R, it allows us to use >>> Newton-Leibniz naively, there being then no discontinuities with >>> which to >>> be concerned. But again, I cannot say that the people at Wolfram >>> Research >>> should choose option 2, instead of option 1. For all I know, they >>> may have >>> an excellent reason for rejecting the option I prefer. >>> >>>> That's why I asked >>>> you for another algorithm - (for indefinite integration of course) >>>> that would return a different anti-derivative than the Risch >>>> algorithm. But now it turns out that you had nothing at all to >>>> add to >>>> what I had written, except perhaps the claim, which you did not >>>> make >>>> in your first post, that there is a reliable method of detecting >>>> discontinuities in the antiderivative. >>> >>> I didn't say that in my first post because one need not detect >>> discontinuities if you know that there are none to detect! The >>> algorithm >>> performs as I described previously. Thus, for the OP's problem, >>> it returns >>> an antiderivative on R. >>> >>>> But actually, if you re-read >>>> your own post you will see that in it you are (or at least seem to >>>> be) suggesting that a different anti-derivative should have been >>>> found rather than the discontinuities in the one actually used by >>>> Mathematica should have been detected. These are two rather >>>> different >>>> claims. >>> >>> Indeed, they are different. The former corresponds to my "option >>> 2" above, >>> the latter to my "option 1". >>> >>>> In any case, even assuming that what you meant was "that >>>> Mathematica >>>> should be better at detecting discontinuities in the anti- >>>> derivative" >>> >>> Option 1. >>> >>>> I don't see in what way that is different from what I originally >>>> wrote? >>> >>> It differs significantly. You didn't say, or even hint, "that >>> Mathematica >>> should be better at" anything. It seemed -- and still seems -- to >>> me that >>> you were blaming Bobby or perhaps the OP, rather than >>> Mathematica. As I >>> said previously, that is why I responded to you, rather than to >>> someone >>> else. >>> >>> ------------------------------------------- >>> >>> The following examples and comments will likely be of interest to >>> anyone >>> following this thread. (It should also answer a few questions >>> raised in >>> some private emails.) >>> >>> The classic Weierstrass substitution is u = tan(x/2). Its use >>> typically >>> introduces spurious discontinuities in the result of an indefinite >>> integration. >>> >>> Consider >>> >>> In[4]:= Integrate[1/(2 - Cos[alpha - x]), x] >>> >>> Out[4]= -((2*ArcTan[Sqrt[3]*Tan[(alpha - x)/2]])/Sqrt[3]) >>> >>> Although the function to be integrated is continuous on R, the >>> result of >>> Integrate has discontinuities on R, due to the presence of >>> Tan[(alpha - x)/2], surely caused by a Weierstrass substitution. >>> >>> BTW, someone had questioned my assertion that Mathematica and >>> other CASs >>> use Weierstrass substitution. That's certainly a reasonable question >>> because I have no way of proving that they use it. I based my >>> assertion on >>> (1) what I had read in the literature and (2) the form of >>> answers, such as >>> Out[4] above, which clearly seem to be the results of Weierstrass >>> substitutions. In a court of law, (1) might be called mere >>> "hearsay" and >>> (2) might be called "circumstantial evidence". In any event, >>> until someone >>> from Wolfram Research assures me that Weierstrass substitution is >>> not used, >>> I shall assume that it is used. >>> >>> Now consider the definite integration >>> >>> In[5]:= defint = Integrate[1/(2 - Cos[alpha - x]), {x, 0, 2*Pi}]; >>> defint /. alpha -> 20 >>> >>> Out[5]= 0 >>> >>> That is incorrect, presumably due to an improper use of Newton- >>> Leibniz. Not >>> surprisingly, if we set alpha to 20 in the integration, we do get >>> the >>> correct answer: >>> >>> In[6]:= Integrate[1/(2 - Cos[20 - x]), {x, 0, 2*Pi}] >>> >>> Out[6]= 2*Pi/Sqrt[3] >>> >>> The algorithm which I had mentioned takes a result such as Out >>> [4], having >>> spurious jump discontinuities on R caused by the Weierstrass >>> substitution, >>> and produces an antiderivative without those jumps. >>> For 1/(2 - Cos[alpha - x]), such an antiderivative on R is >>> >>> # (x - 2 ArcTan[Sin[alpha - x]/(2 + Sqrt[3] - Cos[alpha - >>> x])])/Sqrt[3] >>> >>> Note that # is a little messier than Out[4]; perhaps that's why >>> Wolfram >>> Research prefers Out[4], despite its discontinuities on R. OTOH, >>> for a >>> definite integration on the real line, it is impossible to misuse >>> Newton-Leibniz with #, and so no error such as Out[5] could occur. >>> >>> David W. Cantrell >> >> > > > > -- > DrMajorBob at bigfoot.com