title: Solve equations with integral in R
body: <p>I am trying to find roots of x (X<a href="https://i.stack.imgur.com/9Hjts.gif" rel="nofollow noreferrer">1</a> in code) and y (X[2] in code) for two equations as follows</p>
  
  <p><a href="https://i.stack.imgur.com/9Hjts.gif" rel="nofollow noreferrer">Integral Equations</a></p>
  
  <p>I use function multiroot in R package rootSolve:</p>
  
  <pre><code>m&lt;-0.01 
  r&lt;- 0.5
  c&lt;- 0.01006885
  
  eq.sol&lt;-function(x,para)
  {
    m&lt;-para[1]
    r&lt;-para[2]
    c&lt;-para[3]
    inteq1&lt;-function(b)
    {
     x[1]*exp(-x[1]*b)/(b+x[2])
    }
    inteq2&lt;-function(b)
    {
     x[1]*exp(-x[1]*b)/(b+x[2])^2 
    }
    F1&lt;-integrate(inteq1, 0, Inf)$value-m*c*(1-r)/(c+m*r)
    F2&lt;-integrate(inteq2, 0, Inf)$value-m^2*c*(1-r)^2/(c+m*r)
    c(F1=F1, F2=F2)
  }
  
  find.para&lt;-multiroot(eq.sol, start = c(0.05,1), para = c(m, r, c), positive = TRUE)
  </code></pre>
  
  <p>where m, r and c are constants. Two variables are expected to be positive. However, it returns following errors:</p>
  
  <pre><code>diagonal element is zero 
  [1] 2
  Warning messages:
  1: In stode(y, times, func, parms = parms, ...) :
    error during factorisation of matrix (dgefa);         singular matrix
  2: In stode(y, times, func, parms = parms, ...) : steady-state not reached
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Thanks for Lyngbakr's solution. It seems a good initial guess is necessary in this case. However, if inserting this function in another function and randomly drawing c from some distribution, say U(0.005, 0.05), I cannot make it work for all samples of c. Is there any suggestion?   </p>