title: How to minimize a function over one input parameter in R
body: <p>Suppose I have a function that is defined as following</p>
  
  <pre><code>myFunction = function(input1, input2, input3) {
      # do something with input and then return
  }
  </code></pre>
  
  <p>and now I want to minimize <code>myFunction</code> over only the first input, namely, <code>input1</code>, while fixing the other parameters.</p>
  
  <p>In R, it seems that there are some prepacked functions like <code>nlm</code>, <code>optim</code>, etc. But the documentation doesn't really explain how to do the problem above. For example, it seems that <code>optim</code> can only minimize a function over only 1 input? I am probably wrong, but please correct me, and show me the advised way of doing this kind of minimizing problem.</p>
  
  <p>Thank you very much!</p>