# Unexpected integration result?

Posted 2 months ago
441 Views
|
7 Replies
|
0 Total Likes
|
 I am getting a strange integration result: the integral of the absolute value of a non-zero function gives me 0 as an output. There is a MWE in the attached notebook. Can give me a hint about how to solve the issue?(I am using Mathematica 12.0.) Attachments:
7 Replies
Sort By:
Posted 2 months ago
 The result is clearly wrong. However, it is not reasonable to expect Mathematica to solve a trascendental equation with two parameters to find where f=0. It can find a closed form when the parameters are numbers: With[{\[Mu] = 2, \[Sigma] = 1}, Integrate[ Abs[f[x, \[Mu], \[Sigma]]], {x, -\[Infinity], \[Infinity]}]] 
Posted 1 month ago
 Indeed, the function to integrate is not among the easiest. However, I would have expected Mathematica to realise the problem cannot be solved instead of giving a wrong answer.Moreover, elevating the function to the power 2 outputs what seems like a reasonable output. To which extent should I trust this result? Assuming[{m > 0, s > 0}, Integrate[f[x,m,s]^2, {x, -\[Infinity], \[Infinity]}]] 
Posted 1 month ago
 The square of f has a closed-form primitive. You can check against that.
Posted 1 month ago
 The output of the primitive of the absolute value of f, namely "0", is also a closed form (even if not the correct one). How can I be sure that the second result is sound if the other one failed?
Posted 1 month ago
 As for the primitive of Abs[ff[x,m,s]], I get back the input, not 0.The square of ff is a simple sum of Gaussians, there is no problem in finding a primitive in terms of the error function Erf, and in calculating the limits at infinity.
 This is an interesting problem. Some remarks: fm[x_, m_, s_] := Exp[-(x - m)^2/(2 s^2)]/s fp[x_, m_, s_] := Exp[-(x + m)^2/(2 s^2)]/s f2[x_, m_, s_] := Exp[-x^2/(2 (m^2 + s^2))]/Sqrt[m^2 + s^2] Table[Plot[{fm[x, i, j], fp[x, i, j], f2[x, i, j]}, {x, -10, 10}, PlotRange -> All], {i, 1, 3}, {j, 1, 3}] ff[x_, m_, s_] := fm[x, m, s] + fp[x, m, s] - 2 f2[x, m, s] Manipulate[ Plot[{ff[x, i, j], Abs[ff[x, i, j]]}, {x, -5, 5}, PlotRange -> {-1, 1}], {i, 1, 3}, {j, 1, 3}] Integrate[Abs[ff[x, 1, 1]], {x, -Infinity, Infinity}] // N NIntegrate[Abs[ff[x, 1, 1]], {x, -100, 100}] Integrate[Abs[ff[x, 2, 1]], {x, -Infinity, Infinity}] // N NIntegrate[Abs[ff[x, 2, 1]], {x, -50, 50}] vtab = Table[ {i, j, NIntegrate[Abs[ff[x, i, j]], {x, -50, 50}]}, {i, 1, 3, .1}, {j, 1, 3, .1}]; ListPlot3D[Flatten[vtab, 1]] tt = Table[{j, NIntegrate[Abs[ff[x, j, 1]], {x, -50, 50}]}, {j, 2, 20}]; ListLinePlot[tt] It may be that the integral is bounded.