
function f=fn(u)
% for stratified-antithetic
%mean(.37*.5*(fn(.47+.37*U)+fn(.84-.37*U))+.16*.5*(fn(.84+.16*U)+fn(1-.16*U)))
% discounted payoff for  call option with %exercise price K, r=annual interest rate, %sigma=annual vol, S0=current stock price, %u=vector of uniform (0,1) input to generate %normal variate by inverse transform. %T=maturity (years)
%(For Black-Scholes price, integrate over(0,1)).
S0=10 ;K=10;r=.05; sigma=.2 ;T=.25 ;   % Values of parameters
ST=S0*exp(norminv(u,T*(r-sigma^2/2),sigma*sqrt(T)));
f=exp(-r*T)*max((ST-K),0);
