Example of using multiroot finder based on GSL algorithm.
Find the root of Rosenbrock system of equations:
\[ f1(x,y) = a(1-x) \]
\[ f2(x,y) = b(y-x^2) \]
with:
\[ a = 1, b=10 \]
The MultiRootFinder is based on GSL and it requires the MathMore library installed
Usage:
or
where algoname is for an algorithm not using the derivatives: hybridS (default) , hybrid, dnewton, broyden
Processing /mnt/vdb/lsf/workspace/root-makedoc/rootspi/rdoc/src/master/tutorials/math/exampleMultiRoot.C...
GSLMultiRootFinder::Solve:hybrids max iterations 100 and tolerance 1e-06
GSL Algorithm used is : hybrids
Number of iterations = 19
Function values = f[0] = 0 f[1] = -6.17162e-11
#include "RConfigure.h"
#ifdef R__HAS_MATHMORE
#endif
using namespace ROOT::Math;
void exampleMultiRoot(
const char * algo = 0,
int printlevel = 1) {
#ifndef R__HAS_MATHMORE
Error(
"exampleMultiRoot",
"libMathMore is not available - cannot run this tutorial");
#else
TF2 * f1 = new TF2("f1","[0]*(1-x)+[1]*y");
TF2 * f2 = new TF2("f2","[0]*(y-x*x)");
f1->SetParameters(1,0);
f2->SetParameter(0,10);
double x0[2]={-1,-1};
r.Solve(x0);
#endif
}
- Author
- Lorenzo Moneta
Definition in file exampleMultiRoot.C.