Polymath Physics
A world-class, heavily optimized, polymorphic physics and calculus engine backed by Triton GPU parallelization and SymPy's Exact Computer Algebra System (CAS).
Key Features
- True Polymorphism: Pass raw
floatsfor blistering bare-metal speed, passVector3Dobjects for spatial mechanics, or passsympy.Symbolvariables to generate exact algebraic equations. - Deep Calculus Integration: The engine doesn't just calculate numbers—it calculates equations. You can pass abstract algebraic positions and natively derive exact velocity and acceleration formulas.
- Strict Domain Gatekeeping:
polymath-physicsintercepts invalid physics requests (like passing negative masses or 3D vectors into scalar fields) with strict, polymorphic type-checking before the math ever crashes. - GPU Acceleration (Opt-in): For massive N-Body simulations and fluid dynamics, the library falls back onto highly parallelized Triton GPU kernels.
Installation
Install the core library (Zero external dependencies outside of sympy):
pip install polymath-physics
Install with massive parallel GPU acceleration enabled (Requires CUDA):
pip install polymath-physics[gpu]
Quick Start: The Power of Polymorphism
1. Bare-Metal Speed
When you need raw performance, just pass standard floats. The engine evaluates it instantly.
from physics.astrophysics.cosmology import schwarzschild_radius
# Calculate the Event Horizon of a black hole with mass 1.989e30 kg
r = schwarzschild_radius(mass=1.989e30)
print(r) # Returns: 2953.25 meters
2. Exact Calculus & Algebra
By combining polymath-physics with SymPy, you can derive exact mathematical formulas instead of just numeric answers.
from physics.solver import AlgebraicSolver
from physics.mechanics.calculus_kinematics import derive_velocity
# Create a variable 't' for time
t = AlgebraicSolver.create_symbol('t')
# Define an abstract position equation: p(t) = 5t^3 + 2t
position_eq = 5*(t**3) + 2*t
# Natively derive the exact algebraic velocity curve!
velocity_eq = derive_velocity(position_eq, time_symbol=t)
print(velocity_eq) # Returns: 15*t**2 + 2
3. Strict Physics Guardrails
Our built-in PhysicsDomainError strictly prevents invalid concepts (like negative mass) from polluting your calculations.
from physics.astrophysics.cosmology import schwarzschild_radius
# This will immediately raise a PhysicsDomainError!
schwarzschild_radius(mass=-500)
Architecture
polymath-physics spans across dozens of graduate-level domains, including:
- Classical Mechanics & Calculus Kinematics
- Quantum Mechanics & Plasma Physics
- General Relativity & Cosmology
- Advanced Fluid Dynamics & Thermodynamics
Complete API Reference
For an exhaustive list of all 100+ functions available in this library, please refer to the API Reference (or see the included API_REFERENCE.md file).
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 polymath_physics-2.0.1.tar.gz.
File metadata
- Download URL: polymath_physics-2.0.1.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2f12c4d6c5573126873db8b8a9449f21b5fa4c235e5a78af47c5d37c97d9047
|
|
| MD5 |
8dc108903f2a9b9e27b802a01913dfd5
|
|
| BLAKE2b-256 |
059d2a6006c7d19f41084e5cf2d31deb556adbff35b958ae58c44cdd5d67c0db
|
File details
Details for the file polymath_physics-2.0.1-py3-none-any.whl.
File metadata
- Download URL: polymath_physics-2.0.1-py3-none-any.whl
- Upload date:
- Size: 2.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9fb3a563747c215c0b44c82178891d9a87cd76d95f19ef419fdba73b1c606df
|
|
| MD5 |
db6a2dff2f4e5c27acb9d64ff4987397
|
|
| BLAKE2b-256 |
6957158ecf789bc5db940234f323ed1b7a52dfaa0018654bb7af21e21a13a8ba
|