RustedSciThe for Python
RustedSciThe brings a symbolic engine and a family of stiff ODE, boundary-value, nonlinear-system and fitting solvers to Python. The Python package is a thin, idiomatic interface over a compiled Rust numerical core: expressions are parsed and differentiated in Rust, solver workspaces and algorithms stay in Rust, and Python receives ordinary typed objects and detached NumPy results.
This project is for problems where a trustworthy derivative, a stiff or strongly nonlinear method, and visibility into numerical behavior matter more than hiding every solver choice behind one universal interface.
Why RustedSciThe
- Symbolic derivatives without a Python CAS dependency. Build expressions, simplify and substitute them, and derive exact Jacobians with RustedSciThe's own symbolic engine. Prepared residual and Jacobian callbacks are reused instead of being rebuilt during every numerical iteration.
- Native stiff IVP and BVP solvers. Use Rust implementations inspired by SciPy's Radau, variable-order BDF and collocation methods, alongside LSODE2, Backward Euler and the damped BVP solver. The numerical solve runs in Rust, not in a Python loop around a native linear algebra call.
- More than ODE integration. Solve square nonlinear systems, rectangular least-squares problems, observation-based fitting and separable models with VarPro. These are first-class numerical workflows, not just helper routines attached to an IVP API.
- Algorithms beyond the SciPy-like IVP/BVP set. Native nonlinear methods, a dedicated rectangular Levenberg-Marquardt solver, Gavin fitting and variable projection cover workflows that are not merely wrappers around SciPy's ODE interfaces.
- Choose the linear algebra layout when the solver supports it. Dense, Sparse and Banded routes are available across most solver families. Their performance depends on the equation structure and problem size; there is no universally fastest layout. BVP_sci additionally offers opt-in SuperLU.
- Lambdify and AOT execution. Use prepared in-process callbacks for a fast
development cycle, or generated compiled callbacks where supported. The
symbolic frontend (
expr_legacyoratom_native) is a separate choice from the execution route (lambdifyoraot). - Prepared models and parameter series. Reuse symbolic preparation across continuation and restart workflows where the solver exposes that lifecycle.
- Diagnostics designed for numerical work. Typed exceptions, route provenance, optional counters and stage timings help explain what happened without parsing console output or error messages.
Performance is workload-dependent. A Rust implementation is not automatically the fastest choice for every equation, frontend, layout or lifecycle. Compare the same workload and inspect preparation, callback and full-solve timings before choosing a route.
Architecture
Python model and NumPy inputs
|
PyO3 boundary
|
Rust symbolic preparation -> exact derivatives -> Lambdify or AOT callbacks
|
Rust solver -> Dense / Sparse / Banded linear algebra where supported
|
typed result, telemetry and owned NumPy arrays
Python is the user-facing layer, not a second implementation of the algorithms. NumPy arrays returned by result objects own their data; they do not borrow a mutable solver workspace. The package does not require SymPy.
Quick Start
This small stiff IVP uses Radau with its default symbolic and numerical configuration:
from rustedscithe import Expr, RadauSolver
y = Expr.variable("y")
solver = RadauSolver([-y], ["y"], "t", 0.0, 1.0, 0.1)
solution = solver.solve([1.0])
print(f"y(1) = {solution.final_state[0]:.8f}")
Install the published package with python -m pip install rustedscithe. For a
checkout-based editable build, install maturin and run:
python -m maturin develop --manifest-path bindings/python/Cargo.toml
The extension uses the stable abi3 Python 3.10+ ABI and NumPy 2.x. Import the
public API from rustedscithe; _native is an implementation module.
Solver Families
| Problem | Python entry points | Useful distinction |
|---|---|---|
| Stiff initial-value problems | RadauSolver, BdfSolver, BackwardEulerSolver, Lsode2Solver |
Radau and LSODE2 expose structured layouts where supported; standalone BDF and Backward Euler are Dense. LSODE2 separates its solver family from its Adams/BDF/Auto controller. |
| Boundary-value problems | BvpSciSolver, BvpDampSolver |
BVP_sci uses symbolic boundary residuals and collocation; BVP_Damp uses observed state/boundary data and damped Newton. Their boundary contracts intentionally differ. |
| Nonlinear systems | NonlinearSolver |
Prepared square systems with Newton, LM and trust-region method families. |
| Least squares and fitting | FittingSolver, GavinFittingSolver, VarProSolver |
Rectangular symbolic least squares, observation-based fitting and separable-model fitting have distinct contracts. |
| Text task documents | TaskDocument, task, run_task_batch |
Parse and execute reusable IVP/BVP documents through the native task infrastructure. |
Use capabilities("solver_name") to inspect the Python-supported routes.
Native features that are not exposed by this package are not implied by a
shared option name; unsupported combinations raise a typed error instead of
silently selecting a different backend.
Configuration Choices
Several independent axes shape a solve, and a given solver supports only a documented subset of their combinations:
| Axis | Examples | What it selects |
|---|---|---|
| Symbolic frontend | expr_legacy, atom_native |
Representation used for symbolic preparation and differentiation. |
| Callback execution | lambdify, aot |
In-process prepared closures or generated compiled artifacts. |
| Matrix layout | dense, sparse, banded |
Storage and linear-system route. |
| Callback policy | sequential, parallel, auto |
Scheduling where the native solver supports it. |
| Lifecycle | fresh solve, prepare, continuation, restart |
Whether prepared model or previous state is reused. |
Check the relevant guide and capabilities() before combining options. A
structured layout is useful only when the problem has exploitable structure;
parallel callback evaluation and AOT compilation also have workload-dependent
break-even points. For continuation, distinguish cold preparation from warm
solve time.
Guides and Examples
The overview guides explain shared Python conventions. Solver-specific guides preserve each native solver's option breadth, supported routes, limitations and recommended workflows.
| Family | English | Русский |
|---|---|---|
| Python API overview | Python solvers | Обзор Python API |
| Radau | Guide | Руководство |
| BDF | Guide | Руководство |
| Backward Euler | Guide | Руководство |
| LSODE2 | Guide | Руководство |
| BVP_sci | Guide | Руководство |
| BVP_Damp | Guide | Руководство |
| Nonlinear systems and fitting | Guide | Руководство |
Runnable, commented Python examples include Robertson kinetics, Lorenz and three-body systems, frontend/layout comparisons, continuation, AOT and task documents. See the Python example index; the repository's Rust examples are collected separately in the root examples directory.
Text Tasks and Executable
Python users can parse and run text task documents with TaskDocument or
task(...), and batch independent documents with run_task_batch(...). The
batch API preserves typed per-task failures and can write a compact table. The
Windows console executable is part of the main Rust project, not this Python
package; see the task parser documentation.
Diagnostics and Development
Native exceptions preserve their Python class and expose machine-readable
stage, solver and route attributes. Telemetry is opt-in and solutions
provide detached counters, timings and report writers where supported. Prefer
these fields over parsing exception text or redirecting build output into a
performance report.
For development and contribution checks, see the Python contract tests, the strict typing consumer, and the Python binding roadmap. The core crate's broader algorithm documentation and release evidence remain in the main README and solver guides.
Metadata
Release files for rustedscithe 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rustedscithe-0.1.2.tar.gz | 6.2 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rustedscithe-0.1.2-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
Total release size: 20.7 MB
Release files / rustedscithe-0.1.2.tar.gz
| Download URL | rustedscithe-0.1.2.tar.gz |
|---|---|
| Size | 6.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3db8d959ffa1b786ffc7e93cf548ca142bcf66786daa4123121c28de3e657fcf
|
|
BLAKE2b-256 checksum How to use checksums |
632c57915ddca28bc31c6c2caef388d205b591388c971edd4d04bae56108ee18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / rustedscithe-0.1.2-cp310-abi3-win_amd64.whl
| Download URL | rustedscithe-0.1.2-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 14.5 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
5cdf42657c253ab347be4726d43f3b4c4ad539b6b4f521bd6ff5ce7b7d1859d7
|
|
BLAKE2b-256 checksum How to use checksums |
3f7ed577ac392c3cccdc8a03d53bbceacd4f63d5d06c5c691977fe95d9c9ba59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|