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 Ravi. ____________________________________________________________________ Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu ----- Original Message ----- From: Ben Bolker <bol...@ufl.edu> Date: Sunday, April 11, 2010 1:00 am Subject: Re: [R] Expectation of E(x^1/2) To: r-h...@stat.math.ethz.ch > Haneef Anver <haneef9 <at> yahoo.com> writes: > > > I am trying to find the expectation of x^1/2 where x~N(a,b) > > ( Normal with mean a and variance b). > > Any feedback would be highly appreciated. > > I have no idea at the moment how to start doing > this analytically, but is this at all helpful? > > > mean(sqrt(complex(re=rnorm(1000000)))) > [1] 0.4114712+0.4103866i > > ______________________________________________ > R-help@r-project.org mailing list > > PLEASE do read the posting guide > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ 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.