jeudi 26 avril 2018

How to implement `class NumericalAntiderivative`

I seek to create a class NumericalAntiderivative that can be used like this:

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;

I have described some ideas in this maths question, but the question may be more suitable for SO. I just need some ideas/pointers that may lead to a good way to accomplish this objective.

Aucun commentaire:

Enregistrer un commentaire