Journey 02 — Core path
The workhorse solvlrde.solve(A, y0, T) call, reading n_solves in the receipt, and constant forcing with b=.
Prerequisites: Journey 01 works. Scenario: Solve y' = A y directly at a target time T
Key APIs
solvlrde.solve()result['y']result['n_solves']b= keyword
Concepts to internalize
- n_solves drives cost — not the target time T.
- Decoupled modes — diagonal A gives closed-form checks against exp(λT).
- b= forcing — same API for affine systems y' = Ay + b.
Important code
The guided tour script wraps this pattern. Copy the production shape into your pipeline:
import numpy as np
import solvlrde as lrde
A = np.diag([-0.5, -1.0, -2.0])
result = lrde.solve(A, [1.0, 1.0, 1.0], T=2.0)
# Constant source: y' = -y + 1
forced = lrde.solve(np.array([[-1.0]]), [0.0], T=3.0, b=[1.0])Act-by-act walkthrough
Act 1 — The workhorse call
solvlrde.solve(A, y0, T) is the one call you will use most. Give it a dense system matrix A, an initial state y0, and a target time T; it returns y(T) plus a receipt describing the contour it used.
Act 2 — A decoupled 3-mode system
A = diag(-0.5, -1, -2) makes three independent decay modes. Because the modes are decoupled, y_i(T) = exp(lambda_i * T) * y0_i - a closed form we can check against.
| Field | Value | Notes |
|---|---|---|
A_diag | [-0.5, -1.0, -2.0] | |
y0 | [1.0, 1.0, 1.0] | |
T | 2.0 |
Act 3 — Solve and read the receipt
The result dict carries y plus n_talbot_used and n_solves: how many contour nodes (each a complex linear solve) the auto-tuned contour needed. That count - not T - is what drives the cost.
| Field | Value | Notes |
|---|---|---|
survived | True | |
status | ok | |
y | [0.367879, 0.135335, 0.0183156] | |
n_talbot_used | 32 | |
n_solves | 32 | |
nu_used | 0.6 | |
contour_scale | 6.4 | |
wall_s | 0 | |
expected | [0.367879, 0.135335, 0.0183156] | |
max_abs_error | 4.347e-10 |
Act 4 — Constant forcing
Add a constant source with b=. For y' = -y + 1, y(0)=0 the exact answer is 1 - exp(-T). Same call, one extra keyword.
| Field | Value | Notes |
|---|---|---|
survived | True | |
status | ok | |
y | [0.950213] | |
n_talbot_used | 32 | |
n_solves | 32 | |
nu_used | 0.6 | |
contour_scale | 4.267 | |
wall_s | 0 | |
expected | [0.950213] | |
max_abs_error | 2.688e-10 |
Guided tour output
Verified console capture from 02_core_path.py:
Solve y' = A y directly at a target time T
-- Act 1 - The workhorse call --
-> solvlrde.solve(A, y0, T) is the one call you will use most. Give it a dense system matrix A, an initial state y0, and a target time T; it returns y(T) plus a receipt describing the contour it used.
-- Act 2 - A decoupled 3-mode system --
-> A = diag(-0.5, -1, -2) makes three independent decay modes. Because the modes are decoupled, y_i(T) = exp(lambda_i * T) * y0_i - a closed form we can check against.
A_diag: [-0.5, -1.0, -2.0]
y0: [1.0, 1.0, 1.0]
T: 2.0
-- Act 3 - Solve and read the receipt --
-> The result dict carries y plus n_talbot_used and n_solves: how many contour nodes (each a complex linear solve) the auto-tuned contour needed. That count - not T - is what drives the cost.
survived: True
status: ok
y: [0.367879, 0.135335, 0.0183156]
n_talbot_used: 32
n_solves: 32
nu_used: 0.6
contour_scale: 6.4
wall_s: 0
expected: [0.367879, 0.135335, 0.0183156]
max_abs_error: 4.347e-10
-- Act 4 - Constant forcing --
-> Add a constant source with b=. For y' = -y + 1, y(0)=0 the exact answer is 1 - exp(-T). Same call, one extra keyword.
survived: True
status: ok
y: [0.950213]
n_talbot_used: 32
n_solves: 32
nu_used: 0.6
contour_scale: 4.267
wall_s: 0
expected: [0.950213]
max_abs_error: 2.688e-10
-- Run complete --
next_journey: 03_configuration.pyRun it
cd python
# Guided tour — narrated scenario walkthrough (recommended first run):
python examples/journeys/02_core_path.py
# Production one-liner — same API call you ship:
python -c "import solvlrde,numpy as np; print(solvlrde.solve(np.diag([-0.5,-1.,-2.]),[1,1,1],T=2.0)['y'])"What comes next
Journey 03 tunes contour parameters via SolvlrdeConfig.
Navigation
← Journey 01 — First contact · Journey 03 — Configuration (contour + N) →