An open API service indexing awesome lists of open source software.

https://github.com/kawacoder/pi-calculator-java


https://github.com/kawacoder/pi-calculator-java

Last synced: 9 months ago
JSON representation

Awesome Lists containing this project

README

          

# Pi-calculator-java
Pi calculator is a simple program which compute pi with infinite calcul serie.

## How it works?
Pi calculator is using three different methods: the Gregory-Leibniz series, the Nilakantha series, and the Gauss algorythm.

### The Gregory-Leibniz series
It uses this propriety of pi: π = (4/1) - (4/3) + (4/5) - (4/7) + (4/9) - (4/11) + (4/13) - (4/15) ...

[Click here for more about the Gregory-Leibniz series method (wikipedia)](https://en.wikipedia.org/wiki/Leibniz_formula_for_%CF%80)

### The Nilakantha series
This method is doing this infinite sequence: π = 3 + (4/2x3x4) - (4/4x5x6) + (4/6x7x8) ...

[Click here for more about the Nilakantha series](https://www.researchgate.net/publication/283579663_Nilakantha's_accelerated_series_for_pi)

### The Gauss algorythm
This algorythm, originally written in c, computes an aproximation of pi very quickly! So, i adapted it in java.

[Click here for more details about the Gauss algorythm](https://cage.ugent.be/~hvernaev/Gauss-L.html)

#### Disclaimer
Don't use this program to get the pi value! it will only gives you aproximations of pi! Of course, these methods can calculate a huge number of decimals, but
i adapted it to be simply and fast. This little program is written to show the differences about the differents methods, like the precision and speed.
If you want, you can use it for your studies, at your own risk ;)

#### Other information
You can also modify this code as you want, just tag my pseudo on it! That's all! Thanks! ;)

If you think that this code can be upgraded, so the commit requests are opened!