function [v,x,CALL]=calloptlogist(u,S0,ex,r,sigma,T) % 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 to %generate logisitic variate by inverse transform. T=maturity % to compare with Black-Scholes price, integrate over (0,1) or simulate using %U=rand(1,1000000); mean(calloptlogist(U,S0,ex,r,sigma,T)); b=.552; % This logistic has variance around 1. MUST HAVE b*sigma*sqrt(T)<1 lambda= log(gamma(1-b*sigma*sqrt(T))*gamma(1+b*sigma*sqrt(T)))/T ; x=S0*exp(b*log(u./(1-u))*sigma*sqrt(T)+r*T-lambda*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 [CALL,PUT] = BLSPRICE(S0,ex,r,T,sigma,0); % this is the corresponding Black-Scholes Price v=mean(v); % remove if you want the individual payoff (e.g. for variance)