I want to implement the following function in Matlab, Pnk:
Following, I want to implement a different function, which uses a double sum over different values of n and k inputted in the Pnk function and another function In:
I am having trouble implementing these function in an efficient way in Matlab. I have succesfully implemented them by storing the values of n and k in vectors and evaluating each combination respectively, but this is computationally very intensive. What is the most efficient way so that I can input vectors for n and k in the Pnk function, and later take the double sum for k = 1:n and n = 1:Inf (or cap it at a certain upper bound, i.e. n = 15)?
FYI: these functions are used in the computation of option pricing using the Kou model (http://www.columbia.edu/~sk75/MagSci02.pdf)
EDIT: The model can be succesfully implemented in Mathematica using the code of Andrzej Kozlowski http://demonstrations.wolfram.com/OptionPricesInTheKouJumpDiffusionModel/
The specific part this question is about is coded in Mathematica in the following way:
With[{w = 15},
Exp[(\[Sigma]*\[Eta]1)^2*T/2]/(Sqrt[2*\[Pi]*T]\*\[Sigma]\)*
Sum[Exp[-\[Lambda]*T*(\[Lambda]*T)^n/n!*
PP[n, k, p, \[Eta]1, \[Eta]2]*(\[Sigma]*Sqrt[T]*\[Eta]1)^k*
II[k - 1][a - \[Mu]*T, -\[Eta]1, -1/(\[Sigma]*Sqrt[T]),
-\[Sigma] \[Eta]1 Sqrt[T]]
, {n, 1, w}, {k, 1, n}]
and with PP and II the respective function Pnk and In.
In Mathematica the function: Sum[f,{i,imin,imax},{j,jmin,jmax},…] exists, which is used in the above manner with f evaluated for: {n, 1, w}, {k, 1, n}.
Could somebody help me with the correct Matlab syntax in order to evaluate this double summation in a proper way?