如何实现`class NumericalAntiderivative`

时间:2018-04-26 18:36:26

标签: c++11 numerical-integration

我试图创建一个可以像这样使用的class NumericalAntiderivative

auto f = [](double x){
    return std::sin(x); // in general this may be a complicated expression that is not analytically integrable
};
NumericalAntiderivative ad(f,minXofInterest,maxXofInterest);
// the line above may be costly, but the line below should be efficient
std::cout << "Integral of f from 0 to 5 is " << (ad(5.0)-ad(0.0)) << std::endl;

我在this maths question中描述了一些想法,但问题可能更适合SO。我只需要一些想法/指针,这些想法/指针可能会带来实现这一目标的好方法。

0 个答案:

没有答案