Integrate yielding a ConditionalExpression but I don't think the condition is necessary - Mathematica Stack Exchange most recent 30 from mathematica.stackexchange.com 2019-08-18T03:43:34Z https://mathematica.stackexchange.com/feeds/question/89185 http://www.creativecommons.org/licenses/by-sa/3.0/rdf https://mathematica.stackexchange.com/q/89185 7 Integrate yielding a ConditionalExpression but I don't think the condition is necessary Seth Chandler https://mathematica.stackexchange.com/users/5775 2015-07-27T00:32:54Z 2015-07-27T18:20:33Z <p>Suppose I take the PDF of the LogNormal distribution with parameters m and s evaluated at x. I obviously get an expression involving m. I now want to integrate that expression not with respect to x but with respect to m as m goes from -infinity to infinity I get a ConditionalExpression that says the result is 1/x but on condition that x be less than 1. And, yet, if I NIntegrate the same expression when I make x greater than 1, I seem to always get the same result: 1/x. Why is Mathematica imposing what seems to be a needless condition on the result of the Integration? Why does it not know what the answer is when x>1?</p> <pre><code> pdfv=Refine[PDF[LogNormalDistribution[m,s],x],x&gt;0] Integrate[pdfv,{m,DirectedInfinity[-1],DirectedInfinity}] With[{v1 = PDF[LogNormalDistribution[m, 0.1], 2.5]}, NIntegrate[v1, {m, -\[Infinity], \[Infinity]}]] (* yields 0.4 *) With[{v2 = PDF[LogNormalDistribution[m, 0.1], 4.0]}, NIntegrate[v2, {m, -\[Infinity], \[Infinity]}]] (* yields 0.25 *) </code></pre> <p>For what it's worth, I'm trying to get the distribution of lognormal distributions from which a single result might have occurred if we know the underlying process was lognormal. ( We also have some prior belief as to the second parameter of the underlying lognormal.)</p> https://mathematica.stackexchange.com/questions/89185/-/89190#89190 9 Answer by Michael E2 for Integrate yielding a ConditionalExpression but I don't think the condition is necessary Michael E2 https://mathematica.stackexchange.com/users/4999 2015-07-27T02:37:34Z 2015-07-27T18:20:33Z <p><em>Mathematica</em> seems to split the integrand component,</p> <pre><code>E^(-((-m + Log[x])^2/(2 s^2))) </code></pre> <p>into</p> <pre><code>E^(-((m^2 + Log[x]^2)/(2 s^2))) </code></pre> <p>times the sort-of "coefficient"</p> <pre><code>E^((m Log[x])/s^2) (* == x^(m/s^2) *) </code></pre> <p>in order to calculate the integral in terms of Meijer \$G\$. For reasons that are obscure to me, it seems to want the coefficient of <code>m</code> in the exponent to be negative. (Most likely it's for the sake of convergence, but that condition is unnecessary.)</p> <p>Translation fixes it, by getting rid of the linear term that leads to the condition.</p> <pre><code>Assuming[x &gt; 0 &amp;&amp; s &gt; 0, Integrate[ pdfv /. m -&gt; m + Log[x], {m, DirectedInfinity[-1], DirectedInfinity}] ] (* 1/x *) </code></pre> <p>This supports the guess above. It seems like a minor(?) flaw in the algorithm.</p> <p><em>Hints:</em></p> <pre><code>Assuming[x &gt; 0 &amp;&amp; s &gt; 0, foo = Trace[ Integrate[pdfv, {m, DirectedInfinity[-1], DirectedInfinity}], _Integrate`ImproperDump`MeijerGfunction, TraceInternal -&gt; True, TraceAbove -&gt; True ]]; Assuming[x &gt; 0 &amp;&amp; s &gt; 0, Block[{Internal`Integrate`debugSwitch = 10}, Integrate[pdfv, {m, DirectedInfinity[-1], DirectedInfinity}] ]] </code></pre> <p>Look for <code>Log[x]/s^2</code> and <code>Log[x]&lt;0</code>.</p>