I am calculating the integral from $s=-\infty$ to $s+\infty$ of the following function
f[s_, t_] := Exp[-I*s*t]/(s + I*10^-6)
which is essentially the Fourier representation of Heaviside step function, modulo $2 \pi \mathrm{i}$ factor. I define the following two functions
fAnalytic[s_, t_] := f[s, t]
fNumerical[s_?NumericQ, t_?NumericQ] := f[s, t]
and, after setting $t=0.1$, NIntegrate is able to grecefully integrate the first one, but fails on the second one, as per the following screenshot
Clearly, then, in the first case numerical integration succeeds because NIntegrate can do some sort of symbolic preprocessing before crunching numbers.
I am interested, however, in evaluating the integral in a fully numerical way. The motivation is that I am dealing with a function with with a similar behaviour, whose form I know only numerically.
I have tried performing variable changes, for instance mapping the infinite integration region to the interval $[0,1]$, but it does not change the situations, fAnalytic is always calculated correctly, while the numerical integration for fNumerical always fails.
Edit: as requested in a comment I tried many different integrations methods, but no one gets close to the real result:
iMethods = {"Trapezoidal", "AdaptiveMonteCarlo", "GlobalAdaptive","LocalAdaptive", "DoubleExponential", "AdaptiveMonteCarlo","AdaptiveQuasiMonteCarlo", "DuffyCoordinates", "Oscillatory","BooleRule", "ClenshawCurtisRule", "GaussBerntsenEspelidRule","GaussKronrodRule", "LobattoKronrodRule", "LobattoPeanoRule","MultiPanelRule", "NewtonCotesRule", "PattersonRule","SimpsonThreeEightsRule", "TrapezoidalRule"};
NIntegrate[fNumeric[s, 0.1], {s, -Infinity, Infinity},Method -> #] & /@ iMethods
2/(t m)
at most, where the integration interval is{s, -m, m}
. $\endgroup$