Namespace:
Imsl.Math
Assembly:
ImslCS (in ImslCS.dll) Version: 6.5.0.0
Syntax
C# |
---|
[SerializableAttribute] public class FeynmanKac |
Visual Basic (Declaration) |
---|
<SerializableAttribute> _ Public Class FeynmanKac |
Visual C++ |
---|
[SerializableAttribute] public ref class FeynmanKac |
Remarks
Class FeynmanKac solves the generalized Feynman-Kac PDE on a rectangular grid with boundary conditions using a finite element Galerkin method. The generalized Feynman-Kac differential equation has the form



![[x_{\min},x_{\max}] \times [\bar{T},T]](eqn/eqn_1133.png)

![[x_{\min},x_{\max}]](eqn/eqn_1135.png)




![x \in [x_i, x_{i+1}], \, h_i=x_{i+1}-x_i, \, z=(x-x_i)/h_i, z \in [0,1],](eqn/eqn_1140.png)



![f(x,t) = \sum_{i=1}^{3m}y_i\beta_i(x), \; x \in [x_{\min},x_{\max}],](eqn/eqn_1144.png)


This system is integrated using the variable order, variable step algorithm DDASLX
noted in Hanson, R. and Krogh, F. (2008),
Solving Constrained Differential-Algebraic Systems Using Projections. Solution values
and their time derivatives at a grid preceding time T,
expressed in units of time remaining, are given back by methods GetSplineCoefficients
and GetSplineCoefficientsPrime, respectively.
For further details of deriving and solving the system see Hanson, R. (2008),
Integrating
Feynman-Kac Equations Using Hermite Quintic Finite Elements. To evaluate f or its
partials at any
time point in the grid, use method GetSplineValue.
One useful application of the FeynmanKac class is financial analytics.
This is illustrated in Example 2, which solves a diffusion model for call options which, in the
special case reduces to the Black-Scholes (BS) model.
Another useful application for the FeynmanKac class is the calculation of the Greeks,
i.e. various derivatives of Feynman-Kac solutions applicable to, e.g., the pricing of options and
related financial derivatives. In Example 5, the FeynmanKac class is used to
calculate eleven of the Greeks for the same diffusion model introduced in Example 2
in the special BS case. These Greeks are also calculated using the BS closed form Greek equations
(see http://en.wikipedia.org/wiki/The_Greeks).
The Feynman-Kac and BS solutions are
output and compared. Example 5 illustrates that the FeynmanKac class can be used to
explore the Greeks for a much wider class of financial models than can BS.