Calculating PI with Different Methods - KMCB1234

  • Thread starter KMCB1234
  • Start date
  • Tags
    Pi
In summary, the conversation discusses different methods for calculating pi and outputting the result to a screen. The MC method is mentioned as a good option, but the speaker also suggests using the arctan formula to calculate pi. They provide an example code for doing so on a TI-83 calculator. The method may not be the quickest, but it allows for slowly changing digits to display the value of pi. The speaker also asks for clarification on the purpose and screen for displaying the calculation.
  • #1
KMCB1234
18
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
  • #2
Well for what purpose are you trying to calculate pi and what screen are you displaying it on??
 
  • #3
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
[tex] arctan(1)=\frac{\pi}{4} = 1 - \frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\frac{1}{9}[/tex]...
just multiply by 4 and have your program run a loop
[tex] \pi= 4-\frac{4}{3}+\frac{4}{5}-\frac{4}{7}+\frac{4}{9}[/tex]...
 
  • #4
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:
  • #5
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.
 

What is the value of PI?

The value of PI is a mathematical constant that is approximately equal to 3.14159.

How can PI be calculated?

There are various methods for calculating PI, including the Monte Carlo method, the infinite series method, and the polygon approximation method.

What is the Monte Carlo method for calculating PI?

The Monte Carlo method uses random numbers to estimate the value of PI by simulating the process of throwing darts at a circular target. The ratio of darts that land within the circle to the total number of darts thrown can be used to approximate PI.

What are the advantages of using the Monte Carlo method for calculating PI?

The Monte Carlo method is relatively simple and easy to understand, and can be used to calculate PI with a high degree of precision. It can also be easily adapted to different programming languages and can handle complex shapes, unlike other methods.

What are the limitations of using the Monte Carlo method for calculating PI?

The Monte Carlo method is a stochastic method, meaning that the accuracy of the calculation depends on the number of random samples used. It also requires a large number of iterations to achieve a high level of precision, making it computationally expensive. Additionally, it can be affected by the quality of the random number generator used.

Similar threads

Replies
3
Views
2K
Replies
4
Views
920
  • Computing and Technology
Replies
3
Views
344
  • Introductory Physics Homework Help
Replies
16
Views
516
  • Computing and Technology
Replies
3
Views
811
  • Calculus
Replies
16
Views
463
  • Computing and Technology
Replies
3
Views
647
  • Introductory Physics Homework Help
Replies
8
Views
662
Replies
4
Views
402
Replies
1
Views
1K
Back
Top