MathGroup Archive 2010

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

Search the Archive

Re: Re: Bug? Analytical integration of cosines gets the sign wrong

  • To: mathgroup at smc.vnet.net
  • Subject: [mg107375] Re: [mg107346] Re: Bug? Analytical integration of cosines gets the sign wrong
  • From: "Tony Harker" <a.harker at ucl.ac.uk>
  • Date: Thu, 11 Feb 2010 05:17:54 -0500 (EST)
  • References: <hkeb9k$b5$1@smc.vnet.net> <201002100835.DAA21213@smc.vnet.net>

This looks like a bug, and one that crept in between versions 6 and 7.
Interestingly,

 Integrate[
 TrigExpand[Cos[ph]*1/Pi*Cos[4*ph]*Cos[2*ph]], {ph, Pi, 3/2*Pi}]

gives the right answer [7.0 for Microsoft Windows (32-bit) (February 18,
2009)]. 

  Tony

]-> -----Original Message-----
]-> From: WetBlanket [mailto:wyvern864 at gmail.com] 
]-> Sent: 10 February 2010 08:35
]-> To: mathgroup at smc.vnet.net
]-> Subject: [mg107346] Re: Bug? Analytical integration of 
]-> cosines gets the sign wrong
]-> 
]-> On Feb 4, 5:33 am, K <kgs... at googlemail.com> wrote:
]-> > Hello everyone,
]-> >
]-> > the analytical integration in Mathematica 7.01.0 on Linux 
]-> x86 (64bit)
]-> >
]-> > faultyInt =
]-> >  Integrate[Cos[ph]*1/Pi*Cos[4*ph]*Cos[2*ph], {ph, Pi, 3/2*Pi}]
]-> >
]-> > gives as result:
]-> >
]-> > 19/(105 \[Pi])
]-> >
]-> > which is as a decimal number
]-> >
]-> > N[faultyInt]
]-> >
]-> > 0.0575989
]-> >
]-> > The numerical integration
]-> >
]-> > NIntegrate[Cos[ph]*1/Pi*Cos[4*ph]*Cos[2*ph],{ph,Pi,3/2*Pi}]
]-> >
]-> > gives
]-> >
]-> > -0.0575989
]-> >
]-> > which I believe is correct by judging from the plot
]-> >
]-> > Plot[Cos[ph]*1/Pi*Cos[4*ph]*Cos[2*ph], {ph, Pi, 3/2*Pi},
]-> >  PlotRange -> {-1/Pi, 1/Pi}]
]-> >
]-> > and because the quadgk function in another system gives the same
]-> > negative result.  Could anyone try this at home (or work, rather)
]-> > and confirm or disprove it?
]-> > Thanks,
]-> > K.
]-> If One substitutes the sequence, {1.9, 1.99, 1.999, ... 2.0}
]-> Mathematica gets the correct answer for as long as I tried 
]-> except, of
]-> course for 2.0.
]-> 
]-> 



  • Prev by Date: Re: Exception message from java: MathLink connection was lost.
  • Next by Date: Re: Re: Bug? Analytical integration of cosines gets the sign wrong
  • Previous by thread: Re: Re: Bug? Analytical integration of cosines gets the
  • Next by thread: Re: Re: Bug? Analytical integration of cosines gets the sign wrong