Wolfram Alpha is giving two different results for the same computation - why?

549 Views Asked by At

I'm exploring the convolution of a rectangle function scaled by a factor of $\displaystyle{n}$ with a Gaussian function/standard normal distribution of varying parameters (example 1, 2, 3) using Wolfram Alpha. Unfortunately, Wolfram Alpha seems to return inconsistent results:

Result 1

vs.

Result 2

Wolfram Alpha confirms mathematically equivalent inputs, i.e. a scaled unit box function as the first function and a Gaussian function/standard normal distribution as the second function. However, the output is different - note the different power of $\displaystyle{n}$:

$\displaystyle\frac{1}{{2}}{n}^{2}{\left({e}{r} f{{\left(\frac{{\mu-{y}+\frac{1}{{2}}}}{{\sqrt{{{2}}}\sigma}}\right)}}-{e}{r} f{{\left(\frac{{\mu-{y}-\frac{1}{{2}}}}{{\sqrt{{{2}}}\sigma}}\right)}}\right)}$

vs.

$\displaystyle\frac{1}{{2}}{n}\sqrt{{\pi}}{\left({e}{r} f{{\left(\frac{1}{{2}}-{y}\right)}}+{e}{r} f{{\left({y}+\frac{1}{{2}}\right)}}\right)}$

How is this possible?

The question was how a constant scaling of the rectangle function effects the convolution. My expectation was a constant scaling of the convolved function, i.e. result 2, but Wolfram Alpha gives a quadratic scaling in result 1.

2

There are 2 best solutions below

9
On

As others have said these are not "the same calculation". The Gaussian is the integral of $e^{-x^2}$, not $e^{-x^2}$ itself.

0
On

This is not an answer. Just posting what Mathematica gives for comparison since the commands given are not left to interpretation (as is the case with WA)

Command:

Convolve[n UnitBox[x],Exp[-x^2],x,y]

Result: $$ \frac{1}{2} \sqrt{\pi } n \left(\text{erf}\left(\frac{1}{2}-y\right)+\text{erf}\left(y+\frac{1}{2}\right)\right) $$

Command:

Convolve[n UnitBox[x],PDF[ NormalDistribution[[Mu],[Sigma]],x],x,y]

Result: $$ \frac{1}{2} n \left(\text{erf}\left(\frac{-2 \mu +2 y+1}{2 \sqrt{2} \sigma }\right)+\text{erf}\left(\frac{2 \mu -2 y+1}{2 \sqrt{2} \sigma }\right)\right) $$

You can copy and paste these commands into WA to verify.

Edit: It looks like for the second one WA prefers if you write Convolve[n UnitBox[x],gaussian,x,y]. Either way there is no n^2 in the answer.