title: Is there a way to solve an equation without a root?
body: <p>at the moment I am writing my bachelor thesis and I have to program in R for the first time. I think not the best way to learn R but never mind. </p>
  
  <p>My question is concerning a function that can solve an equation like this:</p>
  
  <pre><code>q &lt;- function(ytc) {
    (5 / ((1 + (ytc / 4))^4 * ((1645 * 5 / 1826) - (1640 * 5 / 1826)))) + 
      (5 / ((1 + (ytc / 4))^4 * ((1736 * 5 / 1826) - (1640 * 5 / 1826)))) + 
      (5 / ((1 + (ytc / 4))^4 * ((1826 * 5 / 1826) - (1640 * 5 / 1826)))) + 
      100 / (((1 + (ytc / 4))^4 * ((1826 * 5 / 1826) - (1640 * 5 / 1826)))) - 100
  }
  </code></pre>
  
  <p>My aim is to simply solve for the ytc what should be the yield to call of a bond. But I cannot find any way to figure it out. This should be a simple PV calculation like: PV=c/(1+r/4)^4*t1+c/(1+r/4)^4*t2+.... and hence solve vor r. But don't know how to do that. I tried several functions like uniroot, unroot.all, ... but nothing could figure out the solution. Additionally a real problem is that in the my main equation I am discounting 20 payments and and I was not able to modify it as a linear equation yet due to missing knowledge about what to to with the exponents.</p>
  
  <p>I hope anyone could help me. </p>
  
  <p>Looking forward to hear from anyone. </p>