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

• To: mathgroup at smc.vnet.net
• Subject: [mg107214] Re: Bug? Analytical integration of cosines gets the sign wrong
• From: Fred <fred at unknown.com>
• Date: Fri, 5 Feb 2010 03:25:57 -0500 (EST)
• References: <hkeb9k\$b5\$1@smc.vnet.net>

```K,

I get the same wrong answer with Mathematica 7.0.1.0 under Windows 64-bit

In:=
f[x_] = Cos[x]*Cos[2*x]*Cos[4*x]/Pi;
Integrate[f[x], {x, Pi, 3 Pi/2}] // N
NIntegrate[f[x], {x, Pi, 3 Pi/2}]

Out= 0.0575989
Out= -0.0575989

Mathematica does get it right if we use indefinite integral

In:=
fPrim[x_] = Integrate[f[x], x];
fPrim[3 Pi/2] - fPrim[Pi] // N

Out= -0.0575989

Mathematica even gets it right if we use the definite integral with bounds
not involving Pi?

In:=
lowerbound = 3.141592654;
upperbound = 3 lowerbound/2;
Integrate[f[x], {x, lowerbound, upperbound}] // N

Out= -0.0575989

IMHO this is a bug, and should be reported to http://support.wolfram.com/submitabug.cgi

Regarde Arnold Smit

On 4-2-2010 12:33, K 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.
>

```

• Prev by Date: Re: DeleteDuplicates is too slow?
• Next by Date: Re: intersecting surfaces
• Previous by thread: Re: Bug? Analytical integration of cosines gets the sign wrong
• Next by thread: Re: Bug? Analytical integration of cosines gets the sign wrong