       Re: Negative Area

• To: mathgroup at christensen.cybernetics.net
• Subject: [mg228] Re: [mg213] Negative Area
• From: bob Hanlon <hanlon at pafosu2.hq.af.mil>
• Date: Wed, 23 Nov 1994 21:20:52 (EDT)

```On Mon, 21 Nov 1994, Roger M. Jones wrote:

> Dear Users,
>
> On integrating a +ve function (A>B) I obtain a -ve
>
> function.  Would you consider this to be a bug?
>
> In:=
> Integrate[1/(A+B Cos[x])^2,{x,0,2 Pi}]/.{A->2,B->1}
> Out=
>   -4 Pi
> ---------
> 3 Sqrt
>
> ---
> Yours,
>
> Roger
> (rmj at llewelyn.slac.stanford.edu)
>

The form of the result depends on whether the substitution is made before
or after the integration is performed.

In:=
Integrate[1/(A + B Cos[x])^2, {x, 0, 2 Pi}] // Timing

Out=
2    2
2 B Pi      2 Sqrt[A  - B ] Pi
{36.4333 Second, ------------ - ------------------}
2    2 3/2           2
(A  - B )      (-A + B)  (A + B)

In:=
%[] /. {A -> 2, B -> 1}

Out=
-4 Pi
---------
3 Sqrt

In:=
Integrate[1/(A + B Cos[x])^2, {x, 0, 2 Pi}] /.
{A -> 2, B -> 1} // Timing

Out=
-4 Pi
{40.85 Second, ---------}
3 Sqrt

By integrating before the substitution, there is insufficient knowledge of
the unknowns (ambiguity) and the result must be interpreted carefully
(negative root of Sqrt must be selected).  This problem is avoided by
substituting before the integration.  The timing is also improved.

In:=
Integrate[1/(A + B Cos[x])^2  /. {A -> 2, B -> 1},
{x, 0, 2 Pi}] // Timing

Out=
4 Pi
{2.8 Second, ---------}
3 Sqrt

```

• Prev by Date: RE: function definition
• Next by Date: [no subject]
• Previous by thread: RE: Negative Area
• Next by thread: Re: Hypergeometric Function