0
$\begingroup$

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.

$\endgroup$
  • 2
    $\begingroup$ Apparently this is a mis-interpretation of $[-1,1]$. It's an interval, right? Then you mean a uniform distribution on $[-1,1]$... so deltas are wrong. $\endgroup$ – Jens Jul 14 '17 at 18:45
  • 1
    $\begingroup$ I'm not sure what is being asked. Is there some reason to believe that the result of the 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$ – Daniel Lichtblau Jul 14 '17 at 23:57
2
$\begingroup$

I would proceed as follows. Define a transformed distribution.

dist = TransformedDistribution[
   x + 2 y - 1, {x \[Distributed] NormalDistribution[μ, σ],
     y \[Distributed] BernoulliDistribution[1/2]}];

This has the expected properties

{Mean[dist], Variance[dist]}
(* {μ, 1 + σ^2} *)

and the PDF can be computed easily

PDF[dist, x]
(* (E^(-((1 + x - μ)^2/(2 σ^2))) + E^(-((1 - x + μ)^2/(
  2 σ^2))))/(2 Sqrt[2 π] σ) *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.