M72. A review of the architecture, and Newton’s method written once¶
Package: P4, the first step of what the review of the architecture asks for: Newton’s method, the control of the step in time, and the constants and messages that belong to them, each written once. Nothing that a user sees has changed.
The review¶
The owner asked whether the project has grown more complex than it must through special cases. It has, in one place, and the place can be named.
What holds. The pipeline from a problem over a plan to a solution.
The numerical kernels, which are shared: the expressions, GMRES, the
block iteration for eigenvalues, the propagator, the exponential
stepping, and collocation::Modes, one type for boxes, round domains,
cylinders and shapes. The frontend, which is thin: one translator from
sympy, and a plan that is a view on JSON.
What does not. Above the kernels the core is a table of the family
of the domain against the kind of the problem, and nearly every cell of
it has a path of its own, with its own applies, classify, plan
and solve. When the review was made:
Eleven functions
classifyreturn ten structures that share no part, though most hold an unknown, coordinates, a source, data fields and whether the problem is complex. The core has no trait but the two for numbers.Which path takes a problem is decided by a chain of questions whose order matters, written in
planner.rsand once more insolve.rs. Inbounded_modesan error serves as a branch, andshaped_modesrewrites the text of an error that another path wrote.plan::Methodhas a variant for each pair of a discretization and a solver:FourierNewton,CollocationNewton,ElementNewton.The places that refuse a problem grow with the code, from 116 at milestone 24 to 242 at milestone 71. Of thirty that were read, about half name no limit of the mathematics but two things that each work and were not joined.
The same algorithm stood in several places:
What |
Times |
Where |
|---|---|---|
The loop of Newton’s method |
4 |
|
The control of the step of the exponential scheme |
2 |
|
Exact propagation and stepping in modes, with the recording |
2 |
|
A system in time as one state of all unknowns |
2 |
|
Reading what an equation holds of time |
3 |
|
A block iteration for eigenvalues |
2 |
|
Copies drift apart, and the drift had become packages of the backlog. A system between walls refuses arrays, and its copy for shapes takes them (A23). The rewriting of an equation of second order in time into two of first order exists for periodic systems alone, so nonlinear waves between walls are refused (A14). A weight beside an eigenvalue is refused on Fourier grids and taken on shapes and between walls (F1).
Smaller findings. Modes::differentiate panics for every domain
but a box, and its callers ask first. Fourier grids do not go through
Modes: they have three types of their own. Diagnostics is one
structure whose entries mean different things for different methods.
The plots interpolate in Python, with Gauss points and transforms of
their own, where the core has values_at.
Decisions¶
D72.1. The paths are joined before the next packages, in four steps¶
Owner, 2026-11-25.
The review proposed to part two things that the paths hold together. A space says how a domain is discretized: how a function is sampled, transformed and differentiated, how the reference operator is solved, and how what is given on the boundary enters. Waves, modes and elements are the three that exist. An algorithm is written once against a space: Newton’s method, the iteration for coefficients that vary, propagation, stepping, the iteration for eigenvalues, the choice of a grid.
The owner took the proposal, and put its steps before A14 and A23, which would otherwise be built as one more copy, and before A5, which would add a family of domains and with it a column of the table. Each step changes no behaviour, and the tests that exist say so.
Newton’s method and the control of the step, written once. This milestone.
One driver in time over the modes (P5).
Fourier waves as a space beside the modes (P6).
One reading of an equation, and the way to its path as a table (P7).
A fifth, the method of a plan as a discretization and a solver, would change the plan as users see it. It waits for the owner (P8).
The methods that rest on a Green’s function, harmonics, cylinder
and the boundary elements, stay as they are: what is special about them
is the mathematics. And the interface of a space is drawn out of the
three that exist, step by step, not designed ahead of them.
D72.2. Newton’s method is a loop, and an equation says the rest¶
Developer, 2026-11-25.
methods::newton::solve is the loop: where the iterate stands, a full
step, the largest fraction of it that is accepted, and the end. The
trait Equation is what a discretization says of itself: the residual
at an iterate, the solve of the linearized equation, the iterate after
a part of a step if it is accepted, and what counts as arrived when no
part is.
The four loops differed in more than their solves, and those differences are kept, each in its equation:
On a Fourier grid the unknown of the method is the effective source, the residual of the start is known, a part of a step must reduce the residual by a fraction of what the linearization promises, sizes are root mean squares, and the shortest part is a thousandth of a step.
Between walls and on shapes the unknown is the solution, the residual of the start would take the operator and is not known, so the first step is taken in full, a part must reduce the largest residual, and the shortest part is a 1024th.
Between walls a method that is stuck within ten times its tolerance has arrived (decision D69.2).
So the same numbers come out as before, to the last bit. To make the four agree in these rules would be a change of behaviour, and is no part of this step.
D72.3. The control of the step is a function, and a scheme says the rest¶
Developer, 2026-11-25.
exponential::controlled takes a state from one time to the next by
whole steps and pairs of half steps, with the estimate of the error
from their difference. The trait Scheme gives it the step, the
difference, the sum and the size. One equation steps a list of
coefficients, a coupled system a list for each component with a matrix
for each wave. The two form the difference in different ways,
\((h - w)/15\) and \(h/15 - w/15\), which agree to rounding and not to the
bit. Each keeps its own, so that no result changes.
What was built¶
methods/newton.rs: the loop, the trait, the settings with their check, the errors for a method that is stuck, that has used its steps, and whose terms are not finite, and the words of a plan for where the method starts and for the solution it finds. It is tested by itself, on \(x^3 = 8\) with steps that overshoot.Four equations:
OnWavesinpreconditioned,BetweenWallsinbounded_varying, andOnElementsinshapedand inshaped_coupled.exponential::controlledwith the traitScheme, used byexponential::advanceand bycoupled_stepping::evolve, andSettings::sound, the one check of the settings of the stepping.Constants that stood several times stand once: the steps of Newton’s method in an automatic plan, the smallest fraction of a step, and the name under which a nonlinear term reads its unknown.
What was measured¶
Nothing may change, so that is what was measured. Twelve problems were
solved by the package of main and by that of this milestone, on one
thread, and the bytes of their solutions, their diagnostics and the
notes of their plans were hashed: Newton’s method on a Fourier grid for
a real and for a complex unknown, between walls for a medium and for
the mixed derivative that stalls within reach of its tolerance, on a
region from zero and from a starting value, and for a system on a
region. The stepping on a periodic grid and between walls, of a system
with a constraint, of reaction and diffusion, and of a breather of
second order in time. All twelve hashes agree, with between 2 and 7
steps of Newton’s method and between 39 and 158 steps in time.
What was left¶
The planners in time keep constants of their own that mean the same (
MAX_STEPS,INSTANTS), and four places write the same message for a solution that ceases to be finite. They go with the driver in time (P5).An equation on a shape and a system on a shape are two equations of Newton’s method. One equation is a system of one unknown, which P7 makes of it.
The notes of a plan on Newton’s method share their words on the start and on the solution that is found. The sentence on how a step is solved is each path’s own, and stays so.
The two block iterations for eigenvalues are P9.
The plots that interpolate in Python are K10.