Package com.imsl.math
Interface FeynmanKac.ForcingTerm
- Enclosing class:
- FeynmanKac
public static interface FeynmanKac.ForcingTerm
Public interface for non-zero forcing term in the Feynman-Kac equation.
-
Method Summary
Modifier and TypeMethodDescriptionvoidforce(int interval, double[] y, double time, double width, double[] xlocal, double[] qw, double[][] u, double[] phi, double[][] dphi) Computes approximations to the forcing term \(\phi(f,x,t)\) and its derivative \(\partial \phi/\partial y\).
-
Method Details
-
force
void force(int interval, double[] y, double time, double width, double[] xlocal, double[] qw, double[][] u, double[] phi, double[][] dphi) Computes approximations to the forcing term \(\phi(f,x,t)\) and its derivative \(\partial \phi/\partial y\).- Parameters:
interval- anint, the index related to the integration interval[xGrid[interval-1], xGrid[interval]].y- an inputdoublearray of length3*xGrid.lengthcontaining the coefficients of the Hermite quintic spline representing the solution of the Feynman-Kac equation at time pointtime. For each $$ x \in [x_i,x_{i+1}], \, h_i=x_{i+1}-x_i, z_i=(x-x_i)/h_i,\,i=1,\ldots, \text{xGrid.length}-1 $$ the approximate solution is locally defined by $$ f(x,t) = f_ib_0(z)+f_{i+1}b_0(1-z)+h_i f_i' b_1(z)-h_i f_{i+1}' b_1(1-z)+ h_i^2f_i''b_2(z)+h_i^2f_{i+1}''b_2(1-z). $$ The values \( y_i=f_i, \, y_{i+1}=f_i', \, y_{i+2}=f_i'', \; i=1,4,7,\ldots,3\cdot \mbox{xGrid.length}-2, \) are stored as successive triplets iny.time- adouble, the time point.width- adouble, the width of the integration interval,width=xGrid[interval]-xGrid[interval-1].xlocal- an inputdoublearray containing the Gauss-Legendre points translated and normalized to the interval[xGrid[interval-1], xGrid[interval]].qw- an inputdoublearray containing the Gauss-Legendre weights.u- an inputdoublearray of dimension12 by xlocal.lengthcontaining the basis function values that define \(\tilde{\beta}(x)\) at the Gauss-Legendre pointsxlocal. Setting $$ u_{k,i}:=\text{u[k][i]} \quad \mbox{and} \quad x_i:=\text{xlocal[i]} \,, $$ vector \(\tilde{\beta}(x_i)\) is defined as $$ \tilde{\beta}(x_i):=(\beta_{3*(\text{interval}-1)}(x_i),\ldots, \beta_{3*\text{interval}+2}(x_i))^T = (u_{0,i},u_{1,i},u_{2,i},u_{6,i},u_{7,i},u_{8,i})^T \,. $$phi- an outputdoublearray of length 6 containing Gauss-Legendre approximations for the local contributions $$ \phi_t := \int_{\text{xgrid[interval-1]}}^{\text{xgrid[interval]}}\phi(f,x,t) \tilde{\beta}(x) dx, $$ wheret=timeand \( \tilde{\beta}(x):=(\beta_{3*(\text{interval}-1)}(x),\ldots,\beta_{3*\text{interval}+2}(x))^T. \) Denoting bydegreethe number of Gauss-Legendre points (xlocal.length) and setting \(x_j:=\text{xlocal[j]}\), vectorphicontains elements $$ \text{phi[i]} = \text{width}*\sum_{j=0}^{\text{degree-1}}\text{qw}[j]\,\tilde{\beta}_i(x_j)\,\phi(f,x_j,t) $$ fori=0,...,5.dphi- an outputdoublearray of dimension6 by 6containing a Gauss-Legendre approximation for the Jacobian of the local contributions \(\phi_t\) at time pointt=time, $$ \frac{\partial \phi_t}{\partial y}=\int_{\text{xgrid[interval-1]}}^{\text{xgrid[interval]}} \frac{\partial \phi (f,x,t)}{\partial f} \,\tilde{\beta}(x)\,\tilde{\beta}^T(x)dx\,. $$ The approximation to this symmetric matrix is stored row-wise, i.e. $$ \text{dphi[i][j]} = \text{width} * \sum_{k=0}^{\text{degree-1}}\text{qw}[k]\,\tilde{\beta}_i(x_k)\,\tilde{\beta}_j(x_k) \left. \frac{\partial{\phi}}{\partial f}\right|_{x=\text{xlocal}[k],\,t=\text{time}} $$ fori,j=0,...,5.
-