# Thread:

1. ## M(t) calculus - can you pls double check?

Hello...

Would someone please double check and see if I make mistakes in the calculus of this integral?

Thanks in advance!

$<br /> M_X(t)=\int_0^\infty 2 \lambda x\ e^{-\lambda{x^2}+tx} dx\<br />$

The exponent can be rewritten as:

$<br /> -\lambda{(x-\frac{t}{2\lambda})^2}+\lambda{(\frac{t}{2\lambda} )^2}<br />$ Therefore:

$<br /> M_X(t)=e^{\lambda{(\frac{t}{2\lambda})^2}}\int_0^\ infty 2 \lambda x\ e^{-\lambda{(x-\frac{t}{2\lambda})^2}} dx\ =\<br /> e^{\lambda{(\frac{t}{2\lambda})^2}}\int_0^\infty 2 \lambda (x-\frac{t}{2\lambda}+\frac{t}{2\lambda})\ e^{-\lambda{(x-\frac{t}{2\lambda})^2}} dx\ =\\<br />$

$<br /> =\ e^{\lambda{(\frac{t}{2\lambda})^2}}[\int_0^\infty 2 \lambda (x-\frac{t}{2\lambda})\ e^{-\lambda{(x-\frac{t}{2\lambda})^2}} dx\ +\ t\int_0^\infty e^{-\lambda{(x-\frac{t}{2\lambda})^2}} dx]\ =\\<br />$

$<br /> =\ e^{\lambda{(\frac{t}{2\lambda})^2}}[-e^{-\lambda{(x-\frac{t}{2\lambda})^2}}\mid_0^\infty\ +\ t\int_0^\infty e^{-\lambda{(x-\frac{t}{2\lambda})^2}} dx]\ =\\<br />$

I now convert the last remaining integral into normal gaussian of area 1/2 between zero and infinity:

$<br /> \mu=\frac{t}{2\lambda}\ ;\ \sigma^2=\frac{1}{2\lambda} \Rightarrow\ \ t\frac{\sigma\sqrt{2\pi}}{\sigma\sqrt{2\pi}}\int_0 ^\infty e^{-\frac{(x-\mu)^2}{2\sigma^2}}dx\ =\ \frac{t\sigma\sqrt{2\pi}}{2}\ =\ \mu\sqrt{\lambda\pi}\ ]<br />$

Therefore, substituting:

$<br /> M_X(t)=e^{\lambda\mu^2}[-e^{-\lambda{(x-\mu)^2}}\mid_0^\infty +\mu\sqrt{\lambda\pi}\ ] = e^{\lambda\mu^2}[e^{-\lambda{\mu^2}} +\mu\sqrt{\lambda\pi}\ ] = 1+\mu\sqrt{\lambda\pi}e^{\lambda\mu^2}<br />$

2. Originally Posted by paolopiace
Hello...

Would someone please double check and see if I make mistakes in the calculus of this integral?

Thanks in advance!

$<br /> M_X(t)=\int_0^\infty 2 \lambda x\ e^{-\lambda{x^2}+tx} dx\<br />$

The exponent can be rewritten as:

$<br /> -\lambda{(x-\frac{t}{2\lambda})^2}+\lambda{(\frac{t}{2\lambda} )^2}<br />$ Therefore:

$<br /> M_X(t)=e^{\lambda{(\frac{t}{2\lambda})^2}}\int_0^\ infty 2 \lambda x\ e^{-\lambda{(x-\frac{t}{2\lambda})^2}} dx\ =\<br /> e^{\lambda{(\frac{t}{2\lambda})^2}}\int_0^\infty 2 \lambda (x-\frac{t}{2\lambda}+\frac{t}{2\lambda})\ e^{-\lambda{(x-\frac{t}{2\lambda})^2}} dx\ =\\<br />$

$<br /> =\ e^{\lambda{(\frac{t}{2\lambda})^2}}[\int_0^\infty 2 \lambda (x-\frac{t}{2\lambda})\ e^{-\lambda{(x-\frac{t}{2\lambda})^2}} dx\ +\ t\int_0^\infty e^{-\lambda{(x-\frac{t}{2\lambda})^2}} dx]\ =\\<br />$

$<br /> =\ e^{\lambda{(\frac{t}{2\lambda})^2}}[-e^{-\lambda{(x-\frac{t}{2\lambda})^2}}\mid_0^\infty\ +\ t\int_0^\infty e^{-\lambda{(x-\frac{t}{2\lambda})^2}} dx]\ =\\<br />$

I now convert the last remaining integral into normal gaussian of area 1/2 between zero and infinity: Mr F says: This is your mistake. When the Gaussian has a mean of $\mu$, the area is 1/2 between $\mu$ and infinity. Only if the mean is equal to zero will what you've got here be true.

$<br /> \mu=\frac{t}{2\lambda}\ ;\ \sigma^2=\frac{1}{2\lambda} \Rightarrow\ \ t\frac{\sigma\sqrt{2\pi}}{\sigma\sqrt{2\pi}}\int_0 ^\infty e^{-\frac{(x-\mu)^2}{2\sigma^2}}dx\ =\ \frac{t\sigma\sqrt{2\pi}}{2}\ =\ \mu\sqrt{\lambda\pi}\ ]<br />$

Therefore, substituting:

$<br /> M_X(t)=e^{\lambda\mu^2}[-e^{-\lambda{(x-\mu)^2}}\mid_0^\infty +\mu\sqrt{\lambda\pi}\ ] = e^{\lambda\mu^2}[e^{-\lambda{\mu^2}} +\mu\sqrt{\lambda\pi}\ ] = 1+\mu\sqrt{\lambda\pi}e^{\lambda\mu^2}<br />$
..

3. ## Mr. F, Thanks...

... believe it or not, this error came to my brain tonight. Problem is that if I make mu=0, the starting point of the integral changes and that area cannot be calculated analytically (or... can it?).

It seems this problem is not resolvable with regular analytical tools.

Mr.F, what do you suggest?

4. Originally Posted by paolopiace
... believe it or not, this error came to my brain tonight. Problem is that if I make mu=0, the starting point of the integral changes and that area cannot be calculated analytically (or... can it?).

It seems this problem is not resolvable with regular analytical tools.

Mr.F, what do you suggest?
When an integral does not have a known closed form what we do is invent
a new function who's derivative is the integrand.

$\int_0^\infty e^{-\lambda{(x-\frac{t}{2\lambda})^2}} dx = \lambda^{-1/2}\ {\rm{erfc}}\left(-\frac{t}{2 \sqrt(\lambda)}\right)$
$=\lambda^{-1/2}\left[1-{\rm{erf}}\left(-\frac{t}{2 \sqrt(\lambda)}\right)\right]$

In this case you need the error function ${\rm{erf}}(x)$, or the complementary error function ${\rm{erfc}}(x)$,
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 20, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9053366780281067, "perplexity_flag": "middle"}