Skip to main content

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

  1. True Polymorphism: Pass raw floats for blistering bare-metal speed, pass Vector3D objects for spatial mechanics, or pass sympy.Symbol variables to generate exact algebraic equations.
  2. 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.
  3. Strict Domain Gatekeeping: polymath-physics intercepts invalid physics requests (like passing negative masses or 3D vectors into scalar fields) with strict, polymorphic type-checking before the math ever crashes.
  4. 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

polymath_physics-2.0.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

polymath_physics-2.0.1-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

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

Hashes for polymath_physics-2.0.1.tar.gz
Algorithm Hash digest
SHA256 f2f12c4d6c5573126873db8b8a9449f21b5fa4c235e5a78af47c5d37c97d9047
MD5 8dc108903f2a9b9e27b802a01913dfd5
BLAKE2b-256 059d2a6006c7d19f41084e5cf2d31deb556adbff35b958ae58c44cdd5d67c0db

See more details on using hashes here.

File details

Details for the file polymath_physics-2.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for polymath_physics-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f9fb3a563747c215c0b44c82178891d9a87cd76d95f19ef419fdba73b1c606df
MD5 db6a2dff2f4e5c27acb9d64ff4987397
BLAKE2b-256 6957158ecf789bc5db940234f323ed1b7a52dfaa0018654bb7af21e21a13a8ba

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 Sentry Error logging StatusPage Status page