Jump to content
Sign in to follow this  
Vorticon

Pi Day - Calculate Pi on the TI

Recommended Posts

19 hours ago, Vorticon said:

Well it seems that the random shot method has its limits. After 14.3 billion iterations, PI has converged to 3.141076. I guess we're not going to get that 4th decimal after all. Interesting...

 

PI-MLC.jpg.0eaebe97fff293b74ff05c1a6eaaa5e9.jpg

Hi !

 

The RND function used has a precision of 1/4096 = 0.00024.

The best we can expect is a value in PI +/- 0.00024

3.1413 and 3.1418

 

Guillaume.

  • Like 1

Share this post


Link to post
Share on other sites

Hi,

 

Supposing that every value of the RND generator appears as many times as the others, here is a calculation of the "Best PI' you can expect according to the number of bits of the RND value.

 

Note: for MLC, the number of bits is 12.

 

50 CALL CLEAR
100 INPUT "# of bits in RND : ":B
105 S=0::R=2^B-1::R2=R*R
110 FOR I=0 TO R
120 S=S+INT(SQR(R2-I*I))
130 NEXT I
140 PRINT "Best PI with";B;"bits"
150 PRINT 4*S/(2^(2*B))
160 PRINT
170 GOTO 100


Take care of the calculation time. Use the CPU overdrive mode...

 

Guillaume.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...