function g = tran_payoff_put(xgrid,tau,k) % TRAN_PAYOFF_PUT - the transformed payoff for a put % see page 166 of Wilmott's book (epage 184) % % Checked: 2008-11-16 ... no errors found % % Written by: % -- % John L. Weatherwax 2008-06-11 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- % convert to a column vector: xgrid = xgrid(:); nx = length(xgrid); % the transformed payoff: g = exp( 0.25*((k+1)^2)*tau ) * max( [ exp( 0.5*(k-1)*xgrid ) - exp( 0.5*(k+1)*xgrid ), zeros(nx,1) ], [], 2 ); % special cases for the endpoints: %%%g(1) = exp( 0.25*((k+1)^2)*tau ) * exp( 0.5*(k-1)*xgrid(1) ) * exp( -k*tau ); %%%g(end) = 0.0;