# Integrate and NIntegrate combined, giving MaxPrecision error

I am trying to integrate the following :

θ=π/20.0;
q=.3;g=0.05;v=5;w=.2;Z=2;
NIntegrate[Integrate[BesselJ[0,x
*Sin[θ]]*Exp[-x*Cos[θ]],{x,0.0,q*v*t}]
*Exp[-g*t/2]*Cos[w*t]/t,{t,0.0,∞},
PrecisionGoal ->12,WorkingPrecision->12]


I am getting a lot of errors, related to MaxPrecision. Though I set the WorkingPrecision to 12, it tells me that it ran to MaxPrecision $20$. I tried modifying the numerical limits also, but it did not change anything.

Using Integrate inside NIntegrate is pointless, since the result is numerical anyways. I'd suggest:

\[Theta] = \[Pi]/20;
q = 3/10; g = 5/100; v = 5; w = 2/10; Z = 2;
int[t_?NumericQ] := NIntegrate[BesselJ[0, x*Sin[\[Theta]]]*Exp[-x*Cos[\[Theta]]],{x, 0, q*v*t}]
NIntegrate[int[t]*Exp[-g*t/2]*Cos[w*t]/t, {t, 0, \[Infinity]}, PrecisionGoal -> 12]


Specify your constants as exact numbers to reduce round off error, and when you want precision 12, working precision should be more than that. The standard 15.9546 seems to be fine.

• Thanks for your answer, I was missing the point in the way I was trying to perform the numerical integration, you helped me get it clear. – Francisco Jun 18 '15 at 13:57
• @Francisco if you agree that Coolwater's answer addressed your issue, you should consider accepting it. You can do so by clicking on the grey checkmark beside the answer. – MarcoB Jun 19 '15 at 3:05
• Sorry for that, I didn't know. – Francisco Jun 23 '15 at 13:19