Skip to main content

The ultimate unified mathematics module - 3600+ functions from math, numpy, scipy, sympy and more

Project description

UniversalMath ๐Ÿงฎ

The Ultimate Unified Python Mathematics Module

Version 0.1.1 - Complete coverage with lazy loading

Python 3.7+ License: MIT


๐ŸŽฏ What is UniversalMath?

UniversalMath is a comprehensive, unified mathematics module that combines ALL functions from Python's mathematical ecosystem into a single, easy-to-use package. It features:

  • โœ… 3,600+ mathematical functions from one import
  • โœ… 100% coverage of math, cmath, statistics, decimal, fractions, numpy, scipy, sympy, pandas
  • โœ… 75+ custom utility functions for everyday math
  • โœ… Lazy loading - modules imported only when needed
  • โœ… Legacy support - works even if some modules aren't installed
  • โœ… Zero configuration - just import and use

๐Ÿš€ Quick Start

import universalmath as um

# Standard math - works immediately
um.sqrt(16)                    # 4.0
um.sin(um.pi/2)                # 1.0
um.factorial(5)                # 120

# Statistics
um.mean([1, 2, 3, 4, 5])       # 3.0
um.stdev([1, 2, 3])            # 1.0

# Custom utilities
um.is_prime(17)                # True
um.fibonacci(10)               # [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
um.lerp(0, 100, 0.5)           # 50.0

# NumPy (auto-loaded when first used)
um.np_array([1, 2, 3])         # array([1, 2, 3])
um.matrix([[1,2],[3,4]])       # 2x2 matrix

# SciPy (auto-loaded when first used)
um.sp_stats_norm.pdf(0)        # 0.3989422804014327
um.sp_optimize_minimize(...)   # Optimization

# Symbolic math (auto-loaded when first used)
x = um.sym_Symbol('x')
um.sym_diff(x**2, x)           # 2*x

๐Ÿ“ฆ Installation

# Basic installation (standard library only)
pip install -e .

# Full installation (with all optional packages)
pip install -e ".[full]"

# Install specific extras
pip install -e ".[numpy]"      # Just NumPy
pip install -e ".[scipy]"      # NumPy + SciPy
pip install -e ".[symbolic]"   # SymPy for symbolic math

โšก Key Features

1. Lazy Loading

Modules are imported only when you use them, saving memory and import time:

import universalmath as um  # Instant, no heavy imports

um.sqrt(16)           # Uses built-in math (already loaded)
um.np_array([1,2,3])  # NOW numpy gets imported
um.sym_Symbol('x')    # NOW sympy gets imported

2. 100% Coverage

Every single function from each module is available:

Core Modules (188 functions):

  • โœ… math (52 functions) - Real number mathematics
  • โœ… cmath (30 functions) - Complex number mathematics
  • โœ… statistics (37 functions) - Statistical analysis
  • โœ… decimal (3 items) - High-precision arithmetic (Decimal class + rounding modes)
  • โœ… fractions (1 items) - Rational number arithmetic (Fraction class)
  • โœ… random (32 functions) - Random number generation (includes classes and constants)
  • โœ… builtins (5 functions) - Python built-ins (abs, round, min, max, sum, pow, len, sorted, reversed)

NumPy (581 functions):

  • โœ… numpy (466 functions) - Array operations & numerical computing
  • โœ… numpy.linalg (33 functions) - Linear algebra
  • โœ… numpy.random (63 functions) - Random number generation
  • โœ… numpy.fft (19 functions) - Fast Fourier transforms

SciPy (1,179 functions):

  • โœ… scipy.stats (302 functions) - Statistical distributions & tests
  • โœ… scipy.linalg (100 functions) - Advanced linear algebra
  • โœ… scipy.optimize (72 functions) - Optimization & root finding
  • โœ… scipy.integrate (34 functions) - Numerical integration & ODEs
  • โœ… scipy.interpolate (58 functions) - Data interpolation
  • โœ… scipy.signal (158 functions) - Signal processing
  • โœ… scipy.fft (42 functions) - FFT operations
  • โœ… scipy.special (363 functions) - Special mathematical functions
  • โœ… scipy.sparse (50 functions) - Sparse matrix operations

Symbolic & Data (977 functions):

  • โœ… sympy (875 functions) - Symbolic mathematics & computer algebra
  • โœ… pandas (102 functions) - Data analysis & manipulation

PyPyNum (415 functions):

  • โœ… pypynum (413 functions) โ€“ Pure Python scientific computing
  • โœ… pypynum.arrays (21 functions) โ€“ Array utilities
  • โœ… pypynum.equations (2 functions) โ€“ Equation solvers
  • โœ… pypynum.graphs (6 functions) โ€“ Graph-related utilities
  • โœ… pypynum.maths (88 functions) โ€“ Core mathematical functions
  • โœ… pypynum.matrices (21 functions) โ€“ Matrix operations
  • โœ… pypynum.multiprec (26 functions) โ€“ Multi-precision arithmetic
  • โœ… pypynum.random (12 functions) โ€“ Random utilities
  • โœ… pypynum.regs (4 functions) โ€“ Regression utilities
  • โœ… pypynum.stattest (6 functions) โ€“ Statistical tests
  • โœ… pypynum.symbols (1 function) โ€“ Symbol definitions
  • โœ… pypynum.tensors (5 functions) โ€“ Tensor operations
  • โœ… pypynum.tools (31 functions) โ€“ Helper and utility tools
  • โœ… pypynum.vectors (3 functions) โ€“ Vector operations

