Skip to main content

Calculate Pi easily with the Calpi library

Project description

The CalPi library is currently in its alpha development phase.

Disclaimer:

At the recommended iteration setting of 4,000, CalPi can reliably compute up to 1,000 digits of π. Reducing the iteration count may significantly decrease the accuracy of the results. Increasing iterations beyond 50,000 is possible but may cause instability or potential failures in the library’s calculations.

Functionality:

The CalPi library is designed to calculate up to 1,000 digits of π with high precision, offering a practical tool for applications requiring precise values of π for mathematical or scientific computations. CalPi is ideal for environments that need consistent precision with moderate computational resources, like educational purposes or high-accuracy simulations.

Usage Example:

from decimal import Decimal, getcontext
from calpi import calpiinfo  

# Create an instance of calpiinfo
pi_calculator = calpiinfo()

# Example usage of the calpi function to calculate Pi
amount = 100  # The number of digits of Pi you want to calculate
iterations = 1000  # Number of iterations for the Chudnovsky algorithm

# Calculate Pi with high precision
calculated_pi = pi_calculator.calpi(amount, iterations)
print(f"Calculated Pi with {amount} digits: {calculated_pi}")

# Example usage of the binaryencode function to convert a string to binary
text = "Hello, World!"  # The string to be encoded
binary_encoded = pi_calculator.binaryencode(text)
print(f"Binary Encoding of '{text}': {binary_encoded}")

# Example usage of the binarydecode function to decode the binary string back to text
binary_string = binary_encoded  # Using the previously encoded binary string
decoded_text = pi_calculator.binarydecode(binary_string)
print(f"Decoded Binary String: {decoded_text}")

This will output:

3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912983367336244065664308602139494639522473719070217986094370277053921717629317675238467481846766940513200056812714526356082778577134275778960917363717872146844090122495343014654958537105079227968925892354201995611212902196086403441815981362977477130996051870721134999999837297804995105

A note from the developer: This is my first library- Whether it recieves more features and updates as time progresses is uncertain, love you guys <3

For Further Reading on each feature of Calpi, visit: https://calpi-docs.onrender.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

calpi-1.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

calpi-1.1-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file calpi-1.1.tar.gz.

File metadata

  • Download URL: calpi-1.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for calpi-1.1.tar.gz
Algorithm Hash digest
SHA256 566aa24e696cb44fd5e4d63413e6dbbd95671f67ec42a024563aa804b804ae2e
MD5 eee415aac4831ce8dd2fa05678a6be31
BLAKE2b-256 4ca9bc6d226b98e7c12c8501f46e16fc54b723ae2f2c739f3cd74c613b53615a

See more details on using hashes here.

File details

Details for the file calpi-1.1-py3-none-any.whl.

File metadata

  • Download URL: calpi-1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for calpi-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 34f9bd4690d15a445848a2bb13352360fc837be37987573ed4b60214e329da0a
MD5 ad67e72f871b3bc2e2c6e81b8a27c492
BLAKE2b-256 eb8f10b6e13ced213d9b679967bbe1bf31c13fdece68802bf04190785b6f350a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page