|
Boost Users : |
From: Anirban Pal (anirban.pal.iitkgp_at_[hidden])
Date: 2020-08-14 14:48:42
Thank you. That worked.
On Fri, 14 Aug 2020 at 05:23, John Maddock via Boost-users <
boost-users_at_[hidden]> wrote:
>
> 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_at_[hidden]
> > 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_at_[hidden]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users
>
-- Anirban Pal
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net