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.0.tar.gz (241.1 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.0-cp310-abi3-win_amd64.whl (4.5 MB view details)

Uploaded CPython 3.10+Windows x86-64

pydiffsol-0.6.0-cp310-abi3-manylinux_2_28_x86_64.whl (46.9 MB view details)

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

pydiffsol-0.6.0-cp310-abi3-macosx_14_0_arm64.whl (36.9 MB view details)

Uploaded CPython 3.10+macOS 14.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for pydiffsol-0.6.0.tar.gz
Algorithm Hash digest
SHA256 131e75a7f84684a05208b8e0b0995f2bb8961908596d0a7dd3bab91469f5d59e
MD5 84e8c6fd7a02b9a1c4bd5705db05d0f0
BLAKE2b-256 ba2ef4f2d601b9adf57abd77f31410204fc966eb293969afda4560eb8279d8be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydiffsol-0.6.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 772a7b5fe4583cd7dd0b6f5242294f3e599b51e24dca6a97176f5cc2611f26b1
MD5 78841b2eab189f5530a765bb813763ec
BLAKE2b-256 e2131d5be91d143ea6b22ee4ef0e99dc29bec39331892c549124a9c53c616f8a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydiffsol-0.6.0-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 57d0cceca92e066b196fa6edd54d4159b274020688e05611977153ced7f60bfd
MD5 123d0e28036fcfa7a736eb84667f8418
BLAKE2b-256 a4ed54632e673365c196b0bedfe5da9535b4a3ed9cbe46900c43842444476f5d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydiffsol-0.6.0-cp310-abi3-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 41fee4f0017cfc77912d0663e0e73fb26b230105dacaa1abb2212fbfda0d314f
MD5 4d027a35bedd02ad39978b336f7d69b8
BLAKE2b-256 c96a948b1c8c28f9470c1219428479a9d7afd9cdf1fe2de70e7d6c139c48ff1e

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