%
%  math495/stat490 -- 24 sept 03 -- djm
%
%  w04fun.m:  

clear

%  initialize settings
%randn('state',1234567)
Nrvs = 1000;  x_mean = 2;
sigma2 = input('\sigma^2 = ');

%  random variables
x_rv = x_mean + sqrt(sigma2)*randn(Nrvs,1);
h_rv = exp(-x_rv);

%  statistics
h_mean = mean(h_rv);  
differ = h_mean - exp(-x_mean);  differ1 = h_mean - exp(-mean(x_rv));
h_var  =  var(h_rv);

disp(['mean h(x) - h(mean) = ' num2str(differ)]);
disp(['var  h(x) = '           num2str(h_var )]);
