Re: Integration problem
- To: mathgroup at smc.vnet.net
- Subject: [mg35528] Re: Integration problem
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Thu, 18 Jul 2002 03:06:10 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <ah24r0$r3u$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi, can you simply stop to mix numerical values like 81. with analytical calculations ? Your problem is, that the integration must find the roots of 1 - t^2 - 81 t^4 If you wish to use analytical calculations avoid inexact numerical data like 0. or 81. Regards Jens Arnold Gregory Civ AFRL/SNAT wrote: > > On Mathematica 4.1 w/ Win2000, I'm having the following problem with an integral: > In[1]:= expr1 = (t)^2* UnitStep[1 - t^2 - 81. t^4] > Out[1]= t^2 UnitStep[1 - t^2 - 81. t^4] > > In[2]:= expr2 = (0.+ t)^2 UnitStep[1 - t^2 - 81. * t^4] > Out[2]= (0.+ t)^2 UnitStep[1 - t^2 - 81. * t^4] > > In[3]:= Integrate[Evaluate[expr1],{t,-1,1}] > Out[3]= 0.0227181 > > In[4]:= Integrate[Evaluate[expr2],{t,-1,1}] > Out[4]=0.666667 > > In[5]:= Integrate[Evaluate[Rationalize[expr2]],{t,-1,1}] > Out[5]= (10*Sqrt[26*(-1 + 5*Sqrt[13])] - > 2*Sqrt[-2 + 10*Sqrt[13]])/8748 > > In[6]:= N[%] > Out[6]= 0.0227181 > > In[7]:= NIntegrate[Evaluate[Rationalize[expr2]],{t,-1,1}] > NIntegrate::slwcon: Numerical integration converging too slowly; suspect one \ > of the following: singularity, value of the integration being 0, oscillatory \ > integrand, or insufficient WorkingPrecision. If your integrand is oscillatory \ > try using the option Method->Oscillatory in NIntegrate. > NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after \ > 7 recursive bisections in t near t = -0.320313. > Out[7]= 0.0225802 > > It doesn't matter if I put the expression directly into the integrals. I can remove the difference by rationalizing either the expression t+0. or UnitStep[...] & both cases give the correct result. I can also change to (t+eps) and then evaluate eps->0. and get the correct result. In short, it looks like this particular form yields an unstable result & I'm looking for advice on approaches to mitigate this happening within a sequence of long & complex calculations. It isn't clear to me that Rationalize is the best approach or that it will always guarantee correcting the problem. > > Thanks! > Greg