title: Solution for mutliple nonlinear equations in R: b and lambda values
body: <p>I need some help solving these very silly six nonlinear equations using R. </p>
  
  <pre><code>sigma1^2 = b1^2 + b2^2
  sigma2 = b1* b3 + b2*b4
  sigma3^2 = b3^2 + b4^2
  sigma4^2 = lambda1 * b1^2 + lambda2 * b2^2
  sigma5 = lambda1 * b1 * b3 + lambda2 * b2 * b4
  sigma6^2 = lambda1 * b3^2 + lambda2 * b4^2
  </code></pre>
  
  <p>I already know all the sigma values, now I need to know b and lambda values. 
  What I already tried is:</p>
  
  <pre><code>library(nleqslv)
  fun &lt;- function(x) { 
    f &lt;- c(sigma1[1,1], sigma1[1,2], sigma1[2,2], sigma2[1,1], sigma2[1,2], sigma2[2,2])                  
    f[1] &lt;-  x[1]^2  + x[2]^2                     
    f[2] &lt;-  x[1]*x[3]+ x[2]*x[4]                 
    f[3] &lt;-  x[3]^2 + x[4]^2          
    f[4] &lt;-  x[5]*x[1]^2+x[6]*x[2]^2
    f[5] &lt;-  x[5]*x[1]*x[3]  + x[6]*x[2]*x[4]
    f[6] &lt;-  x[5]*x[3]^2 + x[6]*x[4]^2
    return(f)
  } 
  startx &lt;- c(0.01,0.02,0.02,0.01,1.5,1.7)
  nleqslv(startx,fun,jacobian=TRUE,control=list(btol=.01))
  </code></pre>
  
  <p>Where x[1] till x[4] are my b values, x[5] and x[6] are my lambda values.</p>
  
  <p>The problem is the returned $fvec values are inconsistent with the sigma values. 
  What am I doing wrong? Would be great if you could share your opinions, thank you! </p>