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.println(i+" "+bi[i]+" "+bj[i]+" "+bk[i]);
}
System.out.println();
}
}
Output
Order Bessel.I Bessel.J Bessel.K
0 2815.7166284662553 -0.24593576445134832 1.7780062316167654E-5
1 2670.9883037012555 0.043472746168861535 1.8648773453825585E-5
2 2281.5189677260046 0.2546303136851206 2.150981700693277E-5
3 1758.3807166108538 0.05837937930518672 2.725270025659869E-5
Link to Java source.