function v=calloptstud(u,S0,ex,r,sigma,T,nu) % value of the integrand for a call option with exercise price ex, r=annual interest % rate, sigma=annual vol, S0=current stock price. u=uniform (0,1) input t %generate student t (with nu degrees of freedom) variate by inverse transform. T=maturity % to compare with Black-Scholes price, integrate over (0,1) or simulate using %U=rand(1,100000); mean(calloptstud(U,S0,ex,r,sigma,T,nu)); x=S0*exp((tinv(u,nu)+r*T-sigma^2*T/2)*sigma*sqrt(T))); %\ \ \ stock price at time T v=exp(-r*T)*max((x-ex),0); % \ This is the discounted to present value of the call option}