# NIntegrate Clears Notebook

Bug introduced in 6 or 7 and resolved in 10.2

I have been doing some multi-dimensional numerical integration and noticing that when I try to evaluate certain integrals of functions I have defined, the evaluation stops almost instantly and clears all of my functions without producing an output. Below is a simplified version of the contents of my notebook.

ClearAll["Global*"];

R3[x_?NumericQ, y_?NumericQ, n_?NumericQ] := Exp[-Abs[x - y]/n]*(x/n - y/n)^n;

b[T_?NumericQ] := 1/(T - I);

trans[x_?NumericQ] := x/(1 - x^2);

f[x_?NumericQ, y_?NumericQ, T_?NumericQ] :=  NIntegrate[R3[x, trans[z], 1]*R3[y, trans[z], 1]* Exp[I*b[T]*(x + trans[z])^2 - I*Conjugate[b[T]]*(y + trans[z])^2 + I*T]*D[trans[z], z], {z, 0, 1}, Method -> {"MonteCarlo", "MaxPoints" -> 10^2}];

g[T_?NumericQ] := NIntegrate[Abs[f[trans[x], trans[y], T]]^2*D[trans[x], x]*D[trans[y], y], {x, 0, 1}, {y, 0, 1}, Method -> {"MonteCarlo", "MaxPoints" -> 10^2}];


I have no problems evaluating the function f[x,y,T] at different points (I get the "failed to converge" error message, although it does not affect the evaluation), but when I try to evaluate, for example, g[0], the aforementioned problem of all function definitions getting cleared arises. I have never experienced this problem before and I'm wondering if I am making some silly mistake. Any help would be much appreciated.

• This is a bug that has been fixed as of version 10.2. Commented Sep 1, 2016 at 22:50

In general, high-level functions like NIntegrate` crashing the kernel is more likely to be a bug in those functions than due to anything the user has done, unless the input is somehow pathological.