Boost logo

Boost Users :

From: pbristow_at_[hidden]
Date: 2020-08-14 09:31:27


You need to decide on which Real type you want, perhaps

 

#include <boost/multiprecision/cpp_bin_float.hpp>

 

and then chose perhaps a quad precision type like cpp_bin_float_quad for 128-bit precision

 

You can then either use a typedef to define Real

 

typedef cpp_bin_float_quad Real;

 

or pass cpp_bin_float_quad as a template parameter into your own function.

 

HTH

 

Paul

 

PS It would be nice if we had a fully worked example?

 

 

 

From: Boost-users <boost-users-bounces_at_[hidden]> On Behalf Of Anirban Pal via Boost-users
Sent: 14 August 2020 01:08
To: boost-users_at_[hidden]
Cc: Anirban Pal <anirban.pal.iitkgp_at_[hidden]>
Subject: [Boost-users] Difficulty using boost quadrature library

 

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:

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 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 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