Post Reply 
(48) Buffon's Needle
09-08-2019, 04:04 PM
Post: #1
(48) Buffon's Needle
An extract from Buffon, [kiyoshiakima url]

"2 Simulation Programs
Buffon's Needle can be implemented easily on all but the smallest HP programmable calculators …
2.3 RPL
Using RPL for the HP 48 series, the program practically writes itself from the problem description, doing everything on the stack and using a vector instead of numbered registers.
«
0 11 FOR j
j
NEXT
LIST { 11 } 0 CON
1 4 PICK START
1
1 10 START
RAND RAND ‡ * SIN < +
NEXT
DUP2 GET 1 + PUT
NEXT
OBJ DROP 11 LIST SWAP OVER * …LIST ROT 20 * SWAP /
»
Like the RPN version, this program takes the desired number of ten-throw trials on the stack. Also like the RPN version, it expects to be in RAD mode. It also expects symbolic mode to be o. It finishes with an estimate for π on level 1 and a list holding the results on level 2. Unlike the RPN version, a second run of this program does not add to a cumulative total."

BEST!
SlideRule
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)