Re: Problems with NIntegrate
- To: mathgroup at christensen.cybernetics.net
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1692] Re: [mg1645] Problems with NIntegrate
- From: John Fultz <jfultz>
- Date: Mon, 17 Jul 1995 02:14:24 -0400
> HI, > I have come up against a problem in Mathematica I hope someone > in this group may be able to explain to me. > I have defined a function as follows; > fp[p_]=Sqrt[(x^2-1)/(p^2-x^2)] > which I wish to integrate numerically. This I can do with > integer values of p: > NIntegrate[fp[6],{x,1,6}] > = 5.69279 > However, if I set p as a real value, such as: > NIntegrate[fp[6.2],{x,1,6.2}] > I get an inexact arithmetic error, and no answer. > > Does anybody know why this is happening, and if it's possible > to repair ? > If the problem was caused by the singularity a x=p then surely > this would effect both integer and real values of p. > I have consulted the manual, but if the answer is in there I can't > find it ! > > Any help would be gratefully received. > > Thanks in advance Ian. > > -- > --------------------- Ian.Barringer at Brunel.ac.uk ----------------- > If you are not entirely satisfied with the contents of this mail, > please return the complete item to the above address, stating when > and where it was received, and I will be delighted to send you a > new one. It *would* affect both integer and real values of p identically, if it weren't for those tiny little errors computers are always prone to making in the last digit of machine precision calculations. I was able to get your answer to calculate on my machine with: In[24]:= NIntegrate[fp[6.2], {x, 1, 6.2 - 2 $MachineEpsilon}] Out[24]= 5.90009 In[25]:= $MachineEpsilon -16 Out[25]= 2.22045 10 John Fultz Wolfram Research