Skip to main content

numgrids

Working with numerical grids made easy.

Setting up numerical grids, differentiation matrices, and coordinate transformations by hand is tedious and error-prone. numgrids gives you a high-level, NumPy-friendly API that handles all of this — so you can focus on the physics or mathematics of your problem instead of bookkeeping grid indices and scale factors.

Main Features

  • Numerical grids in any dimension from equidistant, Chebyshev, logarithmic, and periodic axes
  • High-precision spectral methods (FFT + Chebyshev) selected automatically where possible
  • Differentiation, integration (Clenshaw–Curtis, trapezoidal), and interpolation (spline or spectral)
  • Curvilinear coordinates: spherical, cylindrical, polar, elliptic cylindrical, prolate and oblate spheroidal — or your own via scale factors
  • Vector calculus: gradient, divergence, curl, and Laplacian; volume and surface integrals
  • Operator algebra with built-in solve() for boundary value problems and eig() for eigenvalue problems
  • Boundary conditions: Dirichlet, Neumann, and Robin, specified per face in one line
  • Time evolution (method of lines) for heat, wave, and Schrödinger-type equations
  • Adaptive mesh refinement, convergence studies, multigrid hierarchies
  • Plotting, save / load to .npz, and xarray / NetCDF interoperability
  • Fully compatible with NumPy and SciPy

Installation

pip install --upgrade numgrids

Optional extras: numgrids[plot] (matplotlib), numgrids[xarray] (xarray), or numgrids[all].

Quick Start

from numgrids import *
import numpy as np

# A 2D grid: Chebyshev points in x, periodic in y
grid = Grid(x=chebyshev(30, 0, 1), y=periodic(40))
f = grid.evaluate(lambda x, y: x**2 * np.sin(y))

df_dx = grid.diff(f, axis="x")      # spectral derivative
total = grid.integrate(f**2)        # integral over the domain

# Solve the Poisson equation with u = 0 on the boundary
grid = Grid(x=chebyshev(30, 0, 1), y=chebyshev(30, 0, 1))
u = grid.laplacian_operator().solve(1.0, bcs=0)

# Quantum harmonic oscillator: lowest energies 0.5, 1.5, 2.5, ...
grid = Grid(x=chebyshev(80, -10, 10))
H = -0.5 * grid.diff_operator(2) + 0.5 * grid.coords**2
energies, states = H.eig(k=4, bcs=0)

Full documentation including API reference and example notebooks is available at maroba.github.io/numgrids.

Metadata

Release files for numgrids 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for numgrids 0.5.0
File Size Uploaded Provenance Actions
numgrids-0.5.0.tar.gz 86.8 kB With provenance Details for numgrids-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for numgrids 0.5.0
File Interpreter ABI Platform Actions
numgrids-0.5.0-py3-none-any.whl Python 3 none any Details for numgrids-0.5.0-py3-none-any.whl

Total release size: 149.9 kB

Release files / numgrids-0.5.0.tar.gz

Download URL numgrids-0.5.0.tar.gz
Size 86.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6a4c279b5e0d7547988643830a3109604514ec7b2fc5b7a90a00ffe74edca598
BLAKE2b-256 checksum
How to use checksums
777bb122756b0586ac79afcc5883f971ea192207de7e36991aeeccec0984b392
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / numgrids-0.5.0-py3-none-any.whl

Download URL numgrids-0.5.0-py3-none-any.whl
Size 63.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d8f622a6a076af84fe093acfbbb7aa184d1ef550d8f346fc7241b29fb3f2212
BLAKE2b-256 checksum
How to use checksums
6ee21fad8084ee936b23d3da9175eef2b5340ee38a29294a4f7d01c974e0ef23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for numgrids 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for numgrids-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page