Serving the Quantitative Finance Community

 
User avatar
Alan
Posts: 3050
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

Bessel Function for Heston's model

November 13th, 2006, 5:28 pm

QuoteOriginally posted by: badgerbadgerHi all!Referring to Broadie&Kaya's "Exact Simulation of Stochastic volatility and Affine Jump Diffusion Processes"I'm trying to calculate a Modified Bessel Function of the First kind with real positive order and complex argument.I'm trying with C++ but I can't find the code (and to write it by myself isn't so easy!!!).What I find on the net is either for integer orders or for real arguments but not for both!!!Does anyone can help me, please My suggestion: the series representation is straightforward and short to code. For the Gamma function that appears in the series, since you say the order nu is real, you can probably make dowith exponentiating the gammln(x) from Numerical Recipes. regards,
 
User avatar
ppauper
Posts: 11729
Joined: November 15th, 2001, 1:29 pm

Bessel Function for Heston's model

November 13th, 2006, 6:45 pm

QuoteOriginally posted by: jfuquaI think there are still free-ware that converts Fortran to 'C.' One I last used---sorry don't recall the name---was very good but the C code won't be easy to understand..indeed, when I use my linux pc at home,the fortran compiler on there first converts it to c, generating a c code,then compiles it using gcc.
 
User avatar
badgerbadger
Topic Author
Posts: 0
Joined: November 9th, 2006, 9:44 pm

Bessel Function for Heston's model

November 14th, 2006, 10:25 am

JFUQUA and PPAUPER I found something to transform from frotran to c, and it seems it works nicely, the problem is that I would like to produce C++ code that can be compiled under different operating systems without external libraries.ALAN I tried your suggestion and it seems to work (the series is always converging of course). My doubt is about the performance that I will obtain for the whole Broadie&Kaya's algorithm. They use this Amos algorithm where different approaches are used to compute the Bessel functions. Did you test if the pure series summation give a good overall performance?
 
User avatar
Alan
Posts: 3050
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

Bessel Function for Heston's model

November 14th, 2006, 12:52 pm

No, unfortunately, I suspect the series will be slow.But at least you have something working. To make it efficientfor Monte Carlo will probably mean ten times the effort, coding asymptoticcases, reading literature on how others implement Bessel funcs, etc.I haven't done any of this for that particular function, so can't offer any more tips.
 
User avatar
AVt
Posts: 90
Joined: December 29th, 2001, 8:23 pm

Bessel Function for Heston's model

November 14th, 2006, 1:25 pm

Still not quite sure which Bessel you are talking about ... but may be youuse BesselI(nu,x) = x^nu/((x*I)^nu)*BesselJ(nu,x*I) and use a recipeshown in the uploaded gif (modification of Alan's suggestion). Take care,there may be various conventions for notations.
Attachments
BesselJ.gif.zip
(45.77 KiB) Downloaded 60 times
 
User avatar
zeta
Posts: 26
Joined: September 27th, 2005, 3:25 pm
Location: Houston, TX
Contact:

Bessel Function for Heston's model

November 14th, 2006, 1:33 pm

why not try using Pade approx. to speed up series convergence. I give coefficients here
 
User avatar
INFIDEL
Posts: 0
Joined: November 29th, 2005, 4:17 pm

Bessel Function for Heston's model

November 15th, 2006, 4:42 am

badgerbadger, how many sig fig accuracy do you need? Then we can talk about issues like speeding up convergence of a series representation.
 
User avatar
badgerbadger
Topic Author
Posts: 0
Joined: November 9th, 2006, 9:44 pm

Bessel Function for Heston's model

November 16th, 2006, 7:24 am

INFIDEL,I still don't know the precision I need.I tried series development but I found other problems... Bad approximations or other errors make the cumated function being sometimes more than 1 (not possible!!!)