title: how to calculate this simultaneous equations in r
body: <p>I am trying to solve the following two equations simultaneously for <code>a</code> and <code>b</code> in R:</p>
  
  <pre><code>0.1 = a /(1+a) * 0.9639 + a(1+b) / (1+a(1+b)) * 0.0324 + a(1+b)^2 / (1+a(1+b)^2) * 0.0036 + a(1+b)^4 / (1+a(1+b)^4) * 0.0001
  
  0.03 = [(a/(1+a)-0.1)^2 * 0.9639 + (a(1+b) / (1+a(1+b))-0.1)^2 * 0.0324 +(a(1+b)^2 / (1+a(1+b)^2)-0.1)^2 * 0.0036 + (a(1+b)^4/(1+a(1+b)^4)-0.1)^2*0.0001]/0.09
  </code></pre>
  
  <p>I have tried to use the rootSolve package to find a solution and got an error message. </p>
  
  <p>The code that I used was as follows: </p>
  
  <pre><code>library(rootSolve)
  
  model=function(x){ 
      f1=((x[1]/(1+x[1]))*0.9639+((x[1]*(1+x[2]))/(1+x[1]*(1+x[2])))*0.0324+((x[1]*(1+x[2])^2)/(1+x[1]*(1+x[2])^2))*0.0036+(x[1]*(1+x[2])^4)/(1+x[1]*(1+x[2])^4)*0.0001)-0.1
      f2=(((x[1]/(1+x[1])-0.1)^2*0.9639+(x[1]*(1+x[2])/(1+x[1]*(1+x[2]))-0.1)^2*0.0324+(x[1]*(1+x[2])^2/(1+x[1]*(1+x[2])^2)-0.1)^2*0.0036+(x[1]*(1+x[2])^4/(1+x[1]*(1+x[2])^4)-0.1)^2*0.0001)/0.09)-0.03
      c(f1=f1,f2=f2)
  } 
  
  solution=multiroot(f=model, start=c(1,1))
  </code></pre>