(15C)Bessel Functions, Arbitrary Order for HP15C

11152023, 01:35 PM
(This post was last modified: 11252023 02:11 AM by Namir.)
Post: #1




(15C)Bessel Functions, Arbitrary Order for HP15C
Bessel Function J, Arbitrary Order for HP15C
Based on the HP25 code by Peter Henrici in his book "Computational Analysis with the HP25 Pocket Calculator", page 253. The pdf file for the book is available for download in Eric rechlin's librarry. The books shows the equations used and the flowchart for the program. The program uses the following equations: Jv(x) = a * sum((b(i)),for n= 0 to infinity where, a = (x/2)^v / gamma(v+1) b(0) = 1 b(n) = (x/2)^2/n/(v+n)*b(n1) for n = 1, 2, 3, ... The range for x values is 0<= x <= 10, according to Henrici. Memory Map ========== Code: R0 = v Program Listing =============== Code:
Example ======= To calculate J<1.5>(5), perform the following: 1) Set calculate to [FIX] [8]. 2) Enter 5 (for x) and press [ENTER]. 3) Enter the order of 1.5 and the press [f][A]. 4) The program performs the calculations and stops displaying 0.16965131. 

11252023, 12:32 AM
Post: #2




RE: (15C)Bessel Functions, Arbitrary Order for HP15C
Question, Namir: Should line 38 be RCL 1 or RCL 2 instead?


11252023, 02:09 AM
(This post was last modified: 11252023 02:13 AM by Namir.)
Post: #3




RE: (15C)Bessel Functions, Arbitrary Order for HP15C  
11262023, 01:53 AM
Post: #4




RE: (15C)Bessel Functions, Arbitrary Order for HP15C
(11252023 02:09 AM)Namir Wrote:(11252023 12:32 AM)Eddie W. Shore Wrote: Question, Namir: Should line 38 be RCL 1 or RCL 2 instead? The program works! Thank you Namir! 

11272023, 02:45 AM
Post: #5




RE: (15C)Bessel Functions, Arbitrary Order for HP15C
No, thank YOU Eddie!!!


11272023, 05:16 PM
(This post was last modified: 11272023 07:03 PM by C.Ret.)
Post: #6




RE: (15C)Bessel Functions, Arbitrary Order for HP15C
Thanks to you two.
I wanted to check the results that Namir obtains with those that I obtain with a code that I used before. I then realized that my program for calculating the values of \( B_n(x) \) only works for integer values of \(n\). I may therefore have to modify it by adding an INT instruction before storing \(n\) in the R0 register. My code uses the integration function, which is more explicit than the nifty algorithm found by Namir, but takes much more time. It is based on the following relationship: Obviously, digital integration takes a very long time on my HP15C from 1985. But it's no longer very serious, today only the old HP15Cs are struggling. The time factor is no longer a concern on the HP15C LE or CE and other DM15s. As the calculation time no longer matters, I can try to use a second integration for the corrective term when calculating \(B_\alpha(x) \) with noninteger \(\alpha\). As a short circuit, my code tests the fractional part of the argument x and jumps to label 2 if it does not exist. The second integral grow up to infinity ! But don't be crazy, note that \(sinh(9)\simeq4\;052\) is already almost too large since already \(e^{4\;052}\ll10^{10}\) and 'larger' infinity limit may lead to erroneous integration by the \(\int_y^x\) operator. The calculations are very long, fortunately, I took the precaution of saving the result in register R2 because most of the time, my HP15C turn off before I wake up to read the result. As for the first version, the argument \(x\) is stored in register R1 and the order \(n\) or \(\alpha\) of the Bessel function in register R0. The code completed by the calculation of the two integrations is not much shorter nor more implicit than the code proposed by Namir. I give it here just to illustrate my points, I don't think it will be of use to anyone. Especially since it takes an infinitely long time to display the slightest result. Furthermore, integration towards infinity is not, by far, the fastest operation that can be performed on an HP15C. Using an iterative algorithm like the one Namir propose is therefore an excellent and fully justified idea. Thank all of you for sharing this code which is very effective and efficient, especially for longterm users of an HP15c from 1985 as me. 

« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)