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

• To: mathgroup at smc.vnet.net
• Subject: [mg107191] Re: Bug? Analytical integration of cosines gets the sign wrong
• From: DC <b.gatessucks at gmail.com>
• Date: Fri, 5 Feb 2010 03:21:46 -0500 (EST)
• References: <hkeb9k\$b5\$1@smc.vnet.net>

```Same system, same result, but

In:= int = Integrate[Cos[ph]*1/Pi*Cos[4*ph]*Cos[2*ph], ph]

Out= (2 Sin[ph] + 2/3 Sin[3 ph] + 2/5 Sin[5 ph] +
2/7 Sin[7 ph])/(8 \[Pi])

In:= (int /. ph -> 3/2 Pi) - (int /. ph -> Pi)

Out= -(19/(105 \[Pi]))

-Francesco

On 02/04/2010 11:33 AM, 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: Sort of nested NIntegrate
• Next by Date: Re: DeleteDuplicates is too slow?
• 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