Dirichlet boundary conditions, where the unknown function is known on some parts of the boundary
In quantitative finance this situation for instance occurs in the valuation of barrier options.
Neumann boundary conditions, where the value of the normal derivative is known
For most applications in quantitative finance the h can be chosen equal to zero.
Implementation of Dirichlet boundary conditions:
Dirichlet boundary conditions are straightforward to implement: The simplest way is to keep the equations in the assembled matrix and to set the diagonal matrix
entry for each known nodal value equal to 1 and all other entries in this row to 0.
Assume that the value of the unknown function at node 3 in the example presented in last weeks post is known, Φ(x3, y3 )=g3. The matrix and the right-hand side vector would in this case have the form
While this method is straightforward and easy to implement, it has two drawbacks: First, known values are kept in the set of equations as unknown values, and second, the method destroys the symmetry of the coefficient matrix. The second method I want to present -which is only a slight modification of the first one - accomplishes the same goal but preserves the symmetry of the matrix. Again, we keep the equations in the assembled matrix, but now multiply the diagonal matrix entry for each known nodal value with l, where l is a number several orders of magnitude larger than
The method is easy to understand by dividing all entries of the row corresponding to the known value by its diagonal entry (including the right-hand side vector). This yields a diagonal entry equal to unity and very small off-diagonal values (order 1/l) in the matrix, and the known nodal value in the right-hand-side vector. This is essentially the same result as obtained with method one.
In the next post I will show how to implement Neumann boundary conditions in a finite element setup.
It will be published on Tuesday the 20th of August. The post excerpts a chapter of the book A Workout in Computational Finance.