title: How to integrate the product of two functions
body: <p>Suppose I am seeking to integrate the following function from 0 to 10:</p>
  
  <p><a href="https://i.stack.imgur.com/Duhny.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Duhny.png" alt="enter image description here"></a></p>
  
  <p>How would I accomplish this in <code>R</code>?</p>
  
  <p><strong>Functions</strong></p>
  
  <pre><code># Functional form
  fn &lt;- function(t) -100*(t)^2 + 20000
  
  # First derivative w.r.t. t
  fn_dt &lt;- function(t) -200*t
  
  # Density funciton phi
  phi &lt;- approxfun(density(rnorm(35, 15, 7)))
  
  # Delta t
  delta &lt;- 5
  </code></pre>