Integrate[1/x^2 Exp[- x^2/(2 q)]/Sqrt[2 [Pi] q], {x, -infinity, infinity}]
gives
-(1/q)
While, in fact, the integral does not converge…
Version 12.3.1.0
Integrate[1/x^2 Exp[- x^2/(2 q)]/Sqrt[2 [Pi] q], {x, -infinity, infinity}]
gives
-(1/q)
While, in fact, the integral does not converge…
Version 12.3.1.0
If we treat function as continuous one at {-infinity, infinty} and with Regularization then:
Integrate[1/x^2 Exp[-x^2/(2 q)]/Sqrt[2 \[Pi] q] x^s, {x, -Infinity, Infinity},
Assumptions -> {q > 0, s >= 0}, PrincipalValue -> True]
(*(2^(-2 + s/2) (1 + (-1)^s) q^(-1 + s/2)*Gamma[1/2 (-1 + s)])/Sqrt[\[Pi]]*)
Limit[%, s -> 0]
(*-(1/q)*)
Maybe is a bug ,maybe not. Send this example to WRI you will find out what they have to say about it.
The function is positive when q > 0, and the output is negative: the result is clearly wrong. It seems to be ignoring the singularity at x == 0 and doing something like this:
f[x_, q_] = Integrate[1/x^2 Exp[-x^2/(2 q)]/Sqrt[2 \[Pi] q], x]
Limit[f[x, q], x -> Infinity] - Limit[f[x, q], x -> -Infinity]
When the parameter is numerical, Mathematica detects the singularity:
With[{q = 1},
Integrate[1/x^2 Exp[-x^2/(2 q)]/Sqrt[2 \[Pi] q],
{x, -Infinity, Infinity}]]
This is also interesting:
Table[{n, Integrate[1/x^n Exp[-q x^2],
{x, -Infinity, Infinity}]},
{n, 6}]