I know similar questions have been asked before about bugs in Integrate, but I'm not sure what the particular problem is here (and whether or not there is indeed a bug). When I perform the integral:

Integrate[Sin[k/2]*Exp[-n*Sin[k/2]], {k, 0, Pi}]


π (-BesselI[1, n] + StruveL[-1, n])

From the following plot, however, one can see that this differs strongly from the numerical result for approximately $n>37$:

DiscretePlot[{π (-BesselI[1, n] + StruveL[-1, n]),
NIntegrate[Sin[k/2]*Exp[-n*Sin[k/2]], {k, 0, Pi}]}, {n, 1, 50}]


I believe the numerical answer is correct in this case by inspecting the area under the following plot:

Manipulate[  Plot[Sin[k/2]*Exp[-n*Sin[k/2]], {k, 0, Pi}, PlotRange ->
All], {n, 1,    50}]


Any ideas about what is going on here (and how I can get a correct symbolic result)? Thanks!

• It's a precision issue, meaning that machine precision is giving incorrect results. Give the DiscretePlot the option WorkingPrecision->16 to see a correct result. – Carl Woll Aug 31 '18 at 18:56
• Could you please update title to reflect real pb – chris Sep 2 '18 at 9:30

It's a precision issue. Machine precision computations have no precision tracking, so computations using machine precision can be completely wrong. If you use arbitrary precision numbers, than Mathematica will track the numbers and produce results whose precision is validated. So, give DiscretePlot the WorkingPrecision option to work with arbitrary precision numbers:
DiscretePlot[