Skip to main content
2 of 3
added 371 characters in body
xzczd
  • 68.4k
  • 9
  • 174
  • 489

It's just another story of precision. For the first sample:

a = 2/100;
NIntegrate[BesselJ[15/2, BesselJZero[15/2, 1]*r]^2*r, {r, 0, a}, WorkingPrecision -> 40]
N[Integrate[(BesselJ[15/2, BesselJZero[15/2, 1]*r])^2*r, {r, 0, a}], 40]
(* Let's check the difference between the above two result *)
%% - %
1.187956028197538867114723184727333535080*10^-27
1.187956028197538867114723184727562859206*10^-27
-2.29324126*10^-58

For the second sample:

int2 = Integrate[BesselJ[15/2, 10^-7*r]^2*r, {r, 0, a}];
Block[{$MaxExtraPrecision = 290}, N[int2, 16]]
1.194601120645255*10^-148

To summarize, one should always keep the precision issue in mind when facing numerical calculation.

xzczd
  • 68.4k
  • 9
  • 174
  • 489