Skip to main content

pydiffsol

Pydiffsol provides python bindings for diffsol, a Rust library for solving ordinary differential equations (ODEs) or semi-explicit differential algebraic equations (DAEs).

Equations are specified with diffsl, a domain specific language (DSL) that uses automatic differentiation to calculate the necessary jacobians, and JIT compilation using LLVM or Cranelift to generate efficient native code at runtime.

This provides the performance of Rust with the flexibility of Python. Users create a Python Ode object with DiffSL code, specifying the diffsol solver, matrix, linear solver and scalar types. All standard solver configuration settings such as tolerances, min step size, max newton steps etc. can be set through the Ode instance.

Currently supported solver types are BDF, ESDIRK34, TRBDF2 and TSIT45.

Wheels are built for linux, windows and macos.

Example usage

import pydiffsol as ds
import numpy as np

ode = ds.Ode(
    """
    in { r = 1.0 }
    k { 1.0 }
    u { 0.1 }
    F { r * u * (1.0 - u / k) }
    """,
    matrix_type=ds.nalgebra_dense,
)

# Solve up to t = 0.4, overriding r input param = 2.0
params = np.array([2.0])
solution = ode.solve(params, 0.4)
print(solution.ys, solution.ts)

# Above defaults to bdf. Try esdirk34 instead
ode.ode_solver = ds.esdirk34
solution = ode.solve(params, 0.4)
print(solution.ys, solution.ts)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydiffsol-0.6.2.tar.gz (241.3 kB view details)

Uploaded Source

Built Distributions

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

pydiffsol-0.6.2-cp310-abi3-win_amd64.whl (4.4 MB view details)

Uploaded CPython 3.10+Windows x86-64

pydiffsol-0.6.2-cp310-abi3-manylinux_2_28_x86_64.whl (54.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ x86-64

pydiffsol-0.6.2-cp310-abi3-manylinux_2_28_aarch64.whl (51.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

pydiffsol-0.6.2-cp310-abi3-macosx_14_0_arm64.whl (44.1 MB view details)

Uploaded CPython 3.10+macOS 14.0+ ARM64

File details

Details for the file pydiffsol-0.6.2.tar.gz.

File metadata

  • Download URL: pydiffsol-0.6.2.tar.gz
  • Upload date:
  • Size: 241.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for pydiffsol-0.6.2.tar.gz
Algorithm Hash digest
SHA256 b7ce2d7f27db492d42daf5ffc7dbbf0164b34b2a1a2d990559d9e5e6fc216aaa
MD5 d97eb4150696eb4f3a79e77aad0b5b42
BLAKE2b-256 8abdef5ab2ade67e7957cebeee6f7c0121595f5641fba8e63c28b401751027aa

See more details on using hashes here.

File details

Details for the file pydiffsol-0.6.2-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for pydiffsol-0.6.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 301accb74eb9ada15d81990ce26733a3181f5290eb56b1b34beddd403ae6a88f
MD5 7fbffca2c6be9c38bd20e8fe502bd37d
BLAKE2b-256 01ad579dc47cf85fd92512da7d0b3af5f050f004a151a4af1c638c038ad4c379

See more details on using hashes here.

File details

Details for the file pydiffsol-0.6.2-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pydiffsol-0.6.2-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ac012e14864f6c932c4a75285e1826f8c9d8a61aed3edbeb44fa25827014cb63
MD5 4c5b849c6c4148778e83bf730993cd86
BLAKE2b-256 077120ca63b2f095e94a84f096dfbec93ad79b252fae789b787b9aef046c3cd4

See more details on using hashes here.

File details

Details for the file pydiffsol-0.6.2-cp310-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pydiffsol-0.6.2-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1f4ceafeae40ad487522494acfb333f9b3f7afc808e116126ea5b0f4e966ca30
MD5 b2a983d0c297e265723581da4fe1346d
BLAKE2b-256 d86ec9157a9cc418995627029c51a5af60d92ae394559103bdc6ab3c00715e32

See more details on using hashes here.

File details

Details for the file pydiffsol-0.6.2-cp310-abi3-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pydiffsol-0.6.2-cp310-abi3-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 b2ce26529b7597f1ef08c61c5eb9229243dc7433be79ea40dfdd2ad411747498
MD5 e1e85566808899d5bee86636685d0876
BLAKE2b-256 2e18f31685c8d42f7173b88bff0351913a8235ac84760d4f67344af6bc01d2e3

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.6.2 This release

5 files

0.6.1

5 files

0.6.0

4 files

0.5.3

7 files

0.5.2

7 files

0.5.1

7 files

0.5.0

7 files

0.4.0

7 files

0.3.1

7 files

0.3.0

7 files

0.2.0

7 files

0.1.3

4 files

0.1.2

4 files

0.1.1

4 files

0.0.1

18 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