Custom Utilities (78 functions):

  • โœ… universalmath.utils (77 functions) - Number theory, geometry, finance, interpolation, vectors, CLI tools, etc.
  • โœ… universalmath.cli (1 function) - Command-line interface

๐ŸŽฏ GRAND TOTAL: 3,614 functions from one import!

3. 75+ Custom Utilities

Practical functions you actually need:

# Number theory
um.is_prime(17)                          # True
um.primes_up_to(50)                      # [2, 3, 5, 7, 11, ...]
um.prime_factors(60)                     # [2, 2, 3, 5]
um.totient(9)                            # Euler's totient: 6
um.chinese_remainder_theorem([2,3], [5,7])  # CRT solver

# Interpolation
um.lerp(0, 100, 0.5)                     # 50.0
um.remap(5, 0, 10, 0, 100)               # 50.0
um.smoothstep(0, 1, 0.5)                 # Smooth easing

# Finance
um.compound_interest(1000, 0.05, 10)     # $1628.89
um.annuity_payment(10000, 0.05/12, 60)   # Monthly payment

# Numerical methods
um.newton_raphson(lambda x: x**2 - 2, lambda x: 2*x, 1)  # Find โˆš2
um.numerical_integral_simpson(lambda x: x**2, 0, 1)      # โˆซxยฒdx

# Geometry
um.circle_area(5)                        # 78.54
um.sphere_volume(3)                      # 113.10
um.polygon_area([(0,0), (1,0), (1,1)])  # 0.5

# Vectors
um.dot_product([1,2,3], [4,5,6])        # 32
um.cross_product_3d([1,0,0], [0,1,0])   # (0, 0, 1)
um.angle_between_vectors([1,0], [0,1])  # 1.5708 (ฯ€/2)

# Unit conversions
um.celsius_to_fahrenheit(100)            # 212.0
um.degrees_to_radians_precise(45, 30, 0) # Degrees/minutes/seconds

4. Legacy Support

Works on any system, even with missing packages:

# On a minimal system without NumPy
import universalmath as um

um.sqrt(16)        # โœ… Works (uses built-in math)
um.mean([1,2,3])   # โœ… Works (uses built-in statistics)
um.np_array([1,2]) # โŒ Raises helpful error: "NumPy not installed"

5. Smart Naming

Clear prefixes prevent conflicts:

Module Prefix Example
math none sqrt, sin
cmath c csqrt, csin
numpy np_ np_array, np_mean
scipy.stats sp_stats_ sp_stats_norm
scipy.optimize sp_optimize_ sp_optimize_minimize
sympy sym_ sym_diff, sym_integrate
pandas pd_ pd_DataFrame

๐Ÿ“Š Comparison

Feature UniversalMath Standard Approach
Import complexity import universalmath as um Multiple imports
Functions available 3,600+ Need to remember which module
Memory usage Lazy loaded All upfront
Coverage 100% of all modules Manual selection
Utilities 75+ included Write your own
Legacy support โœ… Graceful degradation โŒ Crashes if missing

๐Ÿ“„ License

MIT License - See LICENSE file for details


๐Ÿ™ Acknowledgments

UniversalMath builds upon:

  • Python Standard Library (math, cmath, statistics, decimal, fractions, random)
  • NumPy
  • SciPy
  • SymPy
  • Pandas
  • PyPyNum

Made with โค๏ธ for mathematicians, scientists, engineers, and developers who want math to just workโ„ข

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

universalmath-0.1.1.tar.gz (28.7 kB view details)

Uploaded Source

Built Distribution

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

universalmath-0.1.1-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file universalmath-0.1.1.tar.gz.

File metadata

  • Download URL: universalmath-0.1.1.tar.gz
  • Upload date:
  • Size: 28.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for universalmath-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e4df74584488b4b9f3169e8478cafc37b310f2d1549629ad6384569a27f4bcac
MD5 ce298efc340e41aac509f993a59442f6
BLAKE2b-256 6fdc835c96ba30b140ced576396098973b590eee9709b60fc097809dcb934a5a

See more details on using hashes here.

File details

Details for the file universalmath-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: universalmath-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for universalmath-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 548c16e7db82d057781f819f5a76f28baaf5cd51abbd1838de3cc7437e5c1f49
MD5 4b8c2fb3835fbf7fbc291ec9cf630673
BLAKE2b-256 125ccd7e1305b8dec93e46d85bdc5d4f981175704c4b093b0495b634f2dd5e75

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