A Python package for Pi calculations.
Project description
Pi Library
pilibr is a simple Python package for performing calculations with π (Pi).
It provides a symbolic Pi class as well as functions for approximating Pi using different methods.
Installation
You can install the package via pip/npm:
pip install pilibr
npm install pilibr
Or install locally for development:
Currently not supported. Please check back in version 0.0.2.
Usage
Using the Pi class
from pilibr import Pi
# Create Pi objects
pi_default = Pi() # 1 * π / 1
pi_half = Pi(1, 2) # 1 * π / 2
# Symbolic representation
print(pi_default) # 1 * π / 1
# Numerical approximation
print(pi_default.evall(10000)) # Leibniz method
print(pi_default.evaln(5000)) # Nilakantha method
Using the helper function pif
from pilibr import pif
# Approximate Pi using the Leibniz series
print(pif(method="leibniz", iterations=10000))
# Approximate Pi using the Nilakantha series
print(pif(method="nilakantha", iterations=5000))
Features
-
Symbolic Pi representation
-
Approximation using:
- Leibniz series
- Nilakantha series
-
Easy-to-use helper function
pif
License
This project is licensed under the Apache-2.0 License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pilibr-0.0.1.tar.gz.
File metadata
- Download URL: pilibr-0.0.1.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24c1f3dc3582aa19ee23d240dc09fcd73a21bb06955a15567c9eadc4bf3803f6
|
|
| MD5 |
38ef5b7437f690a36f469a05176e15db
|
|
| BLAKE2b-256 |
e9bd0e02aa1cfa1095d391ead8f4d4dd23e7b05ae93b8ac88b0e93edc88e2149
|
File details
Details for the file pilibr-0.0.1-py3-none-any.whl.
File metadata
- Download URL: pilibr-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5ed3114f6a2fab502bacff68601a3e17a442fa4f0ca07ff500fb210fb3af844
|
|
| MD5 |
3c73b803aa8e818c77c7f3148f7dec24
|
|
| BLAKE2b-256 |
0c0304046783d97acecf76a7d6d2ce72e36ac386ec4ba396cd4ba5e5c487ba93
|