I'm trying to get Mathematica to perform the convolution I need. I think it's fairly simple, just a convolution between a Normal
distribution and a Uniform
distribution on [-1,1]
. A friend of mine mentioned using the delta function to do so but I'm not sure how to evaluate it correctly in Mathematica... Below is my attempt:
Integrate[PDF[NormalDistribution[μ, σ]][x-y](DiracDelta[# + 1] + DiracDelta[# - 1])/2&[y],
{y, -Infinity, Infinity}]
However, the output when I plot the solution seems readily wrong. I believe my problem is in how I'm implementing the DiracDelta
. Any help would be greatly appreciated.
Integrate
above is not correct? I get:(E^(-((1 + x - \[Mu])^2/(2 \[Sigma]^2))) + E^(-((1 - x + \[Mu])^2/( 2 \[Sigma]^2))))/(2 Sqrt[2 \[Pi]] \[Sigma])
and it seems to behave as expected. $\endgroup$