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. – Nasser Dec 24 '15 at 23:01
• It is in the link in the first line of the post – lurscher Dec 24 '15 at 23:44
• Your link is to a site that is blocked by Norton Security as a malicious web site. – Bob Hanlon Dec 24 '15 at 23:48
• ugh. Is a file upload site. What would be a suggested place to upload this? – lurscher Dec 24 '15 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. – Nasser Dec 24 '15 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 – lurscher Dec 26 '15 at 17:20
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 3, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.4886379837989807, "perplexity": 2036.5966698652855}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-25/segments/1623487637721.34/warc/CC-MAIN-20210618134943-20210618164943-00394.warc.gz"}