Skip to main content

A Python package for numerical computing, including root-finding, interpolation, integration, differentiation, and linear system solvers.

Project description

ncpy

PyPI Version License Downloads Python Versions GitHub Stars Last Commit Open Issues

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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ncpy-0.2.2.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

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

ncpy-0.2.2-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file ncpy-0.2.2.tar.gz.

File metadata

  • Download URL: ncpy-0.2.2.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.6

File hashes

Hashes for ncpy-0.2.2.tar.gz
Algorithm Hash digest
SHA256 904a26324c2fb7fcbbd83e676fd8029b72b5586b5595cb6ed7c7b358e95a1d70
MD5 0dae84009bdb12cda11192c87415a9f4
BLAKE2b-256 341565eb9edd5fd102f3ca340d57eae8285b2444eaaa5aea8740d4c18cd94d56

See more details on using hashes here.

File details

Details for the file ncpy-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: ncpy-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.6

File hashes

Hashes for ncpy-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e84d9fcbecc09286f97a0362a0c4279c3987fbc96884d9c160a65862c84945e5
MD5 557c4f0e22fc7e8b86f45fd64cee25f4
BLAKE2b-256 e65807d35cfb80088a3579d14a1192f5f5c83cfe5350f89f6f1e41865a8a0fea

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