10 views

Uploaded by api-288731726

- Solution of Non Linear Equations
- MAXIMA AND MINIMA
- Programming for Computations - Python
- Programming for Computations – Python
- M.tech (CASAD) Course Structure 2012-14-Revised-Evaluation Scheme
- Scie Talk Fem
- Amano and Sunden -- Computational Fluid Dynamics and Heat Transfer
- Computer Simulation Using Differential-Algebraic Equation Solver
- M.sc Applied Mathematics
- TE Industrial
- LEC06_PT2_CH06 - Open Methods
- 52724290
- New Until Matlab Coding
- 0. SAP Metode Elemen Hingga
- An Improved Ray Tracing Algorithm
- Numerical Methods
- TIN206 9 Stepping Stone
- Mcasecond Semester
- hw3.docx
- lect_5.pdf

You are on page 1of 11

101071009

% DICallCK.m

function price = DICallCK(S0,X,r,T,sigma,Sb,Smax,dS,dt)

% set up grid and adjust increments if necessary

M = round((Smax-Sb)/dS);

dS = (Smax-Sb)/M;

N = round(T/dt);

dt = T/N;

matval = zeros(M+1,N+1);

vetS = linspace(Sb,Smax,M+1)';

vetj = 0:N;

veti = vetS / dS;

% set up boundary conditions

matval(:,N+1) = max(vetS-X,0);

matval(1,:) = 0;

matval(M+1,:) = 0;

alpha = 0.25*dt*( sigma^2*(veti.^2) - r*veti );

beta = -dt*0.5*( sigma^2*(veti.^2) + r );

gamma = 0.25*dt*( sigma^2*(veti.^2) + r*veti );

M1 = -diag(alpha(3:M),-1) + diag(1-beta(2:M)) - diag(gamma(2:M-1),1);

[L,U] = lu(M1);

M2 = diag(alpha(3:M),-1) + diag(1+beta(2:M)) + diag(gamma(2:M-1),1);

% solve the sequence of linear systems

for j=N:-1:1

matval(2:M,j) = U \ (L \ (M2*matval(2:M,j+1)));

end

% possibly with a linear interpolation

idown = floor((Sb-S0)/dS);

iup = ceil((Sb-S0)/dS);

if idown == iup

price = matval(idown+1,1);

else

n+1,1))/dS;

DownInCallCK1 =

5.2121

DownInCallCK2 =

7.9086

DownInCallCK3 =

6.4372

DownInCallCK4 =

2.4791

DownInCallCK5 =

0

DownInCallCK6 =

0

AmPutExpl1

% AmPutExpl1.m

function price = AmPutExpl1(S0,X,r,T,sigma,Smax,dS,dt)

% set up grid and adjust increments if necessary

M = round(Smax/dS);

dS = Smax/M;

N = round(T/dt);

dt = T/N;

matval = zeros(M+1,N+1);

vetS = linspace(0,Smax,M+1)';

vetj = 0:N;

veti = 0:M;

% set up boundary conditions

matval(:,N+1) = max(X-vetS,0);

matval(1,:) = X;

matval(M+1,:) = 0;

% set up coefficients

a = 0.5*dt*(sigma^2*veti - r).*veti;

b = 1- dt*(sigma^2*veti.^2 + r);

c = 0.5*dt*(sigma^2*veti + r).*veti;

% solve backward in time

for j=N:-1:1

for i=2:M

c(i)*matval(i+1,j+1));

end

end

% find closest point to S0 on the grid and return price

% possibly with a linear interpolation

idown = floor(S0/dS);

iup = ceil(S0/dS);

if idown == iup

price = matval(idown+1,1);

else

end

AmPutImpl

% AmPutImpl.m

function price = AmPutImpl(S0,X,r,T,sigma,Smax,dS,dt)

% set up grid and adjust increments if necessary

M = round(Smax/dS);

dS = Smax/M;

N = round(T/dt);

dt = T/N;

matval = zeros(M+1,N+1);

