Ben, Ravi, Chuck, and Haneef,

Note that the standard normal density can be written (in pseudo-TeX) as
1/sqrt(2*pi) * exp[- ( x/sqrt(2) )^2]. 

The exponential on the right is a special case of the stretched 
exponential function 
exp[- (x/sqrt(tau))^beta]. 

The stretched exponential function has a nontrivial density and 
distribution.  However, the nth  moment of this density is 
 tau^(n)/beta * Gamma[(n)/beta]. 

The  substitution of n=3/2 (not 1/2), tau=sqrt(2), and beta=2, and 
multiplying by 1/sqrt(2*pi)  yields the Mathematica result below.

See http://en.wikipedia.org/wiki/Stretched_exponential_function. The use 
of n=3/2 rather than 1/2 is required because the stretched exponential 
function is already a function for the first moment.

Joe




Ben Bolker <bolker@ufl.edu> 
Sent by: r-help-bounces@r-project.org
04/11/2010 01:09 AM

To
Ravi Varadhan <rvaradhan@jhmi.edu>
cc
"r-help@stat.math.ethz.ch" <r-help@stat.math.ethz.ch>
Subject
Re: [R] Expectation of E(x^1/2)






  And Mathematica says

In[2]:= 1/Sqrt[2 Pi] Integrate[Exp[-x^2/2] Sqrt[x],{x,0,Infinity}]

                3
          Gamma[-]
                4
Out[2]= -------------
         3/4
        2    Sqrt[Pi]

(I suppose there's probably a change-of-variables trick to do this ...)

in R:

> gamma(3/4)/(2^(3/4)*sqrt(pi))
[1] 0.4110895


Ravi Varadhan wrote:
> Chuck showed how to do this:
> 
> fn <- function(x) sqrt(x) * dnorm(x)
> 
>> integrate(fn, 0, Inf)
> 0.4110895 with absolute error < 4.7e-05
> 
> So the (almost) exact answer is  0.4110895 + 1i * 0.4110895 
>

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


	[[alternative HTML version deleted]]

