Re: question about Integrate

*To*: mathgroup at smc.vnet.net*Subject*: [mg49261] Re: question about Integrate*From*: Paul Abbott <paul at physics.uwa.edu.au>*Date*: Sat, 10 Jul 2004 02:48:32 -0400 (EDT)*Organization*: The University of Western Australia*References*: <cclelo$k9m$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

In article <cclelo$k9m$1 at smc.vnet.net>, "Florian Jaccard" <florian.jaccard at eiaj.ch> wrote: > I asked my students to compute the area of the following closed curve : > > x[t_] := Sin[t]; y[t_] := E^Cos[t]; > > ParametricPlot[{x[t], y[t]}, > {t, 0, 2*Pi}]; > > I expected the following input : > > 2*NIntegrate[x[t]* Derivative[1][y][t],{t, Pi, 0}] > > which gives the following output : > > 3.5509993784243483 > > (They also could have done it like this : > 2*NIntegrate[y[t]*Derivative[1][x][t],{t, 0, Pi}] > and it gives the same output) > > As the help browser says "N[Integrate[ . ]] calls NIntegrate for integrals > that cannot be done symbolically" , I never told my students to avoid that > way : > > 2*N[Integrate[x[t]*Derivative[1][y][t],{t, Pi, 0}]] > > But, surprise, it gives an other answer : > > 2.1262 > > Checking carefully, I could see that NIntegrate did it fine, but > N[Integrate...] is wrong. It seems that the special functions BesselI and > StruveL (used by Mathematica if you type Integrate[...]) are making the > mistake... Indeed this bug was recently reported on MathGroup (and to WRI). The StruveL should not be there. The correct answer is 2 Pi BesselI[1,1] > Now, what should I tell my students ? To never believe Integrate if not > checked with NIntegrate ? That is _always_ good advice. Cheers, Paul -- Paul Abbott Phone: +61 8 9380 2734 School of Physics, M013 Fax: +61 8 9380 1014 The University of Western Australia (CRICOS Provider No 00126G) 35 Stirling Highway Crawley WA 6009 mailto:paul at physics.uwa.edu.au AUSTRALIA http://physics.uwa.edu.au/~paul