Aug
24

## PSOR for American option

We often have to price the American Option with Linear Complementarity Formulation when using finite difference method. One of methods for solving linear complementarity problem is

x'(Ax - b) = 0

x >= 0

Ax - b >= 0

using the

function [x] = psor(A,b,x0)

omega = 1.5;

tol = 1e-9;

jmax = 1e+3;

n = length(b); x = x0; j = 1;

for i = 1:n

x(i) = max(0,x(i)+omega*(b(i)-A(i,:)*x)/A(i,i));

end

while (norm(x-x0) > tol) && (j < jmax)

j = j + 1; x0 = x;

for i = 1:n

x(i) = max(0,x(i)+omega*(b(i)-A(i,:)*x)/A(i,i));

end

end

return

A problem with this sample code is slow computation speed, Should you are happy with C++, the following C++ code which can be called directly in Matlab.

wiki(Linear complementarity problem)

Hot posts:

15 Incredibly Stupid Ways People Made Their Millions

Online stock practice

Ino.com: Don't Join Marketclub until You Read This MarketClub Reviews

World Changing Mathematical Discoveries

Value at Risk xls

Random posts:

Pricing American Options

NAAIM 2012 Competition For Advances in Active Investment Management - $10,000 Award

Option greeks analysis

Sobol and Generalised Faure sequences

Any Good Way To Import A Large CSV File Into MySql

**Projected Successive Over Relaxation (PSOR)**, which is iterative and tries to solve the following formulation:x'(Ax - b) = 0

x >= 0

Ax - b >= 0

using the

**projected SOR**algorithm. Here is a sample Matlab code showing the basic algorithem of**PSOR**,function [x] = psor(A,b,x0)

omega = 1.5;

tol = 1e-9;

jmax = 1e+3;

n = length(b); x = x0; j = 1;

for i = 1:n

x(i) = max(0,x(i)+omega*(b(i)-A(i,:)*x)/A(i,i));

end

while (norm(x-x0) > tol) && (j < jmax)

j = j + 1; x0 = x;

for i = 1:n

x(i) = max(0,x(i)+omega*(b(i)-A(i,:)*x)/A(i,i));

end

end

return

A problem with this sample code is slow computation speed, Should you are happy with C++, the following C++ code which can be called directly in Matlab.

Download

wiki(Linear complementarity problem)

**People viewing this post also viewed:**

Hot posts:

Random posts: