|
Boost Users : |
From: Anirban Pal (anirban.pal.iitkgp_at_[hidden])
Date: 2020-08-16 20:15:14
Hello,
Iâm using the tanh-sinh integrator to integrate a simple function f(x) =
0.26*x from 3.0 to 4.0.
The exact result is 0.91. With the integrator Iâm getting a result accurate
to only 10^-18 with cpp_bin_float_100 multiprecision.
typedef boost::multiprecision::cpp_bin_float_100 Real;
int main(int argc, char **argv)
{
using namespace boost::math::quadrature;
using namespace std::placeholders;
tanh_sinh<Real> integrator;
auto f2 = [](Real x) {
Real a = 0.26;
return x*a;
};
std::cout << std::setprecision(std::numeric_limits<Real>::max_digits10)
<< "Comp.: " << integrator.integrate(f2, (Real) 3.0, (Real) 4.0)
<< std::endl;
return 0;
}
I'm getting an output of
Comp.:
0.9100000000000000310862446895043831318616867065429687499999999999999999999999999999999999999999999999429
which I'm a bit curious about. I was wondering if I can improve the result.
Thank you.
-- 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