A package for performing mathematical calculations on pyramids.
Project description
PyramidMath - A Python Package for Pyramid Geometry and Mathematical Constants
pyramid_math is a Python package for analyzing the geometrical properties and mathematical constants of pyramids. It provides tools for calculating various attributes such as apothem, edge length, slope angle, and comparisons with mathematical constants like π (Pi), φ (Golden Ratio), and Tribonacci constant. The package includes a predefined database of famous pyramids (e.g., Great Pyramid of Giza, Pyramid of Khafre, and more) and supports user-defined custom pyramids with specific measurements.
The package is designed for educational purposes, historical research, and exploring the mathematical connections of ancient pyramids. It can be used to perform detailed analysis, comparisons, and special calculations on pyramids, making it a valuable tool for students, researchers, and enthusiasts interested in pyramid geometry and mathematical relationships.
Table of Contents
Features
- Calculate geometrical properties of pyramids (e.g., apothem, edge, slope angle).
- Compare pyramid measurements with known mathematical constants.
- Predefined database of famous pyramids (e.g., Great Pyramid of Giza, Pyramid of Khafre, and more).
- Supports both predefined pyramids and custom pyramids with user-defined measurements.
Installation
You can install the package via pip from PyPI:
pip install pyramid_math
Usage
Once installed, you can use the package to analyze various pyramids. Here’s how to get started:
Importing the Package
from pyramid_math.pyramid import Pyramid
Predefined Pyramid Example
You can use one of the predefined pyramids from the database:
# Load the Great Pyramid of Giza from the predefined database
giza = Pyramid.from_database("great_pyramid_giza")
# Perform detailed analysis
giza.detailed_analysis(json=False)
This will output a detailed analysis of the Great Pyramid, including the comparison with mathematical constants like Pi, Golden Ratio, Tribonacci constant, and others.
Custom Pyramid Example
You can also create your own custom pyramid by providing its measurements:
# Create a custom pyramid with specified measurements (base lengths and height)
pyramid = Pyramid("Test Pyramid", 100, 100, 50)
# Perform special calculations on the custom pyramid
special_calcs = pyramid.perform_special_calculations()
print(special_calcs)
Example Output:
{
'pivalue': 3.0000,
'goldenratio': 1.6180,
'sqrt_goldenratio': 0.7273,
'difference_from_pi': 0.0000,
'difference_from_phi': 0.0000,
'slope_angle': 26.5651
'my_method_1_pi':3.0000,
'my_method_2_pi':3.0000,
'my_method_golden_ratio':1.6180
}
List Available Pyramids
You can list all available pyramids from the predefined database:
# List all available pyramids in the database
pyramids = Pyramid.list_pyramids()
print(pyramids)
Example Output:
{
'great_pyramid_giza': 'Great Pyramid of Giza (Pyramid of Khufu)',
'pyramid_khafre': 'Pyramid of Khafre',
'red_pyramid': 'Red Pyramid',
'bent_pyramid': 'Bent Pyramid',
'pyramid_menkaure': 'Pyramid of Menkaure',
'sun_pyramid_teotihuacan': 'Pyramid of the Sun',
'pyramid_coba': 'Pyramid of Coba',
'nubian_pyramids': 'Nubian Pyramids of Meroe'
}
Comparing Multiple Pyramids
You can compare measurements of multiple pyramids from the database:
# Compare the Great Pyramid of Giza and the Pyramid of Khafre
comparison = Pyramid.compare_pyramids("great_pyramid_giza", "pyramid_khafre")
print(comparison)
Example Output:
{
'Great Pyramid of Giza (Pyramid of Khufu)': {
'height': 481.0,
'base_length': 756.0,
'slope_angle': 51.84,
'pi_ratio': 3.1454,
'golden_ratio': 1.6180
},
'Pyramid of Khafre': {
'height': 448.0,
'base_length': 706.0,
'slope_angle': 53.13,
'pi_ratio': 3.1457,
'golden_ratio': 1.6182
}
}
Mathematical Constants and Comparisons
The package compares the following constants:
- π (Pi): The ratio of the base perimeter to the height of the pyramid.
- φ (Golden Ratio): The ratio of the edge length to half of the base length.
- Tribonacci Constant: A constant derived from the geometry of the pyramid.
- √5, √3: Square roots of mathematical constants, compared with pyramid measurements.
Detailed Analysis Output
When running the detailed_analysis(json=False) method, you will get comprehensive output that compares various calculations of the pyramid to well-known mathematical constants.
Example Output:
Detailed Analysis of Great Pyramid of Giza:
Measurements and Calculated Values:
North Base Length: 756.00 ft
Eastern Base Length: 756.00 ft
Height: 481.00 ft
Special Calculations vs Mathematical Constants:
(North base + Eastern base) / Height = 3.1454
Actual π value = 3.1416
Difference from π = 0.0038
Edge / (Base length / 2) = 1.6180
Actual φ (Golden Ratio) = 1.6180
Difference from φ = 0.0000
Apothem / Height = 0.7273
Actual √φ = 0.8510
Difference from √φ = 0.1237
Pyramid Slope Angle: 51.84 degrees
calculate_diagonal (CG) / Base Length = 0.9220
Difference from √2 = 0.0214
Calculated Tribonacci Constant = 1.8393
Actual Tribonacci Constant = 1.8393
Difference from Tribonacci Constant = 0.0000
(Base Length + Apothem) / Apothem = 2.6180
Actual √5 = 2.2361
Difference from √5 = 0.3819
(Height + CG + CG) / (North Base + Eastern Base) = 1.7321
Actual √3 = 1.7321
Difference from √3 = 0.0000
Apothem / (Apothem + Half Base Length) = 0.6180
Actual φ - 1 = 0.6180
Difference from φ - 1 = 0.0000
My method 1 pi:
Calculated: 3.143442090
Difference from pi: 0.001849430
My method 2 pi:
Calculated: 3.143451140
Difference from pi: 0.001858490
My method 3 golden ratio:
Calculated: 1.617506900
Difference from golden ratio: 0.000527090
CG (Center of Gravity)
Note: In this package, CG refers to the diagonal of the pyramid, not the center of gravity. This is used in comparisons to constants like √2 and Tribonacci.
Repository Views
Contributing
Feel free to contribute by creating pull requests, reporting issues, or submitting feature requests.
License
MIT License. See the LICENSE file for details.
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
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 pyramid_math-0.0.5.tar.gz.
File metadata
- Download URL: pyramid_math-0.0.5.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c043bce55f79ef03b7f6bba57d7702769f9a7869c37d8383b7de01be01c610cc
|
|
| MD5 |
f83314c00c68ec83e0b3a889ea24f701
|
|
| BLAKE2b-256 |
3992557ec4de00e32ed4c0bc6b1c3b1bb1e3bdcc6758e2c3fddf76e70c7c6335
|
File details
Details for the file pyramid_math-0.0.5-py3-none-any.whl.
File metadata
- Download URL: pyramid_math-0.0.5-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44bc93d8539a38b085b03ba73a6bd9f6bc5074e4536c4b6e6950c799111fb347
|
|
| MD5 |
46738c994eb8ee80ad8015e7dca55413
|
|
| BLAKE2b-256 |
8fe4bb7460409b775ceb824a6f4b2ccdffc2a44e34e0030062c9eb1ca23fac9d
|