Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Integrate vs. NIntegrate

  • To: mathgroup at
  • Subject: [mg51423] Re: Integrate vs. NIntegrate
  • From: "David W. Cantrell" <DWCantrell at>
  • Date: Sun, 17 Oct 2004 03:05:07 -0400 (EDT)
  • References: <ckqnbf$nh0$>
  • Sender: owner-wri-mathgroup at

carlos at (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.

The second one is correct (except for the last few decimal places).

What version are you using? In version,

f = 2 + Cos[2*x] + I*Sin[2*x];
Simplify[Integrate[Log[f], {x, -Pi, Pi}]/(2*Pi)]




David Cantrell

  • Prev by Date: Maximizing likelihood function
  • Next by Date: Re: Integrate vs. NIntegrate
  • Previous by thread: Re: Integrate vs. NIntegrate
  • Next by thread: Re: Integrate vs. NIntegrate