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[347]:= > Integrate[1/(A+B Cos[x])^2,{x,0,2 Pi}]/.{A->2,B->1} > Out[347]= > -4 Pi > --------- > 3 Sqrt[3] > > --- > 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[1]:= Integrate[1/(A + B Cos[x])^2, {x, 0, 2 Pi}] // Timing Out[1]= 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[2]:= %[[2]] /. {A -> 2, B -> 1} Out[2]= -4 Pi --------- 3 Sqrt[3] In[3]:= Integrate[1/(A + B Cos[x])^2, {x, 0, 2 Pi}] /. {A -> 2, B -> 1} // Timing Out[3]= -4 Pi {40.85 Second, ---------} 3 Sqrt[3] 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[4]:= Integrate[1/(A + B Cos[x])^2 /. {A -> 2, B -> 1}, {x, 0, 2 Pi}] // Timing Out[4]= 4 Pi {2.8 Second, ---------} 3 Sqrt[3]