out <- gauss.quad.prob(10,"normal")
sum(out$weights * out$nodes^4)
# the 4th moment of the standard normal is 3
out <- gauss.quad.prob(32,"gamma",alpha=5)
sum(out$weights * log(out$nodes))
# the expected value of log(X) where X is gamma is digamma(alpha)
Run the code above in your browser using DataLab