function [est,var1,var2]=control(f,g,intg,n)
%[est,var1,var2]=control(f,g,intg,n) 
%runs a simulation on the function f using control variate g (both characcere strings) n times.
% intg is the integral of g
%outputs estimator and variances with and without control variate.
U=unifrnd(0,1,1,n);
FN=eval(strcat(f,'(U)'));
CN=eval(strcat(g,'(U)'));
est=intg+mean(FN-CN);
var1=var(FN);
var2=var(FN-CN);

