title: Implement a Monte Carlo Simulation Method to Estimate an Integral in R
body: <p>I am trying to implement a Monte carlo simulation method to estimate an integral in R. However, I still get wrong answer. My code is as follows:</p>
  
  <pre class="lang-r prettyprint-override"><code>f &lt;- function(x){
    ((cos(x))/x)*exp(log(x)-3)^3
  }
  t &lt;- integrate(f,0,1)
  
  n &lt;- 10000 #Assume we conduct 10000 simulations
  int_gral &lt;- Monte_Car(n)
  int_gral
  </code></pre>