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
Metadata
Release files for ncpy 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ncpy-0.2.4.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ncpy-0.2.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.7 kB
Release files / ncpy-0.2.4.tar.gz
| Download URL | ncpy-0.2.4.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bdc357066e09b10b354f7bf20fa800cd0c9dea81624571f659d29f85d33a8f31
|
|
BLAKE2b-256 checksum How to use checksums |
790956485fece7d82565bafb5d8fac8ef5205752e0bec1675ac61b94ddf8d1ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.5
|
Release files / ncpy-0.2.4-py3-none-any.whl
| Download URL | ncpy-0.2.4-py3-none-any.whl |
|---|---|
| Size | 2.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b66d515f8760b12299a358eb3622acf58486091bb8362ddd1d297386c53dc53f
|
|
BLAKE2b-256 checksum How to use checksums |
b0202149c3e68d47ba2579a670388d8ede00cff3c0eeeab07b24ceed78821551
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.5
|