Search code examples
c++boostnumerical

how to use digamma function in boost


I don't understand how the digamma function of boost can be used inside a program. Any example, is appreciated. I included boost

#include <boost/math/special_functions/digamma.hpp>

but the function call digamma(x), where x is a double gives the following error:

error: there are no arguments to ‘digamma’ that depend on a template parameter, so a declaration of ‘digamma’ must be available [-fpermissive]


Solution

  • Here's an example: http://cpp.sh/7bdu

    #include <boost/math/special_functions/digamma.hpp>
    #include <iostream>
    int main() {
        std::cout << boost::math::digamma(3.14) << "\n";
    }
    

    edit: The question was edited with an error message. The error message means that the compiler didn't find a definition of digamma, because you didn't include the namespace bit boost::math::.