Skip to content

voles

Collocation-method solvers for Volterra integral and integro-differential equations (VIEs/VIDEs), based on:

Brunner H. Collocation Methods for Volterra Integral and Related Functional Differential Equations. Cambridge University Press; 2004.

Solvers

Equation Solver
\(g(t) = \int_0^t K(t-s)y(s)ds\) solve_vie1
\(y(t) = g(t) + \int_0^t K(t-s)y(s)ds\) solve_vie2
\(y'(t) = a(t)y(t) + g(t) + \int_0^t K(t-s)y(s)ds\) solve_vide

Each takes its inputs either as arrays of samples on a uniform grid (dt=), the fastest path for sampled data, or as callables on a mesh you choose (mesh=), which also handles weakly singular kernels. Both return a VolterraSolution. The rules are on the Conventions page.

For a kernel \(K(u) \sim u^{-\alpha}\), optimal_graded_mesh(alpha=..., t_end=..., n_intervals=..., order=...) builds a Brunner-graded mesh, and declaring the exponent with kernel_singularity={0.0: alpha} switches the singular blocks to deterministic Gauss–Jacobi quadrature, typically 3–10× faster than declaring only the location. Collocation nodes for callable inputs can be given via coll_nodes, with gauss_legendre_nodes, radau_iia_nodes and lobatto_nodes for the classical families.

Upgrading from 0.10? See Migration from 0.10.

Installation

pip install voles[full]

This gives you the fully-capable package, so everything just works out of the box. Pre-built wheels are provided for Linux x86_64, macOS arm64 (Apple Silicon), and Windows x64. The D extension is bundled in the wheel and requires no extra tooling. Intel Macs are no longer supported as of 0.3.2; users can pin to volterra-equation-solvers==0.3.1 or build from source (see CONTRIBUTING.md).

Requirements: Python ≥ 3.10, numpy, scipy

If you have trouble installing a dependency, you can use a slimmer install instead. numba and scipy are only needed for some features (see below), so any of these will still give you a working package:

pip install voles          # core: numpy + scipy (no numba)
pip install voles --no-deps && pip install numpy   # leanest: numpy only, no scipy or numba

What the optional pieces buy you: - scipy (core dependency) — required for callable inputs and for VolterraSolution.to_ppoly(). - numba (added by [full]) — only needed for sampled inputs with quadrature="collocation" and a collocation setting not compiled into the D extension; the default product quadrature needs neither.

To build from source (e.g. on an unsupported platform), see CONTRIBUTING.md.

Mathematical derivations

The docs/ directory contains worked derivations of the analytic solutions used in the test suite:

File Contents
scalar_solutions.pdf Derivations for all six scalar test cases (VIE-1, VIE-2, VIDE)
coupled_vector_solutions.pdf Derivations for the coupled 2×2 vector test cases, constructed via a similarity transform

LaTeX source files are provided alongside the PDFs.

Quick example

import numpy as np
import voles

# y(t) = sin(t) satisfies this VIE-2
dt = 0.05
t = np.arange(0, 9.05, dt)
g = np.sin(t) - 0.5 * (np.exp(-t) + np.sin(t) - np.cos(t))

sol = voles.solve_vie2(kernel=np.exp(-t), g=g, dt=dt)
print(sol.y[:3], sol(0.123))