vetS = linspace(0,Smax,M+1)';

vetj = 0:N;

veti = 0:M;

% set up boundary conditions

matval(:,N+1) = max(X-vetS,0);

matval(1,:) = X;

matval(M+1,:) = 0;

a = 0.5*(r*dt*veti-sigma^2*dt*(veti.^2));

b = 1+sigma^2*dt*(veti.^2)+r*dt;

c = -0.5*(r*dt*veti+sigma^2*dt*(veti.^2));

coeff = diag(a(3:M),-1) + diag(b(2:M)) + diag(c(2:M-1),1);

[L,U] = lu(coeff);

% solve the sequence of linear systems

aux = zeros(M-1,1);

for j=N:-1:1

end

% find closest point to S0 on the grid and return price

% possibly with a linear interpolation

idown = floor(S0/dS);

iup = ceil(S0/dS);

if idown == iup

price = matval(idown+1,1);

else

end

AmPutCK

% AmPutCK.m

function price = AmPutCK(S0,X,r,T,sigma,Smax,dS,dt)

% set up grid and adjust increments if necessary

M = round(Smax/dS);

dS = Smax/M;

N = round(T/dt);

dt = T/N;

matval = zeros(M+1,N+1);

vetS = linspace(0,Smax,M+1)';

vetj = 0:N;

veti = vetS/dS;

% set up boundary conditions

matval(:,N+1) = max(X-vetS,0);

matval(1,:) = X;

matval(M+1,:) = 0;

alpha = 0.25*dt*( sigma^2*(veti.^2) - r*veti );

beta = -dt*0.5*( sigma^2*(veti.^2) + r );

gamma = 0.25*dt*( sigma^2*(veti.^2) + r*veti );

M1 = -diag(alpha(3:M),-1) + diag(1-beta(2:M)) - diag(gamma(2:M-1),1);

[L,U] = lu(M1);

M2 = diag(alpha(3:M),-1) + diag(1+beta(2:M)) + diag(gamma(2:M-1),1);

% solve the sequence of linear systems

for j=N:-1:1

matval(2:M,j) =max(X*ones(M-1,1)-vetS(2:M),U\(L\(M2*matval(2:M,j+1))));

end

% find closest point to S0 on the grid and return price

% possibly with a linear interpolation

idown = floor(S0/dS);

iup = ceil(S0/dS);

if idown == iup

price = matval(idown+1,1);

else

end

- Solution of Non Linear EquationsUploaded byRaju Sharma
- MAXIMA AND MINIMAUploaded byBilal Naseem
- Programming for Computations - PythonUploaded byMarcello Costa
- Programming for Computations – PythonUploaded byalfonso lopez alquisirez
- M.tech (CASAD) Course Structure 2012-14-Revised-Evaluation SchemeUploaded byKrunal Mehta
- Scie Talk FemUploaded byDrSomnath Bhattacharya
- Amano and Sunden -- Computational Fluid Dynamics and Heat TransferUploaded byseriouslion
- Computer Simulation Using Differential-Algebraic Equation SolverUploaded byRamaprasad Panda
- M.sc Applied MathematicsUploaded byagus_tri
- TE IndustrialUploaded byAbhishek Gawde
- LEC06_PT2_CH06 - Open MethodsUploaded bytlw_90
- 52724290Uploaded byKarunakar Metuku
- New Until Matlab CodingUploaded byIrfan Suhaimi
- 0. SAP Metode Elemen HinggaUploaded byTomy Nurtansyah
- An Improved Ray Tracing AlgorithmUploaded byJose Fernando
- Numerical MethodsUploaded byJose Espino
- TIN206 9 Stepping StoneUploaded byMalinda
- Mcasecond SemesterUploaded byArjun Singh
- hw3.docxUploaded by123ind
- lect_5.pdfUploaded byLuis Inga Marquez
- FormulasUploaded byAbi Abinaya
- Bisection Documentation (Yburan, Kyle Rhys a. , BSME-MDM5)Uploaded byKyle Rhys Yburan
- Walks.In.3-Stars.pdfUploaded bydragance106
- 32.2.yehUploaded byΜέμνων Μπερδεμένος
- Ch 3 NonLinearEquationsUploaded byoderamadhani
- ie471_hw3solUploaded bysmerino92
- AISB08Uploaded byavish_023
- Assignment 1SouUploaded byTigabu Yaya
- Process Optimization (Unconstrained Opt)Uploaded byleoshi_bishoujo
- projects05Uploaded bypostscript

