Calculating PI with Different Methods - KMCB1234

  • Thread starter Thread starter KMCB1234
  • Start date Start date
  • Tags Tags
    Pi
AI Thread Summary
To calculate pi and display the result, the Monte Carlo method is one option, but there are other methods as well. A suggested alternative involves using the arctan series, where arctan(1) equals π/4. This can be implemented in a program that runs a loop to compute pi using the series expansion: π = 4 * (1 - 1/3 + 1/5 - 1/7 + 1/9...). An example code for a TI-83 calculator demonstrates this approach, allowing for gradual updates of pi's value on the screen. The method isn't the fastest but is effective for visualizing the convergence to pi. The number of decimal digits that can be output depends on the programming environment and the precision of the data type used.
KMCB1234
Messages
18
Reaction score
0
In what way can i calculate PI and output the result to the screen ?
I heard from my friedn that MC method is good but is there any other ways to do that ? also, how many decimal digits am I able to output the result ?
Thank you in advance

-KMCB1234
 
Computer science news on Phys.org
Well for what purpose are you trying to calculate pi and what screen are you displaying it on??
 
If you are trying to write something to test the speed of computer or machine... or if you just want a basic way of calculating pi
i might suggest

since
arctan(1)=\frac{\pi}{4} = 1 - \frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\frac{1}{9}...
just multiply by 4 and have your program run a loop
\pi= 4-\frac{4}{3}+\frac{4}{5}-\frac{4}{7}+\frac{4}{9}...
 
Example code for TI-83

Pgrm Pi
Clrhome
4>p
3>n
0>s
lbl AA
Disp "Pi",p
If s=0
then
p-(4/n)>p
1>s
n+2>n
goto AA
End
If s=1
then
p+(4/n)>p
0>s
n+2>n
End
Goto AA
 
Last edited:
That should work I haven't tested it I just wrote it... I wrote a similar program a long time ago and I think I did something similar. This isn't the quickest way to calculate pi but its a good one if you want to see digits slowly change into pi.
 
I came across a video regarding the use of AI/ML to work through complex datasets to determine complicated protein structures. It is a promising and beneficial use of AI/ML. AlphaFold - The Most Useful Thing AI Has Ever Done https://www.ebi.ac.uk/training/online/courses/alphafold/an-introductory-guide-to-its-strengths-and-limitations/what-is-alphafold/ https://en.wikipedia.org/wiki/AlphaFold https://deepmind.google/about/ Edit/update: The AlphaFold article in Nature John Jumper...
Thread 'Urgent: Physically repair - or bypass - power button on Asus laptop'
Asus Vivobook S14 flip. The power button is wrecked. Unable to turn it on AT ALL. We can get into how and why it got wrecked later, but suffice to say a kitchen knife was involved: These buttons do want to NOT come off, not like other lappies, where they can snap in and out. And they sure don't go back on. So, in the absence of a longer-term solution that might involve a replacement, is there any way I can activate the power button, like with a paperclip or wire or something? It looks...
Back
Top