A comprehensive mathematics library... Growing daily with new functions
Project description
🧮 numcore
A comprehensive mathematics library built from scratch by a first-year student. Growing daily with new functions across statistics, number theory, linear algebra, and more.
🚀 Installation
pip install numcore
📖 Usage
Statistical Analysis
from numcore import (mean, median, std, analyze_list, covariance,
z_score, coefficient_of_variation)
data = [23, 45, 67, 45, 89, 34, 78, 98, 54, 55]
print(mean(data)) # 58.8
print(std(data)) # 23.82
# Advanced stats
print(z_score(75, data)) # Standard score
print(coefficient_of_variation(data)) # Relative variability
print(covariance([1,2,3], [2,4,6])) # Covariance
Means (Arithmetic, Geometric, Harmonic)
from numcore import mean, geometric_mean, harmonic_mean
data = [2, 4, 8]
print(mean(data)) # 4.67 (arithmetic)
print(geometric_mean(data)) # 4.0 (geometric)
print(harmonic_mean(data)) # 3.43 (harmonic)
Number Theory
from numcore import (is_prime, gcd, euler_totient, mobius,
legendre_symbol, is_coprime, catalan_number)
print(is_prime(17)) # True
print(euler_totient(9)) # 6
print(mobius(30)) # -1
print(is_coprime(8, 15)) # True
print(catalan_number(5)) # 42
Sequences
from numcore import (fibonacci, arithmetic_seq, geometric_seq,
lucas, collatz, harmonic_series)
print(fibonacci(10)) # [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
print(arithmetic_seq(2, 3, 5)) # [2, 5, 8, 11, 14]
print(geometric_seq(2, 3, 4)) # [2, 6, 18, 54]
print(harmonic_series(5)) # 2.283... (1 + 1/2 + 1/3 + 1/4 + 1/5)
Combinatorics & Probability
from numcore import npr, ncr, binomial_coeff
print(npr(5, 3)) # 60 (permutations)
print(ncr(5, 3)) # 10 (combinations)
print(binomial_coeff(5, 2)) # 10 (same as ncr)
Financial Mathematics
from numcore import rate_of_return
print(rate_of_return(110, 100)) # 10.0% gain
print(rate_of_return(90, 100)) # -10.0% loss
✨ Features
Input Functions (2)
n_input(n)- Get n integers with validationinput_matrix()- Interactive matrix input
Basic Statistics (6)
mean(lst)- Arithmetic meanmedian(lst)- Middle valuemode(lst)- Most common value(s)variance(lst, sample)- Variancestd(lst, sample)- Standard deviationanalyze_list(lst)- Comprehensive analysis
Advanced Statistics (7)
geometric_mean(lst)- Geometric meanharmonic_mean(lst)- Harmonic meancovariance(lst1, lst2)- Covariancez_score(x, lst)- Standard scorepercentile(lst, p)- pth percentile valuecoefficient_of_variation(lst)- Relative variability (CV)mean_absolute_deviation(lst)- MAD
Number Theory (22)
factorial(n),nth_root(num, n)divisors(num),proper_divisors(num),common_divisors(a,b)gcd(a, b),lcm(a, b)is_prime(num),primes(num)prime_divisors(num),prime_factorization(num),prime_factors(num)is_perfect(num),is_armstrong(num),is_amicable(a,b)euler_totient(num)- Euler's φ functionmobius(num)- Möbius μ functionquadratic_residue(num),quadratic_non_residue(num)legendre_symbol(a, p)- Legendre symbolis_coprime(a, b)- Check if coprimecatalan_number(n)- nth Catalan number
Sequences (15)
- Fibonacci:
fibonacci(n),nth_fibonacci(n) - Lucas:
lucas(n),nth_lucas(n) - Arithmetic:
arithmetic_seq(a,d,n),nth_arithmetic(a,d,n),arithmetic_sum(a,d,n) - Geometric:
geometric_seq(a,r,n),nth_geometric(a,r,n),geometric_sum(a,r,n) - Harmonic:
harmonic_seq(a,d,n),nth_harmonic(a,d,n),harmonic_sum(a,d,n) - Special:
collatz(n),farey(num),harmonic_series(n)
Combinatorics (3)
npr(n, r)- Permutationsncr(n, r)- Combinationsbinomial_coeff(n, k)- Binomial coefficient
Digit Operations (3)
digits(num)- Extract digits as listreverse_number(num)- Reverse digitssum_of_digits(num)- Sum all digits
List Utilities (4)
counter(lst)- Count occurrencesproduct(lst)- Multiply all elementspower_list(lst, power)- Apply power to eachreciprocal_list(lst)- Calculate reciprocals
Basic Matrix Operations (8)
create_matrix(rows, cols, fill)- Create matrixmatrix_shape(matrix)- Get dimensionsmatrix_add(mat1, mat2)- Additionmatrix_sub(mat1, mat2)- Subtractionscalar_multiply(matrix, scalar)- Scalar multiplicationmatrix_multiply(mat1, mat2)- Matrix multiplicationprint_matrix(matrix)- Pretty print
Advanced Matrix Operations (9)
matrix_identity(n)- Identity matrixmatrix_transpose(matrix)- Transposematrix_trace(matrix)- Tracedeterminant(matrix)- Determinant (recursive)matrix_minor(matrix)- Matrix of minorsmatrix_cofactor(matrix)- Cofactor matrixmatrix_power(matrix, n)- Matrix exponentiationis_square(matrix)- Check if squareis_orthogonal(matrix)- Check orthogonality
Utility Functions (2)
signum(x)- Sign functionrate_of_return(current, original)- Financial return %
🎯 Roadmap
- Statistical analysis (basic & advanced)
- Number theory suite
- Sequence generation
- Matrix operations (basic & advanced)
- Combinatorics
- Trigonometry (sin, cos, tan with degrees)
- Linear algebra (eigenvalues, decomposition)
- Calculus (derivatives, integrals)
- Probability distributions
- Graph theory
- Optimization algorithms
- And more... continuously growing!
📊 Current Library
Total Functions: 84
Growing daily with new mathematical capabilities!
💡 Example Use Cases
Portfolio Analysis
from numcore import rate_of_return, mean, std
returns = [5.2, -2.1, 8.3, 3.4, -1.5]
avg_return = mean(returns)
volatility = std(returns)
print(f"Average: {avg_return}%, Volatility: {volatility}%")
Data Science: Z-Scores
from numcore import z_score
exam_scores = [72, 85, 90, 65, 88, 92, 78]
your_score = 88
z = z_score(your_score, exam_scores)
print(f"Your z-score: {z:.2f}") # How many std devs above/below mean
Catalan Numbers (Binary Trees)
from numcore import catalan_number
# How many different binary trees with n nodes?
for n in range(6):
print(f"{n} nodes: {catalan_number(n)} trees")
# 0: 1, 1: 1, 2: 2, 3: 5, 4: 14, 5: 42
Covariance (Relationship Between Variables)
from numcore import covariance
hours_studied = [2, 4, 6, 8, 10]
exam_scores = [55, 65, 75, 85, 95]
cov = covariance(hours_studied, exam_scores)
print(f"Covariance: {cov}") # Positive = both increase together
🛠️ Development
Requirements
- Python 3.7+
- No external dependencies!
Organization
Functions are organized by category for easy navigation and use.
📝 License
MIT License - see LICENSE file for details
👨💻 Author
Ujwal Mantri
- PyPI: numcore
- GitHub: ujwalmantri
- Email: ujwalmantrifr@gmail.com
🌟 Support
If you find this helpful:
- ⭐ Star on GitHub
- 📦
pip install numcore - 📢 Share with others
🎓 Learning Journey
Milestones
- ✅ Published to PyPI
- ✅ 84+ functions implemented
- ✅ Advanced statistics suite
- ✅ Complete sequence generation
- ✅ Graduate-level number theory
- 🎯 Next: Organizing into modules
- 🔄 Continuously adding new functions
What Makes This Special
- Built from scratch by first-year student
- Pure Python (zero dependencies)
- Comprehensive documentation
- Real mathematical algorithms
- Open source learning resource
- Growing daily!
📚 Function Categories
| Category | Count | Status |
|---|---|---|
| Statistics | 13 | ✅ Comprehensive |
| Number Theory | 22 | 🔄 Growing |
| Sequences | 15 | ✅ Complete |
| Combinatorics | 3 | 🔄 Growing |
| Matrix Operations | 17 | ✅ Complete |
| List Utilities | 4 | ✅ Complete |
| Digit Operations | 3 | ✅ Complete |
| Financial Math | 1 | 🔄 Starting |
| Utilities | 2 | 🔄 Starting |
| Input/Output | 2 | ✅ Complete |
| Total | 84+ | 🔄 Active Development |
Crafted with Python. Powered by curiosity. Open-sourced for learning. ⚡
Project details
Release history Release notifications | RSS feed
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 numcore-0.1.10.tar.gz.
File metadata
- Download URL: numcore-0.1.10.tar.gz
- Upload date:
- Size: 17.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c29507c58b64037b14563367053a3c4d667234118654ef55c12ed8d70f4ddd2
|
|
| MD5 |
6cf5eaae4e583ed1693963d526d9434f
|
|
| BLAKE2b-256 |
120b6ccd050da8ee188927cdb5eea6b4989425592cf932b90f8b63ccddb9f443
|
File details
Details for the file numcore-0.1.10-py3-none-any.whl.
File metadata
- Download URL: numcore-0.1.10-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c21dd57826dc60ff59a0eec4f2a271c1acdb9061180ce9642d8a988e03d1ea0
|
|
| MD5 |
ec07832ee452955944071383baba8ff1
|
|
| BLAKE2b-256 |
cbed592a407bd92c7a085ae17f78f062cd8cc9cd4619e7f8fca83d218cea87f8
|