Skip to main content

PyPI Package latest release PyPI Wheel Supported versions Supported implementations

Numba Integrators

Numba Integrators is collection numerical integrators based on the ones in SciPy. Aim is to make them faster and much more compatible with Numba.

Table of Contents

Quick start guide

Here's how you can start

The first steps

Installing

Install Numba Integrators with pip

pip install numba_integrators

Importing

Import name is the same as install name, numba_integrators.

import numba_integrators

Since the package is accessed often, abbreviation ni is used. The abbreviation is used throughout this document.

import numba_integrators as ni

Example

import numba as nb
import numba_integrators as ni
import numpy as np

@nb.njit(nb.float64[:](nb.float64, nb.float64[:]))
def f(t, y):
    '''Differential equation for sine wave'''
    return np.array((y[1], -y[0]))

y0 = np.array((0., 1.))

solver = ni.RK45(f, 0.0, y0,
                 t_bound = 1, atol = 1e-8, rtol = 1e-8)

t = []
y = []

while ni.step(solver):
    t.append(solver.t)
    y.append(solver.y)

print(t)
print(y)

Example of the advanced function

import numba as nb
import numba_integrators as ni
import numpy as np

@nb.njit
def f(t, y, parameters):
    '''Differential equation for sine wave'''
    auxiliary = parameters[0] * y[1]
    dy = np.array((auxiliary, -y[0])) + parameters[1]
    return dy, auxiliary

t0 = 0.
y0 = np.array((0., 1.))
parameters = (2., np.array((-1., 1.)))

# Numba type signatures
parameters_signature = nb.types.Tuple((nb.float64, nb.float64[:]))
auxiliary_signature = nb.float64
solver_type = ni.RK45

Solver = ni.Advanced(parameters_signature, auxiliary_signature, solver_type)
solver = Solver(f, t0, y0, parameters,
                t_bound = 1, atol = 1e-8, rtol = 1e-8)

t = []
y = []
auxiliary = []

while ni.step(solver):
    t.append(solver.t)
    y.append(solver.y)
    auxiliary.append(solver.auxiliary)

print(t)
print(y)
print(auxiliary)

Changelog

0.3.1 2024-07-17

  • Fast forward
  • Refactoring

0.2.2 2023-11-07

  • Dev tools update

0.2.1 2023-08-11

  • Advanced mode solver to handle functions with parameters and auxiliary output

0.1.2 2023-08-06

  • Fixes

0.1.1 2023-08-05

  • Initial working version

0.0.3 2023-05-14

  • Inital working state

Metadata

Release files for numba-integrators 0.3.1

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

Source distribution (sdist)

Source distribution for numba-integrators 0.3.1
File Size Uploaded
numba_integrators-0.3.1.tar.gz 13.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for numba-integrators 0.3.1
File Interpreter ABI Platform
numba_integrators-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.9 kB

Release files / numba_integrators-0.3.1.tar.gz

Download URL numba_integrators-0.3.1.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9989757d456ea2ffad52fb724d23bd14a80a736d4fcf79e39b40ad810074e408
BLAKE2b-256 checksum
How to use checksums
30de955b734961c4a37a984e8dad085f98d9b9511cc05e30835c755c8bcff72b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release files / numba_integrators-0.3.1-py3-none-any.whl

Download URL numba_integrators-0.3.1-py3-none-any.whl
Size 17.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a445aa2e41884b78ef79a09de4fb02187b7e92cdd5b408cc6ce2151993a4f78
BLAKE2b-256 checksum
How to use checksums
d59a865fbeeaa530cc7c57ce1dc1abd8f47b12286c6e1676e190c3c63a46855c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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