A Python package for numerical computing, including root-finding, interpolation, integration, differentiation, and linear system solvers.
Project description
ncpy
ncpy Numerical Computing in Python.
ncpy is a compact, educational Python library that implements common numerical methods for quick prototyping and expermentations.
Built on NumPy and (optionally) SciPy, it offers easy-to-use functions for:
- Root finding
- Interpolation
- Curve fitting / Approximation
- Numerical integration
- Numerical differentiation
- Solving linear systems
- Best Approximations
Why use ncpy?
✅ One package, many methods : no need to import multiple libraries
✅ Lightweight & beginner-friendly : great for teaching & learning numerical methods
✅ Educational : functions are implemented clearly for understanding algorithms
✅ Fast enough : powered by NumPy for efficiency
✨ Features Overview
| Category | Methods |
|---|---|
| Root-finding | Bisection, Newton–Raphson, Secant, Fixed-point iteration |
| Interpolation | Lagrange, Newton divided differences, Linear, Cubic spline, Neville’s method |
| Approximation | Polynomial least squares, Exponential fit, Logarithmic fit |
| Integration | Trapezoidal, Simpson 1/3, Simpson 3/8, Romberg, Gaussian quadrature |
| Differentiation | Forward, Backward, Central differences, Richardson extrapolation, Numerical gradient |
| Linear Systems | Gaussian elimination, Gauss–Jordan, LU decomposition, Jacobi, Gauss–Seidel, Conjugate Gradient |
| Best Approximations | Least Squares, Gram–Schmidt Orthonormalization |
Examples
- Root finding - Newton Raphson
from ncpy import newton_raphson
f = lambda x: x**2 - 2
df = lambda x: 2*x
root = newton_raphson(f, df, x0=1.0)
print("Root:", root) # ~1.4142
- Interpolation — Lagrange
from ncpy import lagrange_interpolation
x_points = [0, 1, 2]
y_points = [1, 3, 2]
print(lagrange_interpolation(x_points, y_points, 1.5))
- Numerical Integration — Simpson's 1/3 Rule
from ncpy import simpson13
import math
area = simpson13(math.sin, 0, math.pi, n=100)
print(area) # ~2.0
📦 Installation
pip install ncpy
📍 Visitors
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 ncpy-0.2.4.tar.gz.
File metadata
- Download URL: ncpy-0.2.4.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdc357066e09b10b354f7bf20fa800cd0c9dea81624571f659d29f85d33a8f31
|
|
| MD5 |
c9b6f3c716fe7e93c267a050d5f4828f
|
|
| BLAKE2b-256 |
790956485fece7d82565bafb5d8fac8ef5205752e0bec1675ac61b94ddf8d1ce
|
File details
Details for the file ncpy-0.2.4-py3-none-any.whl.
File metadata
- Download URL: ncpy-0.2.4-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b66d515f8760b12299a358eb3622acf58486091bb8362ddd1d297386c53dc53f
|
|
| MD5 |
175407463eefa35eb73dc7ef80ac36b6
|
|
| BLAKE2b-256 |
b0202149c3e68d47ba2579a670388d8ede00cff3c0eeeab07b24ceed78821551
|