Re: Error in integrals?
- To: mathgroup at smc.vnet.net
- Subject: [mg9499] Re: [mg9482] Error in integrals?
- From: "W. Meeussen" <w.meeussen.vdmcc at vandemoortele.be>
- Date: Sat, 8 Nov 1997 23:04:31 -0500
- Sender: owner-wri-mathgroup at wolfram.com
hi Clifford, when in doubt, Plot it: in the plot of ior[m] you see a nasty discontinuity at about m=0.26795 Your human input is required here (you're not out of a job soon :Mathematica needs you). again, the rule applies : PLOT IT your function has three terms, begging you to show on screen : Plot[{ 1/3*2*Sqrt[3]*Sqrt[(m^2 - 1)^2/(m^2 + 1)^4] , 1/3*Sqrt[(-Sqrt[3]*m^2 - 6*m + Sqrt[3])^2/(m^2 + 1)^4] , 1/3*Sqrt[(-Sqrt[3]*m^2 + 6*m + Sqrt[3])^2/(m^2 + 1)^4] },{m,0,1}] and you see (by dropping term per term)that the second one has a nasty bounce on zero at some m. What m? let Mathematica find out : Solve[ Sqrt[(-Sqrt[3]*m^2 - 6*m + Sqrt[3])^2/(m^2 + 1)^4]==0,m] {{m -> -2 - Sqrt[3]}, {m -> 2 - Sqrt[3]}} aha, it is at m -> 2 - Sqrt[3] that things go 'bump'. So, lets do the old Integrate again, this time in two parts: Integrate[ior[a],{a,0,2-Sqrt[3]}] 3 - 2 Sqrt[3] -------------- -6 + 3 Sqrt[3] Integrate[ior[a],{a,2-Sqrt[3],1}] 1 -3 + Sqrt[3] -1 + ------- + ---------------- Sqrt[3] 3 (-2 + Sqrt[3]) Simplify[%+%%] 3 - 2 Sqrt[3] ------------- -2 + Sqrt[3] %//N 1.73205 So, NIntegrate did it right. You can do it symbolically if you supplement the Integrate routines with some common sense. I enjoyed it, altough some would be offended by the fact that we can not yet "blindly" (without plotting it) trust Mathematica 's integration packages. Blind trust ? no thanks! wouter. At 02:40 6-11-97 -0500, Clifford J. Nelson wrote: >Mathematica 3.0 on a PowerMac 7200/90 88MB Mac OS 8 gives different >results for Integrate vs. NIntegrate. > >Here is one example. > >ior[m_] := 1/3*(2*Sqrt[3]*Sqrt[(-1 + m^2)^2/(1 + m^2)^4] + > Sqrt[(Sqrt[3] - 6*m - Sqrt[3]*m^2)^2/(1 + m^2)^4] + Sqrt[(Sqrt[3] + >6*m - Sqrt[3]*m^2)^2/(1 + m^2)^4]) > >In[31]:= >N[Integrate[ior[m],{m,0,1}]] > >Out[31]= >-0.42265 > >In[32]:= >NIntegrate[ior[m],{m,0,1}] > >Out[32]= >1.73206 > >What am I doing wrong ? Which answer is correct ? > >Cliff Nelson > > > > Dr. Wouter L. J. MEEUSSEN w.meeussen.vdmcc at vandemoortele.be eu000949 at pophost.eunet.be