Re: Integrate vs. NIntegrate
- To: mathgroup at smc.vnet.net
- Subject: [mg51426] Re: [mg51419] Integrate vs. NIntegrate
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sun, 17 Oct 2004 03:05:12 -0400 (EDT)
- Reply-to: hanlonr at cox.net
- Sender: owner-wri-mathgroup at wolfram.com
This appears to be version dependent.
$Version
5.0 for Mac OS X (November 19, 2003)
f=2+Cos[2 x]+I*Sin[2 x];
N[Integrate[Log[f],{x,-Pi,Pi}]/(2*Pi)]//InputForm
0.6931471805599453
NIntegrate[Log[f],{x,-Pi,Pi}]/(2*Pi)//InputForm
0.693147180559943 + 0.*I
Bob Hanlon
>
> From: carlos at colorado.edu (Carlos Felippa)
To: mathgroup at smc.vnet.net
> Date: 2004/10/16 Sat AM 04:21:20 EDT
> To: mathgroup at smc.vnet.net
> Subject: [mg51426] [mg51419] Integrate vs. NIntegrate
>
> Which one is the correct answer?
>
> f=2+Cos[2 x]+ I*Sin[2 x];
>
> Print[ N[Simplify[ Integrate[Log[f],{x,-Pi,Pi}]/(2*Pi)]] //InputForm];
> 0.34657359027997264 + 1.5707963267948966*I
>
> Print[ NIntegrate[Log[f],{x,-Pi,Pi}]/(2*Pi) //InputForm];
> 0.6931471805599428 + 0.*I
>
> I believe the second one, have doubts about the first.
>
>