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.5.3.tar.gz (237.2 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.5.3-cp314-cp314t-win_amd64.whl (4.2 MB view details)

Uploaded CPython 3.14tWindows x86-64

pydiffsol-0.5.3-cp314-cp314t-manylinux_2_28_x86_64.whl (47.2 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ x86-64

pydiffsol-0.5.3-cp314-cp314t-macosx_14_0_arm64.whl (36.7 MB view details)

Uploaded CPython 3.14tmacOS 14.0+ ARM64

pydiffsol-0.5.3-cp39-abi3-win_amd64.whl (4.2 MB view details)

Uploaded CPython 3.9+Windows x86-64

pydiffsol-0.5.3-cp39-abi3-manylinux_2_28_x86_64.whl (47.2 MB view details)

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

pydiffsol-0.5.3-cp39-abi3-macosx_14_0_arm64.whl (36.7 MB view details)

Uploaded CPython 3.9+macOS 14.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for pydiffsol-0.5.3.tar.gz
Algorithm Hash digest
SHA256 1a655f759949e81c3f32f2f73b6203cd1068825104a0fc2b9d8d93c7fc7e0c3c
MD5 de8b9be5adf37cc72341eb48a3ec172f
BLAKE2b-256 4e71cfc72b5bbef67e57da70e1d4211f372f9435094a203b2aeca00257e4b8f1

See more details on using hashes here.

File details

Details for the file pydiffsol-0.5.3-cp314-cp314t-win_amd64.whl.

File metadata

File hashes

Hashes for pydiffsol-0.5.3-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 cd3351093b397fe7013bfea4d230bc3e46d80b443dda112d675185cae87ee5b1
MD5 3cb69fb2bfcc56383d7d4667acd08be9
BLAKE2b-256 22ac9884c475e31a62dc02fc6fcb07e166ce154bf430f91d33b4f9a7d97e8da1

See more details on using hashes here.

File details

Details for the file pydiffsol-0.5.3-cp314-cp314t-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pydiffsol-0.5.3-cp314-cp314t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7163686f366e1159bda7d2dacf056fe8a7867564345166944464a537f7386308
MD5 01406bdfbfead8068ac4d02a74cb31ea
BLAKE2b-256 b773df5189e0087b372e2562b3d568b0a6af2ffe3c2fae65457f517045add645

See more details on using hashes here.

File details

Details for the file pydiffsol-0.5.3-cp314-cp314t-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pydiffsol-0.5.3-cp314-cp314t-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 eb774609b4b889cc137f4d93fa0c95063ffaf7536b1d92180ce89d94c77c372d
MD5 28960572f86dbfa382f788bd9cd40fc4
BLAKE2b-256 717db7de8c18f74e4fb8858b33d936d7a65494ecba5cf20bd4f34562b0418c7c

See more details on using hashes here.

File details

Details for the file pydiffsol-0.5.3-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: pydiffsol-0.5.3-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 4.2 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.13.3

File hashes

Hashes for pydiffsol-0.5.3-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ad97cad91b40eb8bfcd78ee6999b42a7a0f3d851688c0da2f1805488a46f6307
MD5 355972d6c3f05d5af2aa707ddeb2d2e5
BLAKE2b-256 22614caf05a9dfa5ea55e37e0169b2a6d24b7110befb1b2a160d0c81b6edbbcb

See more details on using hashes here.

File details

Details for the file pydiffsol-0.5.3-cp39-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pydiffsol-0.5.3-cp39-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c375b6929572319f2fedd344cf47533afa2e4a56ce8544d683750537fc73ea2d
MD5 131941098259be2dd4bc8a1212c46f75
BLAKE2b-256 554c5c3c135cea29938cd68f5123d6c431c4b0196f7033fb2bf1fc41f0df831d

See more details on using hashes here.

File details

Details for the file pydiffsol-0.5.3-cp39-abi3-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pydiffsol-0.5.3-cp39-abi3-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 e0a3a1d993e3ac6316e2089e7de693d7c49b2cc4658f04f76a1d4a7b65779a9c
MD5 1f6b8e5810ec10257ce968dcc2471417
BLAKE2b-256 09234b6280950cfa49f243b9c42596a039cc4b763a7272d2688ec11c4dc865fc

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