Question about how HP Math pacs calculate Bessel Functions!  Printable Version + HP Forums (https://archived.hpcalc.org/museumforum) + Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum1.html) + Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum2.html) + Thread: Question about how HP Math pacs calculate Bessel Functions! (/thread158819.html) 
Question about how HP Math pacs calculate Bessel Functions!  Namir  11032009 Hello All, If you look in your HP65 and HP67 Math Pac manuals and the HP41 High Level Math solution book, you may come across programs that calculate the Jn(x) and In(x) Bessel functions. These programs use recursive algorithms that calculate series of a specified number of terms m. The documentation calculates m using an interesting formula: m = 2 * INT[(6 + max(n,z) + 9z/(z + 2))/2] Where n is the order of the Bessel function and z = 3x/2. My question, can anyone find the reference for HP's algorithms to calculate the Jn(x) and In(x) Bessel functions using the above equation?? The HP documentation mentions the "Handbook of Mathematical Functions" by Abramowitz et al. as a reference. I looked in that book and and the closest thing I found was at the bottom of page 385 (under the heading Numerical Methods). The handbook discusses informally the algorithm HP used but does not mention m and how it is calculated. Did I miss something? Or is the equation for m something HP came up with? I guess you can say that this is a math challenge, with a new twist! Namir
Edited: 3 Nov 2009, 4:20 p.m.
Re: Question about how HP Math pacs calculate Bessel Functions!  Frank Rottgardt  11032009 I don´t know which edition of Abramowitz you have excess to. This source cites the 1972 edition which would fit the HP67 timewise. Abramowitz, M. and Stegun, I. A. (Eds.). "Spherical Bessel Functions." §10.1 in Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables, 9th printing. New York: Dover, pp. 437442, 1972.
Re: Question about how HP Math pacs calculate Bessel Functions!  Namir  11032009 I also have the bluesoft cover version. On page 385 (Bessel functions of integer orders) the book discusses in general terms basically the same algorithm that HP uses, except there is no mention for of m and the equation to calculate it. The discussion does mention the use of recursive iteration to calculate nonnormalized Bessel function values, and then briefly hints at how to normalize them. The HP documentation is much clearer. I was able to implement the algorithm in Excel VBA in two versions: using arrays and without arrays. Both yield accurate results.
Namir
Re: Question about how HP Math pacs calculate Bessel Functions!  Ángel Martin  11042009 There's programs in the SandMath5 module to calculate Jn, In, Kn, and Yn for both integer and noninteger indexes, and any real number. I used the usual approach given the relatively fast convergenge of the series.
Cheers,
Edited: 4 Nov 2009, 3:35 a.m.
Re: Question about how HP Math pacs calculate Bessel Functions!  Namir  11042009 Angel, Your SandMath ROM looks VERY nice!!! You calculate the Bessel functions Jn(x), In(x), Kn(x), and Yn(x) in your SandMath ROM. Do you base your calculations for ALL FOUR Bessel functions on an algorithm that is a similar one that HP uses? If yes, how do you calculate Kn(x) and Yn(x)? Sorry for being nosy. Cheers, Namir
Edited: 4 Nov 2009, 7:03 a.m.
Re: Question about how HP Math pacs calculate Bessel Functions!  Ángel Martin  11052009 Hi Namir, No complex stuff: it's basically just about summing terms until there's no significant contribution to the sum value. The process is spedup by using a couple of MCODE functions involved in the function term calculation (like obviously GAMMA for noninteger orders, HARMN for the harmonic number, X=YR? for rounded comparisons, CHSYX, etc.), and a couple of rearranging tricks of the series syntax to optimize the efficiency. It still takes its time, but this is a nonissue if you use V41's TURBO mode of course  it feels instantaneous response. I considered an ALLMCODE implementation but so far had no time to implemented, maybe some day... I'm on the road for a couple of weeks but can send you more details when I'm back if you give me an email address to send it to.
Best, Edited: 5 Nov 2009, 12:30 a.m.
