🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.delphi.misc
Article #732

Re: Buffon's Needles

#732
From: David C. Ullrich
Date: Fri, 25 Jun 1999 00:00
59 lines
3276 bytes
In article <Im0c0MABmjc3Ew2K@merlyn.demon.co.uk>,
  Dr John Stockton <jrs@merlyn.demon.co.uk> wrote:
> JRS:  In article <7ks8ls$mgk$1@bgtnsc03.worldnet.att.net> of Wed, 23
Jun
> 1999 22:24:59 in news:comp.lang.pascal.delphi.misc, Earl F. Glynn
> <EarlGlynn@att.net> wrote:
> >An updated "Lab Report" about estimating the value of pi
> >by "throwing" needles on a set of parallel lines can be found at:
> >
> >http://www.efg2.com/lab/Mathematics/Buffon.htm
> >
> >The example includes complete Delphi source code and a
> >complete description of the mathematics and the various
> >methods of randomly "throwing" the needles.
>
> The following will do it, in BP7 and D3 DCC32 -cc modes :
>
>   var U, V, W : longint ;
>   begin V := 0 ; W := 10000000 ; Randomize ;
>   for U := 1 to W do if cos(Random*Pi*0.5)>Random then Inc(V) ;
>   Write(2.0/(V/W):0:6) ; Readln ;
>   end.
>
> This represents a needle of length 2 thrown on planks spaced by 2, and
> tests whether the projected half-length of the needle exceeds the
> distance between the centre and the nearest line.
>
> It will be interesting to see whether you've managed to avoid using a
> value for Pi, implicitly or explicitly, in the work.
>
> A quick test shows that the result obtained from the above code
depends
> on, but is not proportional to, the value used for Pi.

     I don't know whether there are any Pi's in Earl's code, but
they're not needed for the Buffon thing. You're letting the needle
spin at most one full revolution, stopping at some random spot
during the first revolution. If you instead let the needle spin
"forever" and stop it at a random spot between now and then you
get Pi.

     Ie: if you say cos(Random*L) for some large number L
instead of cos(Random*Pi*0.5) you get an estimate that approaches
Pi as L tends to infinity.

> --
>  � John Stockton, Surrey, UK.  jrs@merlyn.demon.co.uk   Turnpike v4.00
  MIME. �
>   Web <URL: http://www.merlyn.demon.co.uk/> - TP/BP/&c. FAQqish topics
& links.
>   Timo's TurboPascal <A
HREF="ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip">FAQ</A>.
>   <A HREF="http://www.merlyn.demon.co.uk/clpb-faq.txt">Mini-FAQ</A> of
c.l.p.b.
>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Technical Details
Message-ID: <7l0f2n$aha$1@nnrp1.deja.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7ks8ls$mgk$1@bgtnsc03.worldnet.att.net> <Im0c0MABmjc3Ew2K@merlyn.demon.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10a726,d24982a2aa52a35f
X-Google-Attributes: gid10a726,public
X-Google-Thread: 10baee,d24982a2aa52a35f
X-Google-Attributes: gid10baee,public
X-Google-Thread: 105ac8,d24982a2aa52a35f
X-Google-Attributes: gid105ac8,public
X-Google-Thread: 10a7f1,d24982a2aa52a35f
X-Google-Attributes: gid10a7f1,public
From: David C. Ullrich <ullrich@math.okstate.edu>
Subject: Re: Buffon's Needles
Date: 1999/06/25
Message-ID: <7l0f2n$aha$1@nnrp1.deja.com>
X-Deja-AN: 493828077
References: <7ks8ls$mgk$1@bgtnsc03.worldnet.att.net> <Im0c0MABmjc3Ew2K@merlyn.demon.co.uk>
X-Http-Proxy: 1.0 x36.deja.com:80 (Squid/1.1.22) for client 139.78.112.79
Organization: Deja.com - Share what you know. Learn what you don't.
X-Article-Creation-Date: Fri Jun 25 17:42:51 1999 GMT
Newsgroups: comp.lang.pascal.delphi.misc,alt.comp.borland-delphi,de.comp.lang.pascal.delphi,fr.comp.lang.pascal
X-Http-User-Agent: Mozilla/4.5 [en] (Win95; U)