HP Forums

Full Version: Bessel Function of the First Kind
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Blog post: http://edspi31415.blogspot.com/2016/04/h...ssell.html

HP Prime Program BESS1:

Code:
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;

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

Here's a modification that's good for non integer values of order as well:

Code:

#cas
J_n(n,x):=
BEGIN
 LOCAL b, t;
 b:=(1/π)*int(cos(n*t-x*sin(t)),t,0,π);
 IF TYPE(n)≠1 THEN
  b:=b-(sin(n*π)/π)*int(e^(-x*sinh(t)-n*t),t,0,∞);
 END;
 RETURN approx(b);
END;
#end

And a cool chart for n= -1, -0.5, 0, 0.5, and 1 that only took a few minutes to draw on the prime:

[attachment=3396]

-road
Thank you both of you!

There is some simple way to get also the 2nd kind Bessel function?

Salvo
Reference URL's