Hi everyone, i've got a strange question: I wanted to use monte carlo method to count the volume of the ball i 've choosen a [-1,-1], [1,1] square and ball of radius 1 to do it. i wrote something like this: with(Randomtools): k:=1000 Generate(list(rational(range=-1..1)+I*rational(range(-1..1),k)): map(abs,%): select(verify,%,1,'truefalse'('less_than')): evalf(nops(%)*4/k) the result is ok (3.14 in the first try ;) ), but I wanted to do a little "upgrade" and have written a little shorter formula: (now doing "abs" is not necessary) with(Randomtools): k:=1000 Generate(list(rational(range=-1..1)^2+rational(range(-1..1)^2,k)): select(verify,%,1,'truefalse'('less_than')): evalf(nops(%)*4/k) But with that formula the result is always close to 2.8 , if k=10000 it still is about 2.8. Why is that happening?

Please Wait...