Re: Integrate vs. NIntegrate
- To: mathgroup at smc.vnet.net
- Subject: [mg51422] Re: Integrate vs. NIntegrate
- From: Peter Pein <petsie at arcor.de>
- Date: Sun, 17 Oct 2004 03:05:06 -0400 (EDT)
- References: <ckqnbf$nh0$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Carlos Felippa wrote: > 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. > Carlos, since you integrate twice along the unit circle with center 2 and log(conj(z))==conj(log(z)) on this path, the imaginary part has to cancel out. (or I'm wrong?) You can easily verify it: Integrate[Log[2 + Exp[2*I*x]], {x, -Pi, Pi}]/(2*Pi) Peter -- Peter Pein, Berlin