Skip to main content

No project description provided

Project description

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)

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

pydiffsol-0.6.1.tar.gz (241.0 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.1-cp310-abi3-win_amd64.whl (4.5 MB view details)

Uploaded CPython 3.10+Windows x86-64

pydiffsol-0.6.1-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.1-cp310-abi3-manylinux_2_28_aarch64.whl (51.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

pydiffsol-0.6.1-cp310-abi3-macosx_14_0_arm64.whl (44.0 MB view details)

Uploaded CPython 3.10+macOS 14.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for pydiffsol-0.6.1.tar.gz
Algorithm Hash digest
SHA256 f665d3be7864b76b2b51b14d38ff24d53270a4a5448b34f1aebfc7f52e962c34
MD5 18a7d32023aa38f8b81072a6fad46b8c
BLAKE2b-256 3828810dacc6082e7a0c5819ba6763ae42a5e8137019aca89a3eb9fb364daaee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydiffsol-0.6.1-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 20eb8ba8ee45dee27a8d2277da0e307d1dd07c9374543577194863b6bc4cf35f
MD5 878d652e144358755d243922ddb88dfa
BLAKE2b-256 efc253c44583e97ab14b1ec417a22977d7f983558825fd8d7cdeab8129ee2e87

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydiffsol-0.6.1-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9b7568cdda902c904dada2d3f0a7e5e08979472e425f8b55641a39d3cc37e31a
MD5 3446d680a9ad8b433d718f24a27c6d39
BLAKE2b-256 7e38ac3480f5802830a3bb8c4b49aa0d3df5a8f3176e8544e08bd394f2a984ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydiffsol-0.6.1-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 52cad8a9db84f5a226bad5312e42c15804191c793d2f448c7211eb4be5e20d48
MD5 7a7057b57fcfd190dee8db85fef85d86
BLAKE2b-256 f2f8056bf2f4b8823e7d145a3ff298ab982a0a395bd9fe7f259bbb22e10302fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydiffsol-0.6.1-cp310-abi3-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 fa49c985d5d7f41f433b835ad0b4c3b40904882c633ddba3dd3dbc526ed3f786
MD5 9be953eb3f28ffc7ce58f78337924f46
BLAKE2b-256 d2cfb5c7154c4f8cb314abb02181ca1a2648de6a0862a3ecee3fcb29cf9f4d5a

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