2019-02-10 00:23:36 +00:00
|
|
|
#include <LatAnalyze/Functional/Function.hpp>
|
|
|
|
#include <LatAnalyze/Numerical/GslHybridRootFinder.hpp>
|
2014-09-22 15:19:30 +01:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace Latan;
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
constexpr double a = 1., b = 10.;
|
2018-04-23 11:34:36 +01:00
|
|
|
DoubleFunction f1([](const double *x){return a*(1.-x[0]);}, 2);
|
|
|
|
DoubleFunction f2([](const double *x){return b*(x[1]-x[0]*x[0]);}, 2);
|
2014-09-22 15:19:30 +01:00
|
|
|
vector<DoubleFunction *> system = {&f1, &f2};
|
2015-11-13 14:30:10 +00:00
|
|
|
GslHybridRootFinder solve;
|
2014-09-22 15:19:30 +01:00
|
|
|
DVec init(2), x;
|
|
|
|
|
|
|
|
solve.setVerbosity(Solver::Verbosity::Debug);
|
|
|
|
init(0) = -10.; init(1) = -5.;
|
|
|
|
solve.setInit(init);
|
|
|
|
x = solve(system);
|
|
|
|
cout << "solution: " << x.transpose() << endl;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|