// file: j0_test.cpp // // C++ Program to demonstrate use of the J0 Bessel function from // the gsl numerical library. // // Programmer: Dick Furnstahl furnstahl.1@osu.edu // // Revision history: // 12/26/03 original C++ version, modified from C version // // Notes: // * Example taken from the GNU Scientific Library Reference Manual // Edition 1.1, for GSL Version 1.1 9 January 2002 // URL: gsl/ref/gsl-ref_23.html#SEC364 // * Compile and link with: // g++ -Wall -o J0_test J0_test.cpp -lgsl -lgslcblas // * gsl routines have built-in // extern "C" { //
// } // so they can be called from C++ programs without modification // * The answer should be J0(5) = -1.775967713143382920e-01 // //*********************************************************************// // include files #include #include #include #include using namespace std; #include // gsl Bessel special function header file int main (void) { double x = 5.0; // just a random test value double y = gsl_sf_bessel_J0 (x); // see the GSL manual for details cout << "J0(" << x << ") = " << setprecision(18) << setw(20) << y << endl; return 0; }