# Simplify expectation/integral over PDF

Posted 3 months ago
447 Views
|
3 Replies
|
2 Total Likes
|
 Integrating over x on a Normal-PDF, I expect the answer to simplify to mu. However, this does not seems to work: FullSimplify[Integrate[(1/(s*Sqrt[2*Pi]))*exp[-0.5*(((x-m)/s)^2)], x], s \[Element] Reals \[And]s>0\[And]x\[Element] Reals\[And] m \[Element] Reals] What am I forgetting?(for convenience: mu is abbreviated m, sigma is abbreviated s) Answer
3 Replies
Sort By:
Posted 3 months ago
 Try: FullSimplify[ Integrate[(1/(s*Sqrt[2*Pi]))*Exp[-1/2*(((x - m)/s)^2)], x], s \[Element] Reals \[And] s > 0 \[And] x \[Element] Reals \[And] m \[Element] Reals] (*-(1/2) Erf[(m - x)/(Sqrt s)]*) Integrate[(1/(s*Sqrt[2*Pi]))*Exp[-1/2*(((x - m)/s)^2)], {x, -Infinity, Infinity}, Assumptions -> {s > 0, m > 0}] (* 1 *) Integrate[(1/(s*Sqrt[2*Pi]))*Exp[-1/2*(((x - m)/s)^2)], {x, 0, Infinity}, Assumptions -> {s > 0, m > 0}] (*1/2 (1 + Erf[m/(Sqrt s)])*) Answer
Posted 3 months ago
 Capital E on exp, of course. Ouch. Thank you. Also: How 0.5 vs 1/2 results in different output.So this returns mu: FullSimplify[ Integrate[x*(1/(s*Sqrt[2*Pi]))*Exp[-1/2*(((x-m)/s)^2)], {x, -Infinity, Infinity}], s \[Element] Reals \[And]s>0\[And]x\[Element] Reals\[And] m \[Element] Reals] Answer
Posted 3 months ago
 Looks different, but answer is the same.Try: Integrate[ x*(1/(s*Sqrt[2*Pi]))*Exp[-0.5*(((x - m)/s)^2)], {x, -Infinity, Infinity}, Assumptions -> {s > 0, m > 0}] f[m_] := m; Table[ Plot[{Evaluate[INT] // Re, f[m]}, {m, 0.01, 10}, PlotStyle -> {Black, {Dashed, Red}}, PlotLegends -> {"integral with 0.5 not 1/2", "f[m]"}], {s, 1, 10, 1/2}] (*s from: 1 to 10 and m from: 0.01 to 10*) Answer