Skip to main content

Gauss-Legendre 6th-order implicit integrator and finite-difference helpers built on JAX.

Project description

Gauss6

Gauss6 bundles a sixth-order implicit Gauss–Legendre time integrator together with high-order finite-difference helpers, all implemented with JAX. The method is A-stable and therefore useful for stiff systems. It is also symplectic, and therefore useful for solving Hamiltonian systems such as the KdV equation.

The systems are solved based on methods described in Solving Ordinary Differential Equations II: Stiff and Differential-Algebraic Problems by Hairer and Wanner (Springer, 1996), section IV.8 Implementation of Implicit Runge-Kutta Methods: The Linear System. The implicit steps are solved using a Newton-GMRES solver with backtracking, as explained in Choosing the Forcing Terms in an Inexact Newton Method by Stanley C. Eisenstat and Homer F. Walker (SIAM, 1996). We further use jax to automatically compute the Jacobian-vector products needed in the GMRES solver.

Installation

The package targets Python 3.9+ and relies on JAX. Install the right jax/jaxlib wheel for your platform (CPU-only shown below) and then install Gauss6:

pip install --upgrade pip
pip install --upgrade "jax[cpu]"
pip install gauss6

Quick start

import jax.numpy as jnp
from gauss6 import Gauss6

def f(t, u, args):
    alpha = args["alpha"]
    return alpha * u

t = jnp.linspace(0.0, 2.0, 201)
params = {"alpha": -1.0}
u0 = jnp.array([1.0])  # initial condition

solver = Gauss6(t, args=params, size=u0.size)
solve = solver.make_solve(f)
trajectory = solve(u0)

The package also exposes high-order central-difference helpers:

from gauss6 import dx_order_6

spacing = 0.01
values = jnp.sin(jnp.linspace(0, jnp.pi, 512))
first_derivative = dx_order_6(values, spacing)

License

Gauss6 is released under the MIT license.

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

gauss6-0.1.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

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

gauss6-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file gauss6-0.1.0.tar.gz.

File metadata

  • Download URL: gauss6-0.1.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for gauss6-0.1.0.tar.gz
Algorithm Hash digest
SHA256 46539543032044fa6a3f52b5203a074a477a4775b065aeb328218053be67132d
MD5 9fb10cf99e23082a7e5e3bcfd87ec0a6
BLAKE2b-256 edd62ab2e2c6a3e26454f14308be430db86e827eb270ce9f3a4d24665ef68ce6

See more details on using hashes here.

File details

Details for the file gauss6-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gauss6-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for gauss6-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59365b1310c1a8f094ba2402c25e6d7e027788fe52f8eda2d4e6e6754eb99b69
MD5 ef25cc0c175b7f5ba0a8182839c4fcb6
BLAKE2b-256 4ee7c45d950a35e49e32cabb420937c52cb4893ad36ed27f912a88f956b1cad4

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