[ create a new paste ] login | about

Link: http://codepad.org/Myd5Th7W    [ raw code | output | fork ]

C++, pasted on Aug 14:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
#include <sstream>
#include <string>

#include <boost/math/tools/minima.hpp>

double f(double x) { return x * cos(x); }

int main(int argc, char** argv)
{
    typedef std::pair<double, double> Result;
    Result r1 = boost::math::tools::brent_find_minima(f, 3.0, 4.0, 1e-8);
    Result r2 = boost::math::tools::brent_find_minima(f, 3.0, 4.0, 10);
    std::cout << "x=" << r1.first << " f=" << r1.second << std::endl;
    std::cout << "x=" << r2.first << " f=" << r2.second << std::endl;
    return 0;
}


Output:
1
2
3
4
Line 38: error: boost/math/tools/minima.hpp: No such file or directory
In function 'int main(int, char**)':
Line 12: error: 'boost::math' has not been declared
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: