Re: Fwd: RE: Antiderivatives and Definite Integrals

*To*: mathgroup at smc.vnet.net*Subject*: [mg39874] Re: [mg39841] Fwd: [mg39713] RE: [mg39670] Antiderivatives and Definite Integrals*From*: Dr Bob <drbob at bigfoot.com>*Date*: Sun, 9 Mar 2003 05:29:53 -0500 (EST)*References*: <200303080750.CAA23648@smc.vnet.net>*Reply-to*: drbob at bigfoot.com*Sender*: owner-wri-mathgroup at wolfram.com

Here's an odd result: r = 2 - Sin[t]; f = Sqrt[r^2 + D[r, t]^2] g = Simplify@f Integrate[f, {t, 0, Pi/2}] // N Integrate[g, {t, 0, Pi/2}] // N NIntegrate[f, {t, 0, Pi/2}] NIntegrate[g, {t, 0, Pi/2}] -14.474963421625041 + 3.552713678800501*^-15*I 2.382540126500918 + 0.*I 2.3825401265009183 2.3825401265009183 (Three of those answers are correct.) Simplifying f changed the result from Integrate, even though it doesn't change the plot: DisplayTogetherArray[Plot[f, {t, 0, Pi/2}], Plot[g, {t, 0, Pi/2}], AspectRatio -> Automatic, ImageSize -> 500]; The moral, as always, is "caveat emptor". Bobby On Sat, 8 Mar 2003 02:50:48 -0500 (EST), Garry Helzer <gah at math.umd.edu> wrote: > > > Begin forwarded message: > >> From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com> To: mathgroup at smc.vnet.net > To: mathgroup at smc.vnet.net >> Date: Mon Mar 3, 2003 11:48:37 PM US/Eastern >> To: mathgroup at smc.vnet.net >> Subject: [mg39874] [mg39841] [mg39713] RE: [mg39670] Antiderivatives and Definite >> Integrals >> >> >>> -----Original Message----- >>> From: Garry Helzer [mailto:gah at math.umd.edu] To: mathgroup at smc.vnet.net >> To: mathgroup at smc.vnet.net >>> Sent: Saturday, March 01, 2003 8:48 AM >>> To: mathgroup at smc.vnet.net >>> Subject: [mg39874] [mg39841] [mg39713] [mg39670] Antiderivatives and Definite >>> Integrals >>> >>> >>> The antiderivative of Sqrt[1+Cos[x]] discussed here recently (sorry, I >>> lost the thread) provides an amusing illustration of the fact that >>> Mathematica does not always evaluate definite integrals by first >>> finding an antiderivative and then substituting in the upper and lower >>> limits. (See the Mathematica book A.9.5) Make the definitions >>> >>> f[x_] = Integrate[Sqrt[1 + Cos[t]], {t, 0, x}] >>> g[x_] := Integrate[Sqrt[1 + Cos[t]], {t, 0, x}] >>> >>> Then f[2Pi] is 0 (wrong) and g[2Pi] if 4Sqrt[2] (correct). Of course >>> f[x]==g[x] returns True. >>> >>> Garry Helzer >>> Department of Mathematics >>> University of Maryland >>> 1303 Math Bldg >>> College Park, MD 20742-4015 >>> >>> >> >> You might be interested to observe: >> >> >> In[1]:= f[x_] = Integrate[Sqrt[1 + Cos[t]], {t, 0, x}] >> Out[1]= 2*Sqrt[1 + Cos[x]]*Tan[x/2] >> >> In[2]:= g[x_] := Integrate[Sqrt[1 + Cos[t]], {t, 0, x}] >> >> In[3]:= ?g >> Global`g >> g[x_] := Integrate[Sqrt[1 + Cos[t]], {t, 0, x}] >> >> In[4]:= Plot[f[x], {x, 0, 2Pi}] // Timing >> Out[4]= {0.03 Second, = Graphics =} >> >> ...what you called "wrong". > > Well, it is wrong. From calculus we know that > 1. A function defined as an integral with a variable upper limit is an > antiderivative. > 2. An antiderivative is, by definition, differentiable. > 3. A differentiable function is continuous. > > So, by this plot, f[x] is not the antiderivative of any function. > > But this may be too rigid a view. After all, D[f[x],x]//FullSimplify > brings you back to the integrand. This is a formal computation that > misses the points of discontinuity. Perhaps the algorithms used by > Mathematica are guaranteed only to produce such formal antiderivatives. A > superficial look a the Risch algorithm suggests that this might be the > case since it proceeds by formal manipulation in extension fields of > fields of rational functions. > > As I was typing this a stranger wandered in looking for an arc length(it > happens). His problem provides another example. Let r=2-Sin[t] and try > Integrate[Sqrt[r^2 +D[r,t]^2],{t,0,Pi/2}]//N. The result is about -15, > but arc length should not be negative. Set > > h[x_]= Integrate[Sqrt[r^2 +D[r,t]^2],{t,0,x}] > > and again we get a formal antiderivative , the plot of which reveals > discontinuities. It cannot be carelessly used to evaluate definite > integrals. (If you simplify Sqrt[r^2 +D[r,t]^2] before integrating you > get an honest antiderivative.) > > In[5]:= >> Plot[g[x], {x, 0, 2Pi}, PlotRange -> {All, {0, 6}}] // Timing >> Out[5]= {4.096 Second, = Graphics =} >> >> ...what you called "right". > > It is right. But the corresponding function for the arc length problem is > wrong. >> >> >> Redefine: >> >> In[6]:= f[x_] /; -Pi < x < Pi = f[x] >> Out[6]= 2*Sqrt[1 + Cos[x]]*Tan[x/2] >> >> In[7]:= f[x_] /; Pi < x < 3 Pi = f[x] + 4*Sqrt[2] >> Out[7]= 4*Sqrt[2] + 2*Sqrt[1 + Cos[x]]*Tan[x/2] > > Or 4Sqrt[2]Round[x/(2Pi)]+ 2*Sqrt[1 + Cos[x]]*Tan[x/2] . But these > formulas are less than perfect since they are indeterminate at odd > multiples of Pi. > >> >> >> In[9]:= >> Plot[f[x], {x, 0, 2Pi}, PlotRange -> {All, {0, 6}}] // Timing >> Out[9]= {0.03 Second, = Graphics =} >> >> Don't be confused by that double use of f (as a function, and as a >> shortcut >> for an algebraic expression). >> >> -- >> Hartmut Wolf >> >> >> > Garry Helzer > Department of Mathematics > University of Maryland > 1303 Math Bldg > College Park, MD 20742-4015 > > > -- majort at cox-internet.com Bobby R. Treat

**References**:**Fwd: RE: Antiderivatives and Definite Integrals***From:*Garry Helzer <gah@math.umd.edu>