# Math Help - Simulation

1. ## Simulation

Good evening,

I need a wee help with this proof:

E[e^-x^2] = 1/sqrt((2*sigma^2)+1)

I need to use Monte Carlo for the proof...

thanks !

2. Originally Posted by WeeG
Good evening,

I need a wee help with this proof:

E[e^-x^2] = 1/sqrt((2*sigma^2)+1)

I need to use Monte Carlo for the proof...

thanks !
Your problem is incorectly stated, the expectation $E(e^{-x^2})$ is a pure number and does not depend on the parameter $\sigma$, but does depend on the distribution of $x$ (not just its standard deviation).

RonL

3. of course you are right, I forgot to write the first line of the question...

X~N(0,sigma^2)

sorry for that !!

4. Originally Posted by WeeG
of course you are right, I forgot to write the first line of the question...

X~N(0,sigma^2)

sorry for that !!
I'm not entirely clear what you mean by prove in this case. As most Monte-Carlo methods will give as estimate of the integral rather than its exact value (here I exclude tricks like Martin Baal's martingale based variance reduction technique which for his toy problem gave the exact value of the pertinent integral).

What we can do is by a bit of manipulation show that:

$E(e^{-x^2})=\frac{k}{\sqrt{2\sigma^2+1}}$

when $x \sim N(0,\sigma^2)$, for some $k$ (a very specific $k$ given by the integral remaining after the jiggery-pokerry required to get all the $\sigma$ dependence outside the integral).

Then show that $k \approx 1$ by Monte-Carlo methods.

RonL

5. Originally Posted by CaptainBlack
I'm not entirely clear what you mean by prove in this case. As most Monte-Carlo methods will give as estimate of the integral rather than its exact value (here I exclude tricks like Martin Baal's martingale based variance reduction technique which for his toy problem gave the exact value of the pertinent integral).

What we can do is by a bit of manipulation show that:

$E(e^{-x^2})=\frac{k}{\sqrt{2\sigma^2+1}}$

when $x \sim N(0,\sigma^2)$, for some $k$ (a very specific $k$ given by the integral remaining after the jiggery-pokerry required to get all the $\sigma$ dependence outside the integral).

Then show that $k \approx 1$ by Monte-Carlo methods.

RonL

To demonstrate:

Code:
This is EULER, Version 2.3 RL-06.
Type help(Return) for help.
Enter command: (20971520 Bytes free.)
Processing configuration file.
Done.
>
>sigma=2;  ..set a nominal sigma of 2
>
>x=normal(1,10000)*sigma;..genrt sample of X~N(0,sigma^2)
>ii=exp(-x^2);  ..calculate exp(-x^2) for the sample of X
>
>..now estimate the expectation as the average:
>..============================================
>
>{expectation,sdexp}=mean(ii)
0.335965
>
>..estimate k as the expectation times sqrt(2*sigma^2+1)
>..=====================================================
>
>kk=expectation*sqrt(2*sigma^2+1)
1.0079
>
>..estimate the standard error of expectation:
>..-------------------------------------------
>
>SEexp=sdexp/sqrt(length(ii))
0.00335965
>
>..estimate the se of the estimate of kk:
>..--------------------------------------
>
>SEkk=SEexp*sqrt(2*sigma^2+1)
0.010079
>
RonL

6. thanks a million, I'll try to translate this code to R and see I can use it

7. the code works, I tried it on R, it's superb !