# Integrate over sharp peak [closed]

Hi I have a function that has a sharp spike. I need to NIntegrate over the peak but it seems that NIntegrate does not handle it well. Actually as far as I can tell, even the evaluation of the integrand at the location of the peak does not look right. It seems mathematica cannot catch the peak at all...

tmpfuncc[EE_] :=  1/((mtau^2 + mu^2 - (0.1*GeV)^2 - 2*mtau*EE*GeV)^2 + 10^-20)

N[tmpfuncc[(mtau^2 + mu^2 - (0.1*GeV)^2)/2/mtau/GeV], 10]

Out[]= 3.8147*10^-6

NIntegrate[tmpfuncc[EE], {EE, mu/GeV, (mtau^2 + mu^2)/2/mtau/GeV}, WorkingPrecision -> 10]

NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small. >>
NIntegrate::ncvb: "NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in EE near {EE} = {0.888490766789827039531500380004219625181210150361343500025939}. NIntegrate obtained 6.4459378881974372649191637853748124060704020879387284535053260.*^-33 and 2.660074593120186116079909716400416828709239016848045497838860.*^-33 for the integral and error estimates."
Out[]=6.445937888*10^-33


The variables are listed below

In[2162]:= mu

mtau

GeV

Precision[mu]

Precision[mtau]

Precision[GeV]

Out[2162]= 105660000

Out[2163]= 1776860000

Out[2164]= 1000000000

Out[2165]= [Infinity]

Out[2166]= [Infinity]

Out[2167]= [Infinity]

Any idea about how to improve?

• You are explicitly setting the working precision to 10; have you tried increasing it significantly? – MarcoB Feb 22 '17 at 3:55

mu = 105660000;
mtau = 1776860000;
GeV = 1000000000;


Use exact numbers when defining tmpfuncc, i.e., 1/10 rather than 0.1

tmpfuncc[EE_] := 1/((mtau^2 + mu^2 - (GeV/10)^2 - 2*mtau*EE*GeV)^2 + 10^-20);

tmpfuncc[(mtau^2 + mu^2 - (GeV/10)^2)/2/mtau/GeV]

(*  100000000000000000000  *)


The integral can be done exactly

int = Integrate[tmpfuncc[EE], {EE, mu/GeV, (mtau^2 + mu^2)/2/mtau/GeV}]

(*  (1/355372000)(ArcTan[100000000000000000000000000] +
ArcTan[27829094400000000000000000000])  *)


You can get a numerical approximation to any desired precision

int // N[#, 10] &

(*  8.840293140*10^-9  *)


The working precision in OP's question is too small. Increasing the working precision and min/max recursion gives a result close to that of Bob Hanion's answer.

NIntegrate[
tmpfuncc[EE], {EE, mu/GeV, (mtau^2 + mu^2)/2/mtau/GeV},
WorkingPrecision -> 40, PrecisionGoal -> 12, MinRecursion -> 30,
MaxRecursion -> 200]

(* 8.840293139554588539520642615458365446312*10^-9 *)