I try to write spherical bessel function in C++ and use
#include <boost/math/special_functions/bessel.hpp>
and sph_bessel(v,x)
in my code but error is happened say this not declared in this scope.I compile with g++ test.cpp .please help me.
#include <cmath>
#include <iostream>
#include <boost/math/special_functions/bessel.hpp>
using namespace std;
int main()
{
// spot check for n == 1
double x = 1.2345;
cout << "j_1(" << x << ") = " << sph_bessel(1, x) << '\n';
}
compile the code with:
g++ test.cpp
and give this error:
error: ‘sph_bessel’ was not declared in this scope
cout << "j_1(" << x << ") = " << sph_bessel(1, x) << '\n';
a.cpp:9:38: note: suggested alternative:
In file included from a.cpp:3:0:
/usr/include/boost/math/special_functions/bessel.hpp:544:79: note: ‘boost::math::sph_bessel’
ename detail::bessel_traits<T, T, policies::policy<> >::result_type sph_bessel(unsigned v, T x)