title: R: Optim() fitting parameter limits
body: <p>I'm looking to put a limit on the output parameters from optim(). It is needlessly converging thousands of phases of out of phase for my sinusoidal function (where 'designL' is my independent variable, and 'ratio' is my dependent variable data, dfm is my dataframe):</p>
  
  <pre><code>lo_0 = 2e-6
  kc_0 = 80000
  min.RSS &lt;- function(data, par) {
    with(data, sum( (sin(par[2] *(par[1] + designL))^2 - ratio)^2) )
  }
  resultt &lt;- optim(par = c(lo_0, kc_0), min.RSS, data = dfm)
  </code></pre>
  
  <p>I want to limit the lo_0 (phase shift) from 0:2e-5. I found some documentaition on this, but it doesn't go into much description on how to achieve: <a href="https://ubuntuforums.org/showthread.php?t=1420061" rel="nofollow noreferrer">https://ubuntuforums.org/showthread.php?t=1420061</a> </p>