Wednesday, April 13, 2016

HP Prime, Casio Classpad: Bessell Functions of the 1st Kind

Bessel Function of the First Kind

The program BESS1 calculates the Bessel function of the First Kind. With the HP Prime and Casio Classpad, and any calculators that can process integrals (and the processor is fast enough), we can use the definition:

J_n(x) = 1/π * ∫ (cos(n*t – x*sin(t)) dt for t= 0 to t = π

This is the solution to the differential equation:

x^2*y’’ + x*y’ + (x^2 – n^2)*y = 0, where y is a function of x.

There are many other variations and approximations to calculate J_n(x) if the integral function is not available on your calculator. 

More information on the Bessel function is found here:

Wolfram

Wikipedia



Casio Classpad (fx-CP400):  The Function BESS1




As the screen above shows, I used a Define statement in the Main Mode:

Define bess1(n,x) = 1/π ∫ (cos(n*t – x*sin(t)) dt, from t = 0 to t = π)

Note:  Make sure that the calculator is in Radians mode before calculating.

HP Prime:  BESS1

EXPORT BESS1(n,t)
BEGIN
// Bessel 1st Kind
LOCAL b;
// Integrate
b:=(1/π)*CAS.int(COS(n*X-t*SIN(X)),X,0,π);
// Approximate
b:=approx(b);
RETURN b;

END;

Note: the integration and approximation are two separate steps.  They need to be in order for this program to work correctly.

Examples

bess1(1,2) ≈ 0.576724807756
bess1(0,6.3) ≈ 0.223812006132
bess1(2,4) ≈ 0.364128145852


This blog is property of Edward Shore, 2016.

6 comments:

  1. i dont know how install this program in my hp prime. can you help me please?¨
    Thank u.

    ReplyDelete
    Replies
    1. Antonio,

      I don't have the file for download. However, if you don't want to type in the program yourself:

      1. Open the HP Prime Connectivity Kit and plug in your HP Prime. The Kit (should) recognize the Prime.
      2. Copy the text that is presented in the HP Prime: BESS1 section. For convenience, the program text is in Courier font.
      3. On the Connectivity Kit, click on your calculator. Expand the folders on the Calculator. If you are using Windows, right click on Programs and select New. You'll be prompted for a name. In this case, type BESS1.
      4. The program editing page will open. You then can replace the pre-written text by pasting the program on the editor. Don't forget to save!
      5. Optional: once the program the saved, it will be listed under the calculator on the top-left side of the Connectivity Kit screen. You can drag the program down to the lower-left side of the screen (under the bar where it says "Name" and "Size") and it will save the program as an hppprgm file on your computer.

      Hope this helps,

      Eddie

      Delete
    2. That gives me the error "Invalid argument".
      Sorry for annoyances.
      Antonio

      Delete
    3. Antonio,

      What firmware version do you have on your calculator? I find that the easiest way to find out is to press the [ Help ] key, then the (Tree) soft key, from Home Screen, scroll up and select About HP Prime.

      HP Prime just updated to firmware 10077 (4/2016). ftp://ftp.hp.com/pub/calculators/Prime/

      If you are still having trouble transferring the program, then you might have to type in the program yourself.

      Sorry for all the troubles,

      Eddie

      Delete
  2. Thank you. I just wanted to know where to ship it since I know now to keep producing it

    123 hp setup

    ReplyDelete
  3. A very interesting article. The insights are really helpful and informative. Thanks for posting.
    123 HP Officejet Pro 8615 Setup

    ReplyDelete

Eclipse and HHC 2017

Eclipse On August 21, 2017 there will be a solar eclipse.  Totality (where the moon completely covers the sun) will occur in the northern...