- 12312312312Uploaded byapi-288731726
- hw9Uploaded byapi-288731726
- hw6Uploaded byapi-288731726
- hw3Uploaded byapi-288731726
- hw10 101071009Uploaded byapi-288731726
- hw11 101071009Uploaded byapi-288731726
- hw10 101071009Uploaded byapi-288731726
- hw9 101071009Uploaded byapi-288731726
- hw8 101071009Uploaded byapi-288731726
- hw7 101071009Uploaded byapi-288731726
- hw6 101071009Uploaded byapi-288731726
- hw5 101071009Uploaded byapi-288731726
- hw12Uploaded byapi-288731726
- hw6Uploaded byapi-288731726
- hw11Uploaded byapi-288731726
- hw9Uploaded byapi-288731726
- hw8Uploaded byapi-288731726
- hw7Uploaded byapi-288731726
- hw5Uploaded byapi-288731726
- hw4Uploaded byapi-288731726
- hw3Uploaded byapi-288731726
- hw2Uploaded byapi-288731726
- homework1and2Uploaded byapi-288731726
- 101071006 12Uploaded byapi-288731726
- 101071006 10Uploaded byapi-288731726
- 101071006 9Uploaded byapi-288731726
- 101071006 6Uploaded byapi-288731726
- 101071006 4Uploaded byapi-288731726
- 101071006 3Uploaded byapi-288731726

- Control systems in UWE AssignmentUploaded by2 ESR
- Research MethodologyUploaded byJagadish Sahu
- Application Differential CalculusUploaded byAshok
- sample1.pdfUploaded bySara Afify
- IE 416 Project1.1Uploaded byPeyman Panahi
- Understanding the Fast Fourier TransformUploaded byAnonymous UZ5xA8
- Lecture 1 - Design and Analysis of ExperimentsUploaded byNixon Joe Emmanuel
- 9794_s12_ms_1Uploaded byantonyluk
- 2 Sequences and Series for LmsUploaded bySaman Jayakadu
- Ch1-IntroUploaded bySukrit Ghorai
- 4. Method - Objectives of Teaching Life ScienceUploaded byDr. Tapan Kr. Dutta
- Katarina Obanovi Valentina Sokolovska Use of Statistical Methods in SociologyUploaded byPriyansh Agrawal
- Contoh Rubric for Mid Term Exam (PPC) 2015-2016Uploaded byCece Cheche
- 7 Titration CurvesUploaded byryan1230987
- Ee236a (Fall 2007-08)Uploaded bydebasis
- Chicago StatsUploaded byMayankGupta
- kaushik pmorUploaded byPrince Eshwar
- Tutorial 1_Introduction to Signals and SystemsUploaded byMirza Danish
- 73-220-Lecture01Uploaded byapi-26315128
- CCP303Uploaded byapi-3849444
- 180 Review Ex2Uploaded byAnonymous gUySMcpSq
- Discrete-time Fourier TransformUploaded byLucas Gallindo
- Error Propagation and AnalysisUploaded bypenriliris
- Pert CpmUploaded byNaveed Iqbal Salman
- Druskin-NLAA1995Uploaded bygioannidis49
- Turin IciUploaded byLameune
- chap_13_2Uploaded byapi-19746504
- MatheUploaded byNicolas Diaz
- Content ServerUploaded byZul Raka Karnaen
- Regression Write UpUploaded byAkshay Kakani