Very slow infinite series with symsum in Matlab

583 Views Asked by At

I have the following infinite series which I need to evaluate. Currently, depending on the input parameters (kappa, sigmav, thetav) this functions takes very long to compute. Is there any possibility to speed it up? The time consuming expression is symsum(..., 0, Inf)

 j = sym('j', 'positive');
 c =  1/((1/2*kappav)*(sigmav^2)*(1-exp(-kappav*deltat)));
 lambda = 2*c*Vt*exp(-kappav*deltat);
 v = 4*thetav/sigmav^2;
 ez = 2*c*exp(Vtt);
 % 
 p = ((exp(-1/2*(ez+lambda))*ez^(1/2*v)) / ( 2^(0.5*v)))* ... 
   vpa( symsum(   ((1/4*ez*lambda)^j)/ (gamma(1/2*v+j)*factorial(j)) ,j, 0, Inf  ));

PS. this is the pdf for the non-central chi-square distribution, with some minor modifications, hence I cannot use ncx2pdf. I've already attempted https://stackoverflow.com/a/15966126/321749 which just results in infinity.

0

There are 0 best solutions below