Example: The Bessel Functions
The Bessel functions I, J, and K are exercised for orders 0, 1, 2, and 3 at argument 10.e0.
import com.imsl.math.*;
public class BesselEx1 {
public static void main(String args[]) {
double x = 10.e0;
int hiorder = 4;
// Exercise some of the Bessel functions with argument 10.0
double bi[] = Bessel.I(x, hiorder);
double bj[] = Bessel.J(x, hiorder);
double bk[] = Bessel.K(x, hiorder);
System.out.println("Order Bessel.I Bessel.J Bessel.K");
for (int i = 0; i < 4; i++) {
System.out.printf(" %d %10.4f %10.4f %10.4f\n",
i, bi[i], bj[i], bk[i]);
}
}
}
Output
Order Bessel.I Bessel.J Bessel.K
0 2815.7166 -0.2459 0.0000
1 2670.9883 0.0435 0.0000
2 2281.5190 0.2546 0.0000
3 1758.3807 0.0584 0.0000
Link to Java source.