Re: Numerical integration
- To: mathgroup at smc.vnet.net
- Subject: [mg78819] Re: [mg78761] Numerical integration
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Tue, 10 Jul 2007 06:34:23 -0400 (EDT)
- Reply-to: hanlonr at cox.net
$Version
5.2 for Mac OS X (June 20, 2005)
h[t_]:=Exp[I t](Exp[I t]-1)Sec[Exp[I t]-1];
NIntegrate[h[t],{t,0,2Pi}]
-9.869604401106042 -
5.748762577084676*^-12*I
N[Integrate[Re[h[t]],{t,0,2Pi}]+Integrate[Im[h[t]],{t,0,2Pi}]I]
-9.869604401106042 +
2.5587171270657905*^-16*I
with an error warning (NIntegrate::ploss : Nintegrate stopping due to loss =
of precision. ...).
$Version
6.0 for Mac OS X x86 (32-bit) (April 20, 2007)
h[t_] := Exp[I t] (Exp[I t] - 1) Sec[Exp[I t] - 1];
NIntegrate[h[t], {t, 0, 2 Pi}]
-9.86960440107214 +
5.948019854429276*^-12*I
N[Integrate[Re[h[t]], {t, 0, 2 Pi}] + Integrate[Im[h[t]], {t, 0, 2 Pi}] I]
-9.869604401106052 + 0.*I
with an error warning (NIntegrate::ncvb : Nintegrate failed to converge to =
prescribed accuracy ...).
Bob Hanlon
---- "Jos=C3=A9 Carlos Santos" <jcsantos at fc.up.pt> wrote:
> Hi all:
>
> I detected a problem concerning numerical integration 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. 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
>