Bug introduced in 10 and persists through 12.0 or later

I created this InterpolatingFunction, and NIntegrate gives an absurd result

I load the function and plot its derivative:

intfunc = << "intfunc2.m"
Plot[intfunc'[t], {t, 0, 1627577.2}, PlotRange -> All]


From the curve, the maximum value of the plot is of the order of $$10^{-8}$$

When I try to integrate this function over the interval, I would've expected a quantity of about an order of $$10^{-1}$$. Instead I get something very different:

NIntegrate[intfunc'[tt], {tt, 0, 1627577.2}]


This gives me $$-2.6 \times 10^{69}$$! Clearly something is wrong in my interpolating function. Any idea what is causing this weird result?

• may be it is a bug. But to be able to make sure, someone needs to see your input file there. Dec 24, 2015 at 23:01
• It is in the link in the first line of the post Dec 24, 2015 at 23:44
• Your link is to a site that is blocked by Norton Security as a malicious web site. Dec 24, 2015 at 23:48
• ugh. Is a file upload site. What would be a suggested place to upload this? Dec 24, 2015 at 23:49
• is the m file so large that you can't simply post the relevant plain source code here? myself do not download attachment from strange web sites. Dec 24, 2015 at 23:57

It seems there is a bug in symbolic processing code of NIntegrate and Integrate in version 10 (the same bug appears with Integrate). One workaround is to disable symbolic processing by integrating a "black-box" function instead of the actual function:

intfunc = Import["http://pastebin.com/raw/vQK1U0xZ", "Package"];
f[t_Real] = intfunc'[t];
NIntegrate[f[tt], {tt, 0, 1627577.2}, Method -> "Oscillatory", WorkingPrecision -> 50]

NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in tt near {tt} = {349671.99051049186008855806291520295494990982872420}. NIntegrate obtained 0.05733191738064797485103323890754278607357973496206150. and 4.517492269930206773391388565185048443086156114996350.*^-9 for the integral and error estimates. >>
0.057331917380647974851033238907542786073579734962061


The same result can be achieved by switching off symbolic processing via the Method option:

NIntegrate[intfunc'[tt], {tt, 0, 1627577.2},
Method -> {Automatic, "SymbolicProcessing" -> 0}, WorkingPrecision -> 50]


It is interesting that explicit Method -> "Oscillatory" is sufficient to avoid the bug:

NIntegrate[intfunc'[tt], {tt, 0, 1627577.2}, Method -> "Oscillatory"]

NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in tt near {tt} = {352828.}. NIntegrate obtained 0.05733276909199948 and 7.840132211343309*^-7 for the integral and error estimates. >>
0.0573328

• whoa! I didn't knew you could import pastebin samples directly into Mathematica. So smooth Dec 26, 2015 at 17:20