# Solving set of equations

**URL:** <https://root-forum.cern.ch/t/solving-set-of-equations/59281>\
**Category:** Newbie\
**Created:** [May 9, 2024, 6:24pm UTC](https://root-forum.cern.ch/t/solving-set-of-equations/59281 "2024-05-09T18:24:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Noor1](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/noor1/32/38240_2.png) [@Noor1](https://root-forum.cern.ch/u/Noor1)\
**Post date:** [May 9, 2024, 6:24pm UTC](https://root-forum.cern.ch/t/solving-set-of-equations/59281/1 "2024-05-09T18:24:28Z")

</div>

\_\_\_Dear all,  
I am trying to solve a set of equations and I am using the “ROOT::Math::MultiRootFinder”  
But I am not sure about the final output.

I wrote the following script

```auto
 ROOT::Math::MultiRootFinder* r = new ROOT::Math::MultiRootFinder();

  

    
    double R_Au = 5.46698; //N_activation per atom per sec (Nact/N0/ta/sigma0) 6.74002 
    double R_Cr = 5.36218; //N_activation per atom per sec (Nact/N0/ta/sigma0) 5.40852 
    double R_Co = 5.36700; //N_activation per atom per sec (Nact/N0/ta/sigma0) 5.38338 
    double R_Mo = 5.51876; //N_activation per atom per sec (Nact/N0/ta/sigma0) 5.03949     

   
     auto f_Au = [R_Au](const double * x)
    { return R_Au-x[1]-((15.47/pow(5.7,x[0]))+(0.429/(1+2*x[0])/(pow(0.55,x[0]))))*x[2];};

                  
    auto f_Cr = [R_Cr](const double * x)
    { return R_Cr-x[1]-((0.04/pow(7530,x[0]))+(0.429/(1+2*x[0])/(pow(0.55,x[0]))))*x[2];};
                      
    auto f_Co = [R_Co](const double * x)
    { return R_Co-x[1]-((1.61/pow(163,x[0]))+(0.429/(1+2*x[0])/(pow(0.55,x[0]))))*x[2];};
    
    auto f_Mo = [R_Mo](const double * x)
   { return R_Mo-x[1]-((52.67/pow(241,x[0]))+(0.429/(1+2*x[0])/(pow(0.55,x[0]))))*x[2];};

r->AddFunction(f_Au,3);
          r->AddFunction(f_Cr,3);
            r->AddFunction(f_Co,3);
          // r->AddFunction(f_Mo,3);

    

    // starting point
   double x0[3]={0.18, 5.36, 0.0069};
   

    int printlevel = 1;
    r->SetPrintLevel(printlevel);
    
    r->Solve(x0);

```

the output are not accurate (x[0] = 0.240702 x[1] = 5.35869 x[2] = 0.0103042 ) compare to the initial value (They should be the correct results) .

In addition if I only changed the value of R\_Au to 5.74002 the iteration does not approch to a solution.

Id there more accurate root finder with uncertainty value.

Thanks

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [May 9, 2024, 7:47pm UTC](https://root-forum.cern.ch/t/solving-set-of-equations/59281/2 "2024-05-09T19:47:47Z")

</div>

Hi,

Thanks for the interesting post.  
Adding @moneta in the loop.

Cheers,  
D
