Sample implementation of make-ball-generator seems incorrect Bradley Lucier (03 Feb 2024 06:28 UTC)
Re: Sample implementation of make-ball-generator seems incorrect Bradley Lucier (03 Feb 2024 19:34 UTC)
Re: Sample implementation of make-ball-generator seems incorrect Arthur A. Gleckler (05 Feb 2024 00:47 UTC)

Re: Sample implementation of make-ball-generator seems incorrect Bradley Lucier 03 Feb 2024 19:33 UTC

On 2/3/24 2:13 PM, Bradley Lucier wrote:
> I did another, simpler test, with a two-dimensional ball (a disk):
>
> (define c (make-ball-generator '#(10. 10.)))
>
> (define ball-interior-points
>    (map (lambda (x) (c)) (iota 100000)))
>
> (display (length (filter (lambda (v)
>                           (and (< -0.5 (vector-ref v 0) 0.5)
>                                (< -0.5 (vector-ref v 1) 0.5)))
>                           ball-interior-points)))
> (newline)
>
> (display (length (filter (lambda (v)
>                             (and (< 8.5 (vector-ref v 0) 9.5)
>                                  (< -0.5 (vector-ref v 1) 0.5)))
>                           ball-interior-points)))
> (newline)
>
> This yields 452 and 236.

The expected number is 100,000/(100\pi) or about 318.3.