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 (volume and surface), cylindrical, polar, elliptic cylindrical, prolate and oblate spheroidal — or your own via scale factors
  • Full disks, cylinders, spheres and balls: axes through the origin and the poles handle these points without coordinate singularities
  • 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.6.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.6.0
File Size Uploaded Provenance Actions
numgrids-0.6.0.tar.gz 99.3 kB With provenance Details for numgrids-0.6.0.tar.gz

Built distribution (wheel)

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

Total release size: 169.8 kB

Release files / numgrids-0.6.0.tar.gz

Download URL numgrids-0.6.0.tar.gz
Size 99.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bf8b7de93e705e701e2b8ea710f8467f94eb6477f8c58733e92d5957709fc125
BLAKE2b-256 checksum
How to use checksums
a6bd43807f259f7681011073e08838890d3ea3a202e1a9afbe17efa2f45561d5
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.6.0-py3-none-any.whl

Download URL numgrids-0.6.0-py3-none-any.whl
Size 70.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
11bef65325b9e69d9418d08c3917d870a774db6cb1ad133d36fd7e2d8374c004
BLAKE2b-256 checksum
How to use checksums
3173e995e16da62badfb4e5f5e211e2f8bad24d38135111171b19397497c2e89
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.6.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.6.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