Re: Numerical integration
- To: mathgroup at smc.vnet.net
- Subject: [mg78809] Re: Numerical integration
- From: "David W.Cantrell" <DWCantrell at sigmaxi.net>
- Date: Tue, 10 Jul 2007 06:29:12 -0400 (EDT)
- References: <f6sh65$7ob$1@smc.vnet.net>
José_Carlos_Santos <jcsantos at fc.up.pt> wrote: > Hi all: > > I detected a problem concerning numerical integration It's not a problem concerning _numerical_ integration! NIntegrate[h[t], {t, 0, 2Pi}] would have given you a correct numerical result. > under Mathematica 5.1. Consider this function: > > h[t_] := Exp[I t](Exp[I t] - 1)Sec[Exp[I t] - 1] > > If I compute: > > N[Integrate[h[t], {t, 0, 2Pi}]] > > I get -3.58642. Yes, and that is incorrect, and the reason it's incorrect is that the _symbolic_ integral Integrate[h[t], {t, 0, 2Pi}] gives, incorrectly, -(-2 + Pi) Pi. The correct value of the symbolic integral is -Pi^2, which is approximately what you got below. (BTW, can someone get version 5.x or 6 to give -Pi^2 easily?) David > But if I compute > > N[Integrate[Re[h[t]], {t, 0, 2Pi}] + Integrate[Im[h[t]], {t, 0, 2Pi}]I] > > instead of getting the same answer, I get -9.869604401106042 + > 2.2377264147293624^(-16)I. Of course, the imaginary part doesn't bother > me, but why are the results so different? BTW the difference is equal > to 2*pi. > > Best regards, > > Jose Carlos Santos