4703-10-Fall-h8-solu

4703-10-Fall-h8-solu - N = 100 A = 0.6269 2. SOLUTION:...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
IEOR 4703: Solutions to Homework 8 1. SOLUTION: clear all close all r=0.05; sigma=0.04; mu=r-sigma^2/2; S0=35; t=4; %Exact Simulation (for your reference) M=10000; X=mu+sigma*randn(t,M); X=tril(ones(t,t))*X; S1=S0*exp(X); Y1=exp(-r*t)*max(0,mean(S1)-40); option_price=mean(Y1) %Euler Method (actual answere) A=0; N=50; n=1000; %Repeat Euler method until the error is less than 0.01 while(abs(A-0.64)>=0.02) N h=t/N; V=1+r*h+sigma*sqrt(h)*randn(N,n); S2=S0*cumprod(V); % S2(1,:)=S0*V(1,:); % for i=1:N-1 % S2(i+1,:)=S2(i,:).*V(i+1,:); % end Y2=exp(-r*t)*max(0,1/4*(S2(floor(N/t),:)+S2(floor(N/t*2),:)+S2(floor(N/t*3),:)+S2(fl o A=mean(Y2) %Stop the program when something is wrong if N>6400 break; end N=N*2; end %Note: depend on each simulation the N may vary a lot 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
option_price = 0.6372 N = 50 A = 0.5465
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: N = 100 A = 0.6269 2. SOLUTION: clear all close all X0=0; sigma=1; alpha=10; n=1000; t=10; N1=100 h=t/N1; X1=zeros(N1,n); %Euler Method X1(1,:)=X0-alpha*X0*h+sigma*sqrt(h)*randn(1,n); for i=2:N1 X1(i,:)=X1(i-1,:)-alpha*X1(i-1,:)*h+sigma*sqrt(h)*randn(1,n); end EX_10=mean(X1(N1,:)) VX_10=var(X1(N1,:)) %plot one sample path figure(1) plot([h:h:t],X1(:,1)) 2 N2=200 h=t/N2; X2=zeros(N2,n); X2(1,:)=X0-alpha*X0*h+sigma*sqrt(h)*randn(1,n); for i=2:N2 X2(i,:)=X2(i-1,:)-alpha*X2(i-1,:)*h+sigma*sqrt(h)*randn(1,n); end EX_10=mean(X2(N2,:)) VX_10=var(X2(N2,:)) figure(2) plot([h:h:t],X2(:,1)) %E[X(10)]=0 and Var(X(10))=0.05 N1 = 100 EX_10 = 0.0109 VX_10 = 0.1016 N2 = 200 EX_10 =-0.0064 VX_10 = 0.0679 3 4...
View Full Document

Page1 / 4

4703-10-Fall-h8-solu - N = 100 A = 0.6269 2. SOLUTION:...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online