On 14/08/2020 01:07, Anirban Pal via Boost-users wrote:
Hello everyone,
I'm new to using boost and I'm trying to use its quadrature routines,
specifically
the *tanh_sinh* integrator. I'm trying to run the examples here:
<goog_14736225>
https://www.boost.org/doc/libs/1_66_0/libs/math/doc/html/math_toolkit/double_exponential/de_tanh_sinh.html
<https://www.boost.org/doc/libs/1_66_0/libs/math/doc/html/math_toolkit/double_exponential/de_tanh_sinh.html>
I've been successful using it with the *double* datatype. However, I
can't seem to work with the *Real* datatype. When I run the following,
I'm successful.
tanh_sinh<double> integrator;
auto f = [](double x) { return 5*x + 7; };
double Q = integrator.integrate(f);
Q = integrator.integrate(f, 0.0, 1.1);
But when I run the following:
auto f = [](Real x) { return log(x)*log(1-x); };
Real Q = integrator.integrate(f, (Real) 0, (Real) 1);
I confess that's not the best example in the docs :(
The name "Real" is just used as "some kind of floating point type" -
replace with whatever actual type you wish to use.
I get the error:
boost_test.cxx: In function ‘int main(int, char**)’:
boost_test.cxx:47:15: error: ‘Real’ has not been declared
auto f2 = [](Real x) { return log(x)*log(1-x); };
^~~~
boost_test.cxx:48:2: error: ‘Real’ was not declared in this scope
Real Q2 = integrator.integrate(f2, (Real) 0, (Real) 1);
I think I need to include the right headers for this to go away.
However, I'm not sure what the correct header file is.
Thank you for your attention.
--
Anirban Pal
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
https://lists.boost.org/mailman/listinfo.cgi/boost-users
--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
https://lists.boost.org/mailman/listinfo.cgi/boost-users