Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/donno2048/anti-wallis
This repo is meant to show how horrible the Wallis function is and to ask every developer in the world to demolish it.
https://github.com/donno2048/anti-wallis
calculating-pi pi wallis
Last synced: about 1 month ago
JSON representation
This repo is meant to show how horrible the Wallis function is and to ask every developer in the world to demolish it.
- Host: GitHub
- URL: https://github.com/donno2048/anti-wallis
- Owner: donno2048
- License: mit
- Created: 2021-05-20T16:13:19.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-09-19T15:28:44.000Z (over 3 years ago)
- Last Synced: 2024-05-02T02:01:32.706Z (8 months ago)
- Topics: calculating-pi, pi, wallis
- Language: C
- Homepage: https://donno2048.github.io/Anti-Wallis/
- Size: 13.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Anti Wallis
John Wallis was a mathematician who found/discovered/invented the Wallis function (or Wallis product as its friends call it).
The Wallis function is the most used method to calculate pi.
As you have probably figured from the name of this repo I'm not the biggest fan of his function.
This repo is meant to show how horrible the Wallis function is and to ask every developer in the world to demolish it.
I implemented a better function to calculate pi, the code in the repo is running the function, and comparing it to the Wallis function.
## Usage
###### Instead of going through all this trouble you can just view the [Online Demo](https://replit.com/@donno2048/Anti-wallis) (press the "Run" button if needed)
### Clone the repo
```sh
git clone https://github.com/donno2048/Anti-wallis
cd Anti-Wallis
```
### Choose a language###### You should run the C version, it has the fastest Wallis function...
###### You can also install every requirement (`sudo apt update && sudo apt install gcc python3 nodejs golang-go -y`) and run the interactive session (`bash main.sh`)
C
#### Install the requirements (just the GCC compiler)
```sh
sudo apt update
sudo apt install gcc -y
```#### Compile
```sh
gcc c/main.c c/test.c c/pi.c -o main -lm
```#### Run
```sh
./main
```Python
#### Install the requirements (just the Python interpreter)
```sh
sudo apt update
sudo apt install python3 -y
```#### Run
```sh
python3 py/main.py
```JavaScript
#### Install the requirements (just the Node.js interpreter)
```sh
sudo apt update
sudo apt install nodejs -y
```#### Run
(`--experimental-modules` is only needed for node version <= `12`)
```sh
node --experimental-modules js/main.mjs
```Go
#### Install the requirements (just the Go compiler)
```sh
sudo apt update
sudo apt install golang-go -y
```#### Run
```sh
go run go/main.go go/pi.go go/test.go
```Rust
#### Install the requirements (just the Rust compiler)
```sh
sudo apt update
sudo apt install rustc -y
```#### Compile
```sh
rustc rust/main.rs
```#### Run
```sh
./main
```## Note
If you're wondering why so few digits of pi take so much time to evaluate note these two facts:
1. To benchmark the functions I'm running them `100` times
1. Not all the evaluated digits are being printed, simply because of the language itself or the properties of string formating in it