Quantitative finance collector
C++ Matlab VBA/Excel Java Mathematica R/Splus Net Code Site Other

Quantitative Finance Collector is a blog on Quantitative finance analysis, financial engineering methods in mathematical finance focusing on derivative pricing, quantitative trading and quantitative risk management. Random thoughts on financial markets and personal staff are posted at the sub personal blog.

Apr 29
Finite difference method has been repeatedly introduced to solve partial differential equation (PDE), for example, in past entries Crank-Nicholson finite difference solution of American option, Crank-Nicolson for a European put, PSOR for American option, etc.

here is a Finite Difference Method for EXCEL addin which contains macro to solve numerically partial differential equations (PDE) and ordinary differential equations (ODE) with the Finite Differences Method (FD). Seems it can only be applied for two dimensional problem, but should be enough for normal cases me meet.

Document and macro are at: http://digilander.libero.it/foxes/diffequ/fdsolver_review.htm
Oct 6
Crank-Nicolson for a European put was introduced before, to better master this technique, i share another sample code using Crank-Nicholson finite difference for American option.

BLSPRICEFDAM Black-Scholes put and call pricing for American Options using the Crank-Nicholson finite difference solution of Black-Scholes  Partial differential equation. Note that this function returns an approximate solution unlike the analytical solution (BLSPRICE)
SO is the current asset price, X is the exercise price, R is the risk-free interest rate, T is the time to maturity of the option in years, SIG is the standard deviation of the annualized continuously compounded rate of return of the asset (also known as volatility), and Q is the dividend rate of the asset.  The default Q is 0. N denotes the number of discretization points in the stock price domain, and M denotes the number of discretization points in time domain used for the PDE solution.Try increasing either of M or N to achieve greater efficiency.

lecture notes can be downloaded at http://www.cs.cornell.edu/Info/Courses/Spring-98/CS522/home.html and matlab file http://www.cs.cornell.edu/Info/Courses/Spring-98/CS522/content/blspricefdam.m.
Tags: , ,
Sep 29
Basically there are two types of finite difference methods: explicit finite difference method and implicit finite difference method. Other types are just the derivation of these two types, for example, Crank-Nicolson method is an average of the explicit method and implicit method.

Two sample Matlab files to compare the performance of solving PDE via implicit and explicit method. http://frontera.bu.edu/MathFn.html
Tags:
Sep 5
A PDE can be solved by Finite Difference or Finite Element method, both methods require space discretization, therefore, explicit or implicit finite difference is applied for this problem. The advantage of explicit finite difference is it does not require matrix inversion, however, to satisfy CFL condition, dt (time interval) can not be too small to prevent from non-convergece result, Crank-Nicolson is supposed to balance between explicit and implicit finite difference by choosing theta=1/2, which means taking average of explicit and implicit method.
Tags:
Sep 3
Recently I have been working on pricing a high dimensional (4 dimension, actually) derivative via partial differencial equation (PDE), which can be solved numerically by Finite Element or Finite Difference method. Indeed Matlab has a PDE toolbox to use, however, as I know, this PDE toolbox can only calculate two dimensional problem, for instance, stock and time dimension as Black Scholes model does.

For your attention, I found an excellent Finite Element package named Getfem++ written in C++, as its webpage says, "The Getfem++ project focuses on the development of a generic and efficient C++ library for finite element methods. The goal is to provide a library allowing the computation of any elementary matrix (even for mixed finite element methods) on the largest class of methods and elements, and for arbitrary dimension (i.e. not only 2D and 3D problems). " what's more interesting is this library can be linked easily to Matlab.

We know Finite Element method is an alternative to Finite Difference discretization of the BS and other equations in the price resp. the log-price space variable. The advantage of FE is that it gives convergent deterministic approximations of the option price under realistic, low smoothness assumptions on the payoff function, as e.g. for binary contracts and in particular allow a higher rate of convergence that that achievable with Monte Carlo simulations.
Pages: 1/1 First page 1 Final page [ View by Articles | List ]