Randomly throwing points

Consider the following python function

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
from random import random
from math import log

def compute(points):
   randomize = lambda: (random(), 3*random())
   isInside =  lambda x,y: y <= (x**3 - 1)/log(x)

   hits = 0.0
   for i in range(points):
      if isInside(*randomize()):
         hits += 1.0

   return 3.0*(hits/points)

Find the value of \(x\) satisfying \( \displaystyle \ln x = \lim_{n\to\infty} \mathtt{compute}(n) \).

×

Problem Loading...

Note Loading...

Set Loading...