Manuscript Offprint
arXiv:2610.02960Dirac-Interconnected Neural Elements: Discovering Modularity in Physical Systems Without Reduction
ABSTRACT
Deep learning has shown remarkable success in the data-driven modeling of dynamical systems. Much of its success is attributed not to the flexibility of neural networks but to inductive biases based on physical prior knowledge, such as energy conservation and symplicity. However, existing methods do not fully exploit the fact that real-world physical systems are interconnections of components. Some methods require the interconnection to be known a priori, while others assume the system to be reducible to an ordinary differential equation (ODE) and learn only the reduced ODE, discarding the algebraic constraints imposed by the interconnection. Here, we propose Dirac-interconnected neural elements (DINEs), a neural network model that represents a physical system as a differential-algebraic equation (DAE), whose algebraic constraints are given by a Dirac structure in kernel representation. With DINEs, we simultaneously identify from data the interconnection among the components as a Dirac structure and learn the characteristics of the components as neural networks. This allows us to keep the learned subsystems in unreduced form and isolate or compose them to make a new system without retraining. Moreover, DINEs can handle partially observable systems. Experimental results demonstrate these capabilities on physical systems beyond the reach of existing methods.
1 INTRODUCTION
Deep learning has been successful in a wide range of domains (Bishop & Bishop, 2024; Noor & Ige, 2025), including the data-driven modeling of dynamical systems (Wang et al., 2023; Legaard et al., 2023). Many approaches approximate the dynamics directly from observed trajectories, as in neural ordinary differential equations (Neural ODEs) (Chen et al., 2018). Since such black-box models often exhibit physically inconsistent behavior in long-term predictions, physical prior knowledge has been embedded into models as an inductive bias. In particular, Hamiltonian, constrained Hamiltonian, and port-Hamiltonian neural networks are inspired by energy-based modeling, where an energy function is defined on the state space, and a single vector field is derived from it, ensuring the energetic behavior of the system by construction (Greydanus et al., 2019; Finzi et al., 2020; Matsubara et al., 2020; Desai et al., 2021; Moradi et al., 2026).
However, real-world physical systems are interconnections of components, such as masses, springs, and dampers in mechanical systems, and inductors, capacitors, and resistors in electrical circuits. Their power exchange has often been described by a graphical notation, bond graphs (Paynter, 1961; Karnopp et al., 2012; Tabatabaian, 2021). The model becomes interpretable and its components become reusable if it identifies from observed data this internal structure, namely the characteristics of the components (i.e., their constitutive relations) and the interconnection among them. Beyond prediction, such models also support the identification of physical parameters, diagnosis, and design. Because the interconnection among the components gives rise to algebraic constraints, interconnected systems are in general described by differential-algebraic equations (DAEs) (Duindam et al., 2009; van der Schaft & Jeltsema, 2014). Neural port-Hamiltonian DAEs (N-pHDAEs) (Neary et al.,
*Correspondence to li.reiho.c0@elms.hokudai.ac.jp, matsubara@ist.hokudai.ac.jp
Table 1: Comparison with related methods.
| Model | Ensuring Energetic Behavior | Identifying Interconnection | Learning Constraints | Learning from Partial Observation |
|---|---|---|---|---|
| Neural ODEs (Chen et al., 2018) | - | - | - | - |
| HNNs, LNNs, SymODENs, pHNNs | ✓ | - | - | - |
| OE-pHNNs (Moradi et al., 2026) | ✓ | - | - | ✓ |
| CHNNs, CLNNs (Finzi et al., 2020) | ✓ | - | given | - |
| Compositional pHNNs (Neary & Topcu, 2023) | ✓ | given | - | - |
| N-pHDAEs (Neary et al., 2025) | ✓ | given | given | - |
| pH-DAE identification (Hagelaars et al., 2026) | ✓ | given | given | ✓ |
| Latent ODEs, CT-SUBNET | - | - | if reducible | ✓ |
| PoDiNNs (Khosrovian et al., 2025) | ✓ | ✓ | if reducible | - |
| DINEs (ours) | ✓ | ✓ | ✓ | ✓ |
Greydanus et al. (2019); Cranmer et al. (2020); Zhong et al. (2020b;a); Desai et al. (2021). Rubanova et al. (2019); Beintema et al. (2023). Available only for holonomic constraints.
- and port-Hamiltonian DAE (pH-DAE) identification (Hagelaars et al., 2026) approximate interconnected systems with the interconnection known and fixed in advance. Poisson-Dirac neural networks (PoDiNNs) (Khosrovian et al., 2025) identify the interconnection from observed data, but only in a reduced form. They assume that the system is reducible to an ODE and that all component states are observable, thereby discarding the algebraic constraints and excluding partially observable systems. Table 1 summarizes the comparison: no existing model both learns the interconnection and keeps its algebraic constraints.
Given the above, we propose Dirac-interconnected neural elements (DINEs), a neural network model that represents a physical system as a DAE whose algebraic constraints are given by a Dirac structure in kernel representation (see Figure 1) (Duindam et al., 2009; van der Schaft & Jeltsema, 2014). Our contributions are as follows: (i) By minimizing the DAE residual, DINEs simultaneously learn the interconnection as a Dirac structure and the constitutive relations of the components as neural networks. (ii) Since the system is not reduced to an ODE, DINEs can isolate or compose the learned subsystems without retraining. (iii) DINEs also handle partially observable systems, in which some component states are unobserved. (iv) Experimental results demonstrate these capabilities on physical systems beyond the reach of existing methods.

Figure 1: Conceptual diagram of DINEs.
2.1 PORT-BASED MODELING AND DIRAC STRUCTURES
Port-based modeling. Port-based modeling represents a physical system as an interconnection of elements, each of which idealizes a basic physical behavior (Duindam et al., 2009; van der Schaft & Jeltsema, 2014). Each element has ports, through which it exchanges energy with the others. The exchange is described by a pair of port variables, a flow (e.g., velocity or current) and an effort (e.g., force or voltage), whose duality product gives the power flowing out of the element through the port; their physical nature depends on the domain. A C-type storage element (C; e.g., a spring or a capacitor) has a state and stores energy with and , and an I-type storage element (I; e.g., a mass or an inductor) has a state and stores energy with and ; in both cases holds, and these equations are called the energy-storage relations. A resistive element (R; e.g., a damper or a resistor) is defined by a resistive relation that satisfies and thus dissipates energy. A source (Sf or Se) prescribes a flow or an effort as a function of time. The interconnection is a multiport element that merely routes energy, that is, it is power continuous with zero net power at all times: in bond-graph theory, it is called the junction structure and is composed of 0-junctions and 1-junctions, which generalize Kirchhoff's current and voltage laws, transformers (TF), and gyrators (GY) (Karnopp et al., 2012). See Appendix A for details.
Dirac structure. The interconnection of port-based modeling is formalized as a Dirac structure (van der Schaft & Maschke, 1995; Dalsmo & van der Schaft, 1998), a geometric object introduced by Courant (1990) and Dorfman (1993). Let be an -dimensional linear space, whose element is the vector of the flows at the ports. Let be its dual space, whose element is the vector of the efforts at the ports. For , the total power is the duality product , which is equal to when and are represented as column vectors.
Definition 1 (Dirac structure; Courant, 1990; Duindam et al., 2009; van der Schaft & Jeltsema, 2014). A Dirac structure on is a subspace such that (i) for all , and (ii) .
Every Dirac structure can be represented in the kernel representation (Dalsmo & van der Schaft, 1998; van der Schaft & Jeltsema, 2014, Sec. 5.1). With linear coordinates for and the dual basis for , it is given by
where F and E are matrices satisfying
Conversely, any pair of matrices satisfying these two conditions defines a Dirac structure by Eq. (1).
Dynamics on a Dirac structure. Each of the 0-junction, the 1-junction, the transformer, and the gyrator defines a Dirac structure, and the composition of Dirac structures is again a Dirac structure. Hence, the junction structure is a Dirac structure (Duindam et al., 2009; van der Schaft & Jeltsema, 2014), which we denote by D. Each row of is a linear constraint that the interconnection imposes on the port variables. The entries of F and E represent the interconnection, including the ratios of the transformers and gyrators.
The dynamics is defined by the condition that the port variables belong to D at all times (Duindam et al., 2009; van der Schaft & Jeltsema, 2014):
Here, and are the port variables of the storage elements, the resistive elements, and the sources, called the storage, resistive, and source ports, respectively. The numbers of these ports are , , and , respectively, with . We partition F and E in Eq. (1) in the same way as f and e, that is, and . The port variables are oriented out of the elements and thus into the Dirac structure, so that condition (i) of Definition 1 states that the net power flowing into the interconnection is zero.
Let be the state of the -th storage element, which is for C-type and for I-type, and let ; only the storage elements have states, so is the state of the entire system. The Hamiltonian is the total stored energy, that is, the sum of the energies of all the storage elements, , where is the energy of the -th storage element. The resistive ports satisfy a resistive relation between and such that , that is, the resistive elements only absorb power. For each source port, the prescribed variable (the flow of an Sf element or the effort of an Se element) is an external input, and its conjugate variable is determined by the system as an output; we denote the vectors of the inputs and the outputs by and , respectively.
The constitutive relations are thus given by the Hamiltonian H and the resistive relation R. Substituting the constitutive relations into Eq. (3) yields, in general, a differential-algebraic equation (DAE) for the state z and the remaining port variables with the input u.
Reduction to an ODE. Under certain conditions, the DAE can be reduced to an ODE in z. Exchanging the flow and the effort of every I-type port, every Sf port, and some resistive ports preserves the conditions of Eq. (2) (van der Schaft & Jeltsema, 2014, Sec. 5.3); we denote the resulting variables with . Then, the flows of all the storage ports are the time derivatives of the states up to sign, . If is invertible, Eq. (1) is equivalent to with the skew-symmetric matrix , which is called the input-output representation of the Dirac structure. This form is an ODE in z once the remaining port variables can be eliminated through the constitutive relations, and is what PoDiNNs employ (Khosrovian et al., 2025).
Under further assumptions, eliminating the resistive port variables yields the input-state-output form of port-Hamiltonian systems (Maschke & van der Schaft, 1992; van der Schaft & Maschke, 1995; van der Schaft & Jeltsema, 2014),
where , , is the coefficient of the linear resistive relations, and a skew-symmetric matrix , the resistive connection , and the gain are blocks of up to sign. This form is what many existing methods employ (as discussed below).
We refer to these transformations and eliminations of variables as reduction, which has two costs. (1) It mixes the interconnection with the elements, since R combines the resistive relations with the blocks that connect them and cannot be uniquely decomposed into the two. (2) It assumes that an ODE exists, but it does not in general. For example, Eq. (4) cannot describe nonlinear frictions, and both forms are not applicable to the balanced force of several nonlinear springs, and a capacitor connected with a voltage source in parallel (see also Appendix B).
2.2 RELATED WORK
Learning the dynamics as a single ODE. Neural ODEs (Chen et al., 2018) approximate a general ODE of the form with a neural network, where no mechanism prevents the learned model from creating or destroying energy in long-term predictions. Hamiltonian neural networks (HNNs) (Greydanus et al., 2019) and their extensions, Symplectic ODE-Nets (SymODENs) (Zhong et al., 2020b), neural symplectic forms (Chen et al., 2021), Dissipative SymODENs (Zhong et al., 2020a), port-Hamiltonian neural networks (pHNNs) (Desai et al., 2021), pseudo-Hamiltonian neural networks (Eidnes et al., 2023), and output-error pHNNs (OE-pHNNs) (Moradi et al., 2026), are special cases of Eq. (4) that learn with J, R, and G fixed or learned. Lagrangian neural networks (LNNs) and deep Lagrangian networks (Lutter et al., 2019; Cranmer et al., 2020), constrained HNNs and LNNs (CHNNs and CLNNs) (Finzi et al., 2020), which add holonomic constraints given in advance, are considered also as the special cases with designed J. See Appendix B for the correspondence. In the methods, is a single function of the whole state z, or at most separated into the kinetic and potential energies but not into the energies of the individual elements. The resistive elements appear only in R, so that neither the elements nor their interconnection can be identified from the learned model. The constraints imposed by the interconnection are either eliminated manually before training by the choice of z or given in advance.
Learning the components under a given interconnection. Several methods learn the subsystems or elements separately, while the interconnection is specified before training, or at most fitted as a composition between ODE subsystems. Compositional pHNNs (Neary & Topcu, 2023) learn each subsystem in the form of Eq. (4) for a given and compose them through an additional skew-symmetric matrix , which is given or learned from data of the composite system as a matrix or a neural network; the composite system is again an ODE of the same form with . N-pHDAEs (Neary et al., 2025) employ the DAE of an electrical network in the descriptor form (Beattie et al., 2018; Mehrmann & Unger, 2023) with the circuit topology known and all of its variables observable, that is, F and E of Eq. (3) are given by Kirchhoff's laws and only the constitutive relations are learned; separately trained N-pHDAEs can be composed without additional training if the additional interconnection is given as a matrix. Hagelaars et al. (2026) identify a linear pH-DAE of the same family from input-output data with unobserved states.
Identifying the interconnection from data. The closest to our work is PoDiNNs (Khosrovian et al., 2025), which employ the Dirac structure in the input-output representation . Given the list of elements, they learn as a constant matrix, the resistive relations as explicit maps , and under the assumption that all states are observed. However, after reduction, the interconnection represented by depends on the elements' states or parameters in general. Khosrovian et al. (2025) themselves acknowledge in their Appendix B.2 that, to represent the equal velocities of two rigidly coupled masses, depends on the masses and is no longer determined by the interconnection alone. Also, PoDiNNs are inapplicable to some situations, such as the balanced force of several nonlinear springs (see Task 1 in Section 4).
Learning with unobserved states. When only an observation y of the system is available, the state has to be inferred along with the model. The continuous-time subspace encoder network (CT-
SUBNET) (Beintema et al., 2021; 2023) learns a black-box state-space model, and with a predetermined state dimension , where an encoder estimates the state at the start of each window of the time series from the past outputs and inputs and the prediction error over the window is minimized; Latent ODEs (Rubanova et al., 2019) are similar with a probabilistic encoder and decoder. OE-pHNNs and the pH-DAE identification replace the black-box model by Eq. (4) and by the linear DAE, respectively, but limit the observation to the output conjugate to the input, so that other quantities, such as the currents of the resistors inside a circuit, are not available as observations. In all of these methods, the unobserved state is inferred by the encoder only at the start of each window and is obtained after integrating the model forward in time.
3 DIRAC-INTERCONNECTED NEURAL ELEMENTS
Learnable elements and interconnection. Here, we propose DINEs as a learnable model of Eq. (3), which is defined by constitutive relations and a Dirac structure. For each storage element, we learn a differentiable function of its state by a neural network, and thus the total energy is . For each resistive element, we learn the resistive relation by a neural network as an explicit map from the flow to the effort. Dissipativity is not imposed for simplicity, while it is possible with a sign constraint on . We suppose sources are prescribed as functions of time.
For the Dirac structure, the matrices should satisfy the two conditions of Eq. (2) for every value of the parameters. To avoid constrained optimization, we suppose that the interconnection is separable and constant, and that the number of flow constraints (and thus the number of effort constraints) is given in advance. A Dirac structure is separable if the rows of Eq. (1) can be chosen so that each involves only flows or only efforts; it holds if the system has no gyrators, since junctions and transformers are separable and so is their composition. The interconnection is constant if the ratios of its transformers do not depend on the state (van der Schaft & Jeltsema, 2014, Sec. 2).
Theorem 1 (Exact parameterization of separable Dirac structures). Let and be nonnegative integers with , and let be any fixed orthogonal matrix. For , define with , let and consist of the first and last rows of , respectively, and set and . Denote the resulting kernel by . Then, (i) For every , satisfies the conditions of Eq. (2), and is a separable Dirac structure with exactly independent flow constraints. (ii) For every separable Dirac structure on with exactly independent flow constraints, there exists such that for the same fixed .
Proposition 1 (Energy balance). For every , , input , and solution of the DAE of DINEs,
This means that the total energy is changed outside the storage elements. If, in addition, a sign constraint is imposed on resistive relations, holds, which means that the total energy is dissipated.
See Appendix C for the proofs. This parameterization requires as a hyperparameter, the number of independent constraints among the flows. For a connected electrical network with one element per branch, it is the number of nodes minus one, since the row space of is spanned by Kirchhoff's current law at the nodes (van der Schaft & Jeltsema, 2014, Secs. 2.2.2 and 12.1). A constant does not require the constraints to be linear in the state: the force balance of several nonlinear springs at a massless junction is linear in the efforts and is inside this setting.
Learning and prediction. Given a set of the trajectories of inputs and observations at sample times for , we train DINEs to fit them. The observations are a given subset of the port variables and states; unlike Eq. (4), they need not be the variables conjugate to the inputs. We prepare a neural network called trajectory network with parameters that takes the time and the index of the trajectories and returns, as continuous-time functions of , the state of every storage element, the flow of every resistive element, and the conjugate variable of every source port, whether observed or not. The remaining port variables follow from the constitutive relations. For storage elements, and are computed by the automatic differentiation, and the effort of a resistive element follows from . The observations are reconstructed from these states and port variables. We suppose that the number of elements of each type (C, I, R, Sf, Se) is given, which fixes the numbers of ports of each type and hence .
We train this neural network by minimizing the sum of the data-assimilation loss at the sample times and the DAE residual of Eq. (3) at collocation points :
for a weight . Each term is averaged over a minibatch of trajectories, times , and collocation points , which are randomly sampled at every update, and the parameters of and , the matrix , and the parameters of are optimized jointly by gradient descent. takes the role of a numerical integrator during training, solving the learned DAE by minimizing its residual, and is discarded after training. This approach is similar to physics-informed neural networks (PINNs) (Raissi et al., 2019), except that the equation itself is learned. For prediction, initial values are estimated from the observations available at the start of the prediction so that they are consistent with the algebraic rows of the learned DAE, and the learned DAE in Eq. (3) is integrated by the three-stage Radau IIA method of order five (Hairer & Wanner, 1996) with Newton's method (Nocedal & Wright, 2006). See Appendix D for the details of implementation.
Isolation and composition. The learned DINEs contain the constitutive relations of the elements and the Dirac structure separately, so subsystems can be isolated or composed by operations on their ports, without eliminating variables, deriving reduced equations, or retraining, up to scale calibrations. A subpart of the system can be isolated by removing the constitutive relations of the elements outside it, while keeping their ports in as boundary ports, i.e., ports that are not connected to any element. When considering boundary ports to be connected to non-prescribed sources (Sf or Se), the isolated system is again DINEs. In particular, when the subpart is a single element, its own port becomes the boundary port, and the element is isolated with its learned constitutive relation alone and can be reused in another system. Two isolated systems , can be composed by adding a boundary port to each of their Dirac structures and connecting these ports to each other. This process stacks their matrices and block-diagonally and adds two rows that impose and on the connected port variables, with signs depending on the orientation of the ports. These rows correspond to in Fig. 1. The composed DAE has constraints in the ports, which can be integrated directly. Alternatively, the connected ports are eliminated algorithmically before integration, after which the composed DAE has again a separable and constant Dirac structure on the remaining ports and hence a DINE (van der Schaft & Jeltsema, 2014, Sec. 6).
Discussions for comparisons and limitations. Thanks to the kernel representation and the trajectory network , DINEs do not require reduction and admit partial observation. In contrast, PoDiNNs require the input-output representation to exist, possibly after reduction, and every state to be observed. OE-pHNNs and the pH-DAE identification suppose the observation to be the output conjugate to the input. Our parameterization of requires , which has to be swept in practice because the interconnection is unknown. Nevertheless, a wrong model is not identified silently, because a misspecification of leads to a catastrophic failure; this is expected from the implication of Theorem 1 that a misspecified excludes the true Dirac structure from the model family.
Gyrators, which typically bridge physical domains as in DC motors and hydraulic motors, are outside our setting. Constraints whose coefficients depend on the state, which lead to modulated Dirac structures as for a multi-link robot in Cartesian coordinates, and a kinetic energy that depends on the momenta and the positions together, which violates the form as for the same robot in generalized coordinates, are also outside our setting.
When reading the learned interconnection, it is beneficial to transform and to reduced row echelon forms, so that each row states one constraint among a minimal set of ports. Depending on the interconnection and on which elements are observed, the scales of port variables, constitutive relations, and states are not unique. This gauge freedom is removed in most cases by normalizing the entries of the rows corresponding to junctions (but not to transformers) to 0 or ; otherwise, a few additional measurements fix the remaining scales, before or after isolation and composition.

(Task 1) Three-way junction
(Task 2) RC ladder
(Task 3) Rigid coupling
Hydraulic subsystem
Mechanical subsystem
(Task 4) Hydraulic-mechanical
(Task 5) Spring reuse
Figure 2: Diagrams of the systems of Tasks 1–5.
4 EXPERIMENTS AND RESULTS
4.1 EXPERIMENTAL SETTINGS
Tasks. We evaluate DINEs on the five tasks shown in Figure 2. Appendix E gives their detailed settings, equations, parameters, and data generation. In Task 1, a three-way junction, we examine whether the constraints are learned. The force balance at the junction leads to an algebraic constraint, which PoDiNNs cannot learn. In Task 2, an RC ladder, we examine whether the system can be learned from observed currents when the states (that is, capacitor charges) are unobserved. Its node voltages are determined by nonlinear algebraic relations that arise from the constitutive relations of the resistors and Kirchhoff's laws. In Tasks 3 and 4, we examine the composition of learned subsystems, and in Task 5 the isolation. Each subsystem has one boundary port, which is connected to a source during learning, and then composed to another. In Task 3, a rigid coupling, the sources are external forces, applied to two masses. In Task 4, a hydraulic-mechanical coupling, the boundary inputs are the flow leaving the reservoir and the velocity imposed at the free end of the first spring. Because of the multi-domain nature of the system, this composition is represented by a transformer, whose constant ratio (that is, the piston area) is unknown and identified from a few measurements of the composed system. In Task 5, a spring reuse, we examine whether the spring learned in a subsystem (i.e., a nonlinear spring) of Task 3 can be isolated and reused in a new mechanical system without retraining.
Baselines and prior knowledge. None of the existing methods introduced in Section 2.2 is applicable to Tasks 1–5 as it is, except Neural ODEs to Task 1. On Task 1, the other methods reduce to Neural ODEs, require the constraints to be given in advance, or derive the state-dependent coefficient matrices. We nevertheless evaluate PoDiNNs on Task 1 to confirm this limitation. For Task 2, we extend the observation map of CT-SUBNET from to because the observed currents depend directly on the source voltages . CT-SUBNET is given its state dimension , which is swept. Recall that OE-pHNNs and the pH-DAE identification assume the observation to be conjugate to the input, and N-pHDAEs require the circuit topology to be known and all of its variables observable. For Tasks 3 and 4, we construct Coupled Neural ODEs as a baseline without physical structure, where a Neural ODE learns each subsystem and a separate network learns the variable conjugate to the boundary input, and then these networks are composed. For Task 4, the piston area is identified from a few observations of the composed system. For DINEs, we assume that the I-type elements, the capacitors of Task 2, and the reservoir of Task 4 are linear with their coefficients learned. For comparison, we also evaluate DINEs (soft), which replace the parameterization of Theorem 1 by penalty terms of the conditions of Eq. (2) in the loss (see Appendix D.4 for details). We summarize the prior knowledge and assumptions available for each model in Appendix F.
Training and prediction. DINEs are trained as stated above, whereas Neural ODEs, PoDiNNs, and the subsystem models of Coupled Neural ODEs are trained by one-step prediction with the classical fourth-order Runge–Kutta method, and CT-SUBNET by the multi-step prediction error over windows whose initial state is given by its encoder. The learned DAEs are integrated by the Radau IIA
Table 2: Experimental results.
| Model | (Task 1) Three-way junction | |
|---|---|---|
| MSE | VPT | |
| Neural ODEs | ||
| PoDiNNs* | ||
| DINEs (soft) | (not converged in 3 of 5 seeds) | |
| DINEs (ours) | ||
| DINEs () | (not converged in all seeds) | |
| DINEs () | ||
| DINEs () | ||
| DINEs () | ||
| Model | (Task 2) RC ladder | |
|---|---|---|
| MSE | VPT | |
| CT-SUBNET () | ||
| CT-SUBNET () | ||
| CT-SUBNET () | ||
| CT-SUBNET () | ||
| CT-SUBNET () | ||
| DINEs (soft) | (not converged in all seeds) | |
| DINEs (ours) | ||
| Model | (Task 3) Rigid coupling | (Task 4) Hydraulic–mechanical | (Task 5) Spring reuse | |||
|---|---|---|---|---|---|---|
| MSE | VPT | MSE | VPT | MSE | VPT | |
| Coupled Neural ODEs | ||||||
| DINEs (ours) | ||||||
Means ± standard deviations over five trials. The scale of the MSE and the threshold of the VPT are given in the last row of each block. * For reference only, since PoDiNNs are theoretically inapplicable to Task 1. 3 of 5 seeds did not converge. is misspecified.
method and the ODE models by an adaptive Runge–Kutta method. On Tasks 3 and 4, the learned subsystems are composed without retraining: the scale of the boundary variable of each subsystem of DINEs is calibrated once from the learned interconnection or from boundary measurements in its training data (see Appendix D.3), the piston area of Task 4 is identified from a few states of the composed system, and the composed system is integrated as a DAE whose boundary variables are unknowns.
For prediction, DINEs estimate the initial state to be consistent with the observation at the first sample (or the history of the inputs and observations on Task 2) under the learned algebraic constraints. Neural ODEs and PoDiNNs use the observed initial state. CT-SUBNET estimates the initial state from the history using its encoder. Coupled Neural ODEs do the same as DINEs.
Evaluation metrics. Each model predicts the trajectory of steps of every test trajectory, and the squared error between the predicted and true observations, averaged over the observed channels, , is computed at every sample . The MSE is its average over . The valid prediction time (VPT) (Vlachas et al., 2020) is the duration until the step at which the error first exceeds a threshold , normalized by the length of the test trajectory. Both metrics are averaged over the ten test trajectories for each seed, and we report the mean and the standard deviation over the five seeds. See Appendix E.1 for the detailed definitions.
4.2 RESULTS
Results and visualizations. Table 2 summarizes the numerical performances, and Figure 3 visualizes example predictions. DINEs achieved the lowest MSEs and the highest VPTs in all Tasks 1–4, and also showed high prediction accuracy on Task 5.
Neural ODEs can represent the system in Task 1 as a reduced ODE in principle, but their prediction errors grew quickly. This is because the training trajectories lie on the manifold defined by the constraints of the interconnection, and a prediction becomes out of distribution once it leaves the manifold. DINEs learn the interconnection and thus suppress such errors. PoDiNNs cannot learn this kind of constraint and also perform poorly. A variant with a state-dependent matrix is not evaluated here as not examined in the original paper. On Task 2, we compared CT-SUBNET with the latent state dimension ranging from the true number 4 to a redundant 20. The MSE improved from to and deteriorated slightly beyond , whereas the VPT kept improving up to with decreasing gains. None of these settings reaches the level of DINEs.
On Tasks 3 and 4, the predictions of Coupled Neural ODEs look reasonable in Figure 3, but DINEs achieved MSEs nearly two orders of magnitude smaller and much longer VPTs. Coupled Neural

(Task 1) three-way junction.
(Task 2) RC ladder ( ).
(Task 2) RC ladder ( ).

(Task 3) rigid coupling.
(Task 4) hydraulic–mechanical coupling.
(Task 5) reuse.
Figure 3: Visualizations of example predictions. Error denotes the absolute error.
ODEs can be composed only when they learn the relation between the boundary port variables given as inputs and their conjugate variables as outputs. In contrast, DINEs have an advantage that the Dirac structure provides such relation up to the gauge freedom.
Task 5 has no baseline because DINEs are the only method applicable to it. DINEs achieved the MSE and VPT comparable to (or better than) those on the other tasks. Although this is partly because every component other than the spring reused from Task 3 is known in this setting, the result shows that the isolation and the composition were performed with high accuracy.
Necessity of hard constraints. For DINEs (soft), which impose only soft constraints, the Newton method for initialization or prediction did not converge in most seeds on Tasks 1 and 2. This is presumably because a solution of the DAE may not exist when the constraints are only soft. This result shows the necessity of the parameterization derived in Theorem 1.
Impact of the number of constraints. DINEs require the number of flow constraints, which is unknown in general. To investigate the impact of its misspecification, we examine on Task 1. With , the Newton method for prediction did not converge. Note that this problem does not arise in training, where the trajectory network is used. With , the Newton method converged, but the MSEs and VPTs were catastrophic. Since the number of effort constraints is , determines not the total number of constraints but their allocation between flows and efforts. Because the MSE and VPT differ so clearly, can be tuned easily by holding out a small validation set from the training data, and a wrong model is not identified silently.
Learned interconnection. We confirmed that the matrices F and E learned the interconnection correctly in Tasks 1–4. Note that, since the Dirac structure depends only on the row spaces of F and E, the learned rows are not unique, and a readout procedure is needed for interpretation. See Appendix F for examples of the readout of the learned interconnection.
5 CONCLUSION
We proposed DINEs, which learn a physical system as a DAE whose algebraic constraints are given by a separable Dirac structure parameterized exactly by an orthogonal matrix, without reducing the system to an ODE. Our experiments showed that DINEs learn constraints and unobserved states that existing methods cannot, and that learned subsystems and elements are composed and reused across physical domains without retraining. The automatic determination of and the extension to non-separable Dirac structures are left for future work.
AI USE STATEMENT
We used large language models to translate, edit, and proofread the manuscript text and to check LaTeX formatting and bibliographic details. We also used these models to survey related work. All AI-assisted text was reviewed and revised by the authors, and all derivations were checked manually by the authors. We take responsibility for the final content of this work, including text, claims, and artifacts produced with the aid of generative AI.
ETHICS STATEMENT
This work concerns the data-driven modeling of physical systems and uses only simulated data generated from known equations of motion. It involves no human subjects, personal data, or data releases with privacy implications, and we do not foresee direct harmful applications.
REPRODUCIBILITY STATEMENT
The construction of the interconnection matrices F and E and the training loss, Eq. (6), are specified in Section 3, and the derivation of the reduced form used for comparison is given in Appendix B. Appendix D provides the implementation of DINEs and its ablated variants, and Appendix E shows the equations of motion, parameters, observed variables, sampling settings, and optimizer settings of Tasks 1–5, together with the architectures and training of the baselines. Source code and the data-generation scripts will be made public after refactoring.
REFERENCES
Christopher Beattie, Volker Mehrmann, Hongguo Xu, and Hans Zwart. Linear port-Hamiltonian descriptor systems. Mathematics of Control, Signals, and Systems, 30(4):17, 2018. doi: 10.1007/s00498-018-0223-3.
Gerben I. Beintema, Roland Tóth, and Maarten Schoukens. Nonlinear state-space identification using deep encoder networks. In Proceedings of the 3rd Conference on Learning for Dynamics and Control (L4DC), volume 144 of Proceedings of Machine Learning Research, pp. 241–250. PMLR, 2021.
Gerben I. Beintema, Maarten Schoukens, and Roland Tóth. Continuous-time identification of dynamic state-space models by deep subspace encoding. In Proceedings of the 11th International Conference on Learning Representations (ICLR), 2023.
Christopher M. Bishop and Hugh Bishop. Deep Learning: Foundations and Concepts. Springer, 2024.
Ricky T. Q. Chen, Yulia Rubanova, Jesse Bettencourt, and David K. Duvenaud. Neural ordinary differential equations. In Advances in Neural Information Processing Systems (NeurIPS), volume 31, pp. 6572–6583, 2018.
Yuhan Chen, Takashi Matsubara, and Takaharu Yaguchi. Neural symplectic form: Learning Hamiltonian equations on general coordinate systems. In Advances in Neural Information Processing Systems (NeurIPS), volume 34, pp. 16659–16670, 2021.
Theodore James Courant. Dirac manifolds. Transactions of the American Mathematical Society, 319(2):631–661, 1990.
Miles Cranmer, Samuel Greydanus, Stephan Hoyer, Peter Battaglia, David Spergel, and Shirley Ho. Lagrangian neural networks. In ICLR 2020 Workshop on Integration of Deep Neural Models and Differential Equations (DeepDiffEq), 2020. arXiv:2003.04630.
Morten Dalsmo and Arjan J. van der Schaft. On representations and integrability of mathematical structures in energy-conserving physical systems. SIAM Journal on Control and Optimization, 37(1):54–91, 1998.
Shaan A. Desai, Marios Mattheakis, David Sondak, Pavlos Protopapas, and Stephen J. Roberts. Port-Hamiltonian neural networks for learning explicit time-dependent dynamical systems. Physical Review E, 104(3):034312, 2021.
Irene Dorfman. Dirac Structures and Integrability of Nonlinear Evolution Equations. John Wiley & Sons, 1993.
John R. Dormand and Peter J. Prince. A family of embedded Runge–Kutta formulae. Journal of Computational and Applied Mathematics, 6(1):19–26, 1980.
Vincent Duindam, Alessandro Macchelli, Stefano Stramigioli, and Herman Bruyninckx (eds.). Modeling and Control of Complex Physical Systems: The Port-Hamiltonian Approach. Springer, 2009.
Sølve Eidnes, Alexander J. Stasik, Camilla Sterud, Eivind Bøhn, and Signe Riemer-Sørensen. Pseudo-Hamiltonian neural networks with state-dependent external forces. Physica D: Nonlinear Phenomena, 446:133673, 2023.
Marc Finzi, Ke Alexander Wang, and Andrew Gordon Wilson. Simplifying Hamiltonian and Lagrangian neural networks via explicit constraints. In Advances in Neural Information Processing Systems (NeurIPS), volume 33, pp. 13880–13889, 2020.
Samuel Greydanus, Misko Dzamba, and Jason Yosinski. Hamiltonian neural networks. In Advances in Neural Information Processing Systems (NeurIPS), volume 32, pp. 15353–15363, 2019.
N. Hagelaars, G. J. E. van Otterdijk, S. Moradi, R. Tóth, N. O. Jaensson, and M. Schoukens. Identification of port-Hamiltonian differential-algebraic equations from input-output data, 2026. arXiv:2601.16827.
Ernst Hairer and Gerhard Wanner. Solving Ordinary Differential Equations II: Stiff and Differential-Algebraic Problems. Springer, Berlin, 2 edition, 1996.
Ernst Hairer, Syvert P. Nørsett, and Gerhard Wanner. Solving Ordinary Differential Equations I: Nonstiff Problems. Springer, Berlin, 2 edition, 1993.
Dean C. Karnopp, Donald L. Margolis, and Ronald C. Rosenberg. System Dynamics: Modeling, Simulation, and Control of Mechatronic Systems. John Wiley & Sons, 5th edition, 2012.
Razmik Arman Khosrovian, Takaharu Yaguchi, Hiroaki Yoshimura, and Takashi Matsubara. Poisson-Dirac neural networks for modeling coupled dynamical systems across domains. In Proceedings of the 13th International Conference on Learning Representations (ICLR), 2025.
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Proceedings of the 3rd International Conference on Learning Representations (ICLR), 2015.
Christian Møldrup Legaard, Thomas Schranz, Gerald Schweiger, Ján Drgoña, Basak Falay, Cláudio Gomes, Alexandros Iosifidis, Mahdi Abkar, and Peter Gorm Larsen. Constructing neural network based models for simulating dynamical systems. ACM Computing Surveys, 55(11):236:1–236:34, 2023.
Ilya Loshchilov and Frank Hutter. SGDR: Stochastic gradient descent with warm restarts. In Proceedings of the 5th International Conference on Learning Representations (ICLR), 2017.
Michael Lutter, Christian Ritter, and Jan Peters. Deep Lagrangian networks: Using physics as model prior for deep learning. In Proceedings of the 7th International Conference on Learning Representations (ICLR), 2019.
Bernhard M. Maschke and Arjan J. van der Schaft. Port-controlled Hamiltonian systems: Modelling origins and system-theoretic properties. In Proceedings of the 2nd IFAC Symposium on Nonlinear Control Systems Design (NOLCOS), pp. 282–288, Bordeaux, France, 1992.
Takashi Matsubara, Ai Ishikawa, and Takaharu Yaguchi. Deep energy-based modeling of discrete-time physics. In Advances in Neural Information Processing Systems (NeurIPS), volume 33, pp. 13100–13111, 2020.
Volker Mehrmann and Benjamin Unger. Control of port-Hamiltonian differential-algebraic systems and applications. Acta Numerica, 32:395–515, 2023.
Francesco Mezzadri. How to generate random matrices from the classical compact groups. Notices of the American Mathematical Society, 54(5):592–604, 2007.
Sarvin Moradi, Gerben I. Beintema, Nick O. Jaensson, Roland Tóth, and Maarten Schoukens. Port-Hamiltonian neural networks with output error noise models. Automatica, 187:112892, 2026. doi: 10.1016/j.automatica.2026.112892.
Cyrus Neary and Ufuk Topcu. Compositional learning of dynamical system models using port-Hamiltonian neural networks. In Proceedings of the 5th Annual Learning for Dynamics and Control Conference (L4DC), volume 211 of Proceedings of Machine Learning Research, pp. 679–691. PMLR, 2023.
Cyrus Neary, Nathan Tsao, and Ufuk Topcu. Neural port-Hamiltonian differential algebraic equations for compositional learning of electrical networks. In 2025 IEEE 64th Conference on Decision and Control (CDC), pp. 2097–2103. IEEE, 2025.
Jorge Nocedal and Stephen J. Wright. Numerical Optimization. Springer, 2nd edition, 2006.
Mohd Halim Mohd Noor and Ayokunle Olalekan Ige. A survey on state-of-the-art deep learning applications and challenges. Engineering Applications of Artificial Intelligence, 159:111225, 2025.
Henry M. Paynter. Analysis and Design of Engineering Systems. MIT Press, 1961.
Maziar Raissi, Paris Perdikaris, and George Em Karniadakis. Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations. Journal of Computational Physics, 378:686–707, 2019.
Yulia Rubanova, Ricky T. Q. Chen, and David K. Duvenaud. Latent ordinary differential equations for irregularly-sampled time series. In Advances in Neural Information Processing Systems (NeurIPS), volume 32, 2019.
Mehrzad Tabatabaian. Engineering Systems Dynamics, Modelling, Simulation, and Design: Lagrangian and Bond Graph Methods. BCcampus, 2021. https://pressbooks.bccampus.ca/engineeringsystems/.
Matthew Tancik, Pratul P. Srinivasan, Ben Mildenhall, Sara Fridovich-Keil, Nithin Raghavan, Utkarsh Singhal, Ravi Ramamoorthi, Jonathan T. Barron, and Ren Ng. Fourier features let networks learn high frequency functions in low dimensional domains. In Advances in Neural Information Processing Systems, volume 33, 2020.
Arjan J. van der Schaft and Dimitri Jeltsema. Port-Hamiltonian systems theory: An introductory overview. Foundations and Trends in Systems and Control, 1(2–3):173–378, 2014.
Arjan J. van der Schaft and Bernhard M. Maschke. The Hamiltonian formulation of energy conserving physical systems with external ports. Archiv für Elektronik und Übertragungstechnik (AEÜ), 49(5–6):362–371, 1995.
Pantelis R. Vlachas, Jaideep Pathak, Brian R. Hunt, Themistoklis P. Sapsis, Michelle Girvan, Edward Ott, and Petros Koumoutsakos. Backpropagation algorithms and reservoir computing in recurrent neural networks for the forecasting of complex spatiotemporal dynamics. Neural Networks, 126:191–217, 2020.
Hanchen Wang, Tianfan Fu, Yuanqi Du, Wenhao Gao, Kexin Huang, Ziming Liu, Payal Chandak, Shengchao Liu, Peter Van Katwyk, Andreea Deac, Anima Anandkumar, Karianne Bergen, Carla P. Gomes, Shirley Ho, Pushmeet Kohli, Joan Lasenby, Jure Leskovec, Tie-Yan Liu, Arjun Manrai, Debora Marks, Bharath Ramsundar, Le Song, Jimeng Sun, Jian Tang, Petar Veličković, Max Welling, Linfeng Zhang, Connor W. Coley, Yoshua Bengio, and Marinka Zitnik. Scientific discovery in the age of artificial intelligence. Nature, 620(7972):47–60, 2023.
Sifan Wang, Hanwen Wang, and Paris Perdikaris. On the eigenvector bias of Fourier feature networks: From regression to solving multi-scale PDEs with physics-informed neural networks. Computer Methods in Applied Mechanics and Engineering, 384:113938, 2021.
Yaofeng Desmond Zhong, Biswadip Dey, and Amit Chakraborty. Dissipative SymODEN: Encoding Hamiltonian dynamics with dissipation and control into deep learning. In ICLR 2020 Workshop on Integration of Deep Neural Models and Differential Equations (DeepDiffEq), 2020a. arXiv:2002.08860.
Yaofeng Desmond Zhong, Biswadip Dey, and Amit Chakraborty. Symplectic ODE-Net: Learning Hamiltonian dynamics with control. In Proceedings of the 8th International Conference on Learning Representations (ICLR), 2020b.
A ELEMENTS AND JUNCTION STRUCTURE OF PORT-BASED MODELING
This appendix supplements Section 2.1. Table 3 summarizes the power-conjugate variables, the state variables, and the elements of port-based modeling in the mechanical, electromagnetic, and hydraulic domains. For example, the resistive relation of a linear damper or resistor is with a positive coefficient . A source (Sf or Se) supplies energy from, or drains it to, the outside of the system by prescribing a flow (e.g., a current source) or an effort (e.g., a voltage source or an external force) as a function of time, independently of the conjugate variable. In this paper, each of the storage elements, resistive elements, and sources is a one-port, that is, it has a single pair of port variables , and energy is stored, dissipated, or supplied only inside these elements. A storage element whose energy depends on several states, such as the inertia of a multi-link robot whose kinetic energy depends on the momenta and the positions together, is a multiport and is outside our setting. The junction structure is an assemblage of the following four types of elements (Karnopp et al., 2012). A 0-junction imposes a common effort with balanced flows, and a 1-junction imposes a common flow with balanced efforts, which generalize Kirchhoff's current and voltage laws, respectively. In a mechanical system, a spring between two masses applies a common force to both and is connected to them by a 0-junction, whereas the springs and dampers that connect a mass to a fixed wall have a common velocity and are connected by a 1-junction. A transformer (TF) is a two-port element that relates the efforts of its two ports, and likewise the flows, by a common ratio , that is, and , as in a lever, a gear box, or a piston-cylinder pair. A gyrator (GY) is a two-port element that relates the effort of each port to the flow of the other by a common ratio , that is, and , as in a DC motor pump. The two-ports are power continuous as holds, where the power at both ports is counted as flowing into the element.
Table 3: Power-conjugate variables, state variables, and elements in each domain
| Bond graph | Mechanical | Electromagnetic | Hydraulic | |
|---|---|---|---|---|
| f | flow | velocity | current | volume flow |
| e | effort | force | voltage | pressure |
| q | time integral of flow | displacement | charge | volume |
| p | time integral of effort | momentum | flux linkage | flow tube momentum |
| C | C-type storage element | spring | capacitor | reservoir |
| I | I-type storage element | mass | inductor | fluid inertia |
| R | resistive element | damper | resistor | fluid resistor |
| Sf | flow source | moving boundary | current source | flow rate source |
| Se | effort source | external force | voltage source | pressure source |
Note that the flow or the effort of a port can be the negative of the listed quantity as is the power flowing out of the element. For example, the effort of a mass is the negative of the force acting on it.
B REDUCTION OF EQ. (3) TO THE INPUT-STATE-OUTPUT FORM
This appendix supplements Section 2: it derives the input-output representation and Eq. (4) from Eq. (3), following van der Schaft & Jeltsema (2014, Secs. 4 and 5), gives the correspondence of existing methods to Eq. (4), and states the two costs of reduction in equations.
Exchange of port variables. Exchanging the flow and the effort of a port exchanges the corresponding columns of and , which preserves the condition and the rank condition (van der Schaft & Jeltsema, 2014, Sec. 5.3). We exchange them for every I-type port, every Sf port, and a subset of the resistive ports, and denote the resulting matrices, flows, and efforts with . Every storage port then satisfies and , and every source port satisfies , where is the vector of the partial derivatives . Moreover, and hold.
Input-output representation. If is invertible for the chosen subset of the resistive ports, Eq. (1) is equivalent to with , that is, is the graph of in these variables. This is the special case without constraints of the constrained input-output representation of Dalsmo & van der Schaft (1998) and van der Schaft & Jeltsema (2014, Sec. 5.2). Here, is skew-symmetric because multiplying by from the left and by from the right gives . Since , Eq. (3) becomes an ODE in once the remaining port variables are eliminated through the constitutive relations, which is possible, for example, when and the resistive relations are explicit maps in these variables; this is the form that PoDiNNs employ (Khosrovian et al., 2025).
Input-state-output form. We can decompose into submatrices corresponding to the storage, resistive, and source ports, and write , , and . Suppose, as is typical, that , , and vanish, that is, no resistive or source port is connected directly to another resistive or source port. Also, suppose that the resistive relation is linear, with , where the coefficient of an exchanged resistive port is the inverse of that in the original variables. The storage rows of give , the resistive rows give by the skew-symmetry of , and the source rows give . Substituting into the storage rows and setting yields Eq. (4) with . If a resistive or source port were connected directly to another resistive or source port, or would not vanish, and the output would acquire a feedthrough term in (van der Schaft & Jeltsema, 2014, Sec. 4.2).
Existing methods as special cases of Eq. (4). HNNs (Greydanus et al., 2019) use with a pair of positions and momenta as the state and the standard symplectic matrix , that is, Eq. (4) with , , and ; due to the skew-symmetry of , they conserve the energy exactly along the exact solutions. Neural symplectic forms (Chen et al., 2021) further learn as the inverse of a learned symplectic form. SymODENs (Zhong et al., 2020b) learn and with and , and Dissipative SymODENs (Zhong et al., 2020a) add a learned dissipation matrix . pHNNs (Desai et al., 2021) and pseudo-Hamiltonian neural networks (Eidnes et al., 2023) employ a predetermined and learn and (typically, its diagonal elements corresponding to the damping coefficients of the resistive elements), and learn an external force in place of , which depends only on time or state. OE-pHNNs (Moradi et al., 2026) learn , , , and from noisy observations . Lagrangian neural networks (LNNs) and deep Lagrangian networks (DeLaN) (Lutter et al., 2019; Cranmer et al., 2020) are based on Lagrangian mechanics, but can be considered as Hamiltonian systems with tangent bundles, where and are derived from the learned Lagrangian. CHNNs and CLNNs (Finzi et al., 2020) add holonomic constraints given in advance by projecting the vector field onto the constraint manifold.
Further details of related methods. N-pHDAEs (Neary et al., 2025) rewrite the DAE in semi-explicit form by a QR decomposition of the matrices, reduce it to an ODE by index reduction, and integrate it with a Runge–Kutta method, whereas the pH-DAE identification (Hagelaars et al., 2026) avoids reduction and solves the DAE by the backward Euler method; the latter suggests that the coefficient matrices can be learned but learns only the parameters of the elements in the experiments. Latent ODEs (Rubanova et al., 2019) encode the observed window into a distribution over the initial latent state , predict the future trajectory, and decode each observation through a learned likelihood of y given z.
Cost 1: the interconnection is mixed with the elements. In Eq. (4), and are blocks of the interconnection, whereas combines the constitutive relation of the resistive elements with the blocks that connect them; a learned therefore cannot be decomposed uniquely into and . For a nonlinear explicit relation , the same substitution gives , so that the dissipative term depends on the state and no longer factors as a constant matrix times .
Cost 2: an ODE is assumed to exist. When no choice of the exchanged ports makes invertible, e.g., for the balanced forces of multiple nonlinear springs connected to a massless point, an ODE in exists only after part of the state has been eliminated manually or is replaced with a rank-deficient matrix that is no longer determined by the interconnection alone but depends on the state and on the constitutive relations of the elements (e.g., the spring coefficients). Task 1 in Section 4 and in Appendix E.2 is an instance. Likewise, for a capacitor connected in parallel with a voltage source, the effort constraint has no flow part, so that is singular and the state is determined by the input instead of by an ODE.
C PROOFS
Proof of Theorem 1. The theorem states that a subspace is a separable Dirac structure with exactly independent flow constraints if and only if for some ; part (i) is the sufficiency of this representation and part (ii) its necessity.
Sufficiency (i). Since , is orthogonal. Hence, the rows of and are mutually orthogonal, so . Moreover, as the rows within each block are orthonormal, and have full row rank. Therefore, and . The flow rows and the effort rows are separate by construction, so is a separable Dirac structure with exactly independent flow constraints and independent effort constraints.
Necessity (ii). Let be any separable Dirac structure with exactly independent flow constraints. By the definition of separability, has a kernel representation, Eq. (1), in which every row involves only flows or only efforts. Collecting the flow rows and the remaining effort rows, we can write its matrices as
up to the recombination of rows within each block, and the two conditions of Eq. (2) reduce to and to and having full row rank, with . The Dirac structure is rewritten as , which depends only on the row spaces of and . The rows can be orthonormalized within each block, and then is an orthogonal matrix.
If , take . Given a fixed orthogonal matrix , applying the CS decomposition to gives
where and are orthogonal, and is zero except for the diagonal entries for . Here, is the cosine-sine factor, which rotates each paired flow and effort coordinate and fixes the unpaired coordinates. Set . Since ,
The block-diagonal coefficient matrix only recombines the flow rows and the effort rows separately and therefore leaves both constraint kernels unchanged. Thus, defines , that is, .
Proof of Proposition 1. By Theorem 1 (i), defines a Dirac structure for every , so Eq. (3) and condition (i) of Definition 1 give along every solution. For the -th storage element, the energy-storage relation of either type gives , and summing over yields , which proves Eq. (5). The inequality follows from .
D IMPLEMENTATION OF DINES
This appendix describes the implementation of DINEs independently of the tasks; the values of the settings that depend on the task are listed in Appendix E.
D.1 LEARNABLE ELEMENTS AND INTERCONNECTION
Elements. How each element is implemented depends on the prior knowledge given about it, that is, on whether the element is assumed to be linear (see Table 7). If a storage element is assumed to be linear, its energy is the quadratic function with a learned exponent , so that the coefficient is positive. For nonlinear storage elements, a neural network is added to the quadratic term as .
The resistive relation of every resistive element is an explicit map from the flow to the effort, the sum of a neural network and a linear term, in our sign convention. The last affine layer of every network and every exponent are initialized to zero, so that at initialization the network outputs vanish and every element is linear with unit coefficient. Each element network has two hidden layers of 200 units with the hyperbolic tangent, with hidden-layer weights and biases initialized uniformly on , where is the layer's input dimension. No sign constraint is imposed on the resistive relation for simplicity.
Interconnection. The matrices are parameterized as in Theorem 1. The orthogonal matrix is drawn once at initialization as a random orthogonal matrix, namely the orthogonal factor of the QR decomposition of a matrix with independent standard normal entries (Mezzadri, 2007), and is initialized to zero. The true are never used.
D.2 LEARNING AND PREDICTION
Trajectory network. The trajectory network takes the time , normalized by the duration of the training trajectories, and the index of the trajectory. The index is embedded into a 256-dimensional space. The time is encoded by random Fourier features (Tancik et al., 2020) at three scales, 1, 10, and 100, following the multi-scale construction of Wang et al. (2021). At each scale , the time is mapped to 128 sine and 128 cosine features, and , with frequencies drawn independently from and held fixed during training. These features are concatenated with the index embedding and passed through a subnetwork shared by the three scales, with four hidden layers of 256 units and the hyperbolic tangent. The outputs of the three scales are concatenated and mapped by a final affine layer to the outputs of . The outputs are the state of every storage element, the flow of every resistive element, and the variable conjugate to the prescribed variable of every source port, whether observed or not. The affine layers are initialized by the Glorot uniform scheme with zero biases. The trainable trajectory embeddings are initialized with independent standard normal entries.
Loss. In Eq. (6), each squared norm is implemented as a mean of squares: over the observed channels for the observation term, and over the n rows of the residual for the residual term. The observation error is not normalized by the standard deviations of the channels. The weight is unless stated otherwise. At every update, the observation term is evaluated on 2,000 pairs of a trajectory and one of its sample times, drawn uniformly with replacement from all such pairs, and the residual term on 2,000 pairs of a trajectory and a collocation time drawn uniformly over the training duration.
Regularization of unobserved flows. When the flow of a resistive element is not observed, its scale is a gauge freedom that the observations do not determine. To avoid vanishing, a regularization term that pushes the variance of each such flow over the minibatch toward one is added to the loss (see Appendix E.3 for the elements to which it is applied),
where is the set of these elements, is the minibatch, and is the population variance over the minibatch.
Initial state. Before prediction, the initial state , and the initial rate , and the algebraic variables (the flows of the resistive elements and the conjugate variables of the source ports) are estimated from the observations and the input at the first time step by minimizing the observation error subject to the learned DAE at . When needed, the derivative of the learned DAE is also used as a constraint. When a history of samples of inputs and observations is available, the unknowns at all time steps of the history are estimated by minimizing the sum of the observation errors over the history, subject to the learned DAE and the trapezoidal rule between consecutive samples.
Integration. At prediction, the learned DAE is integrated from the initial state by the three-stage Radau IIA method of order five (Hairer & Wanner, 1996) with the fixed step equal to the sampling interval . At each step, the stage equations are solved simultaneously by Newton's method. The prescribed variables of the source ports, which are given as functions of time, are evaluated analytically at every stage.
D.3 ISOLATION AND COMPOSITION
Gauge of the boundary variable. When the boundary port of a subsystem is connected to a source during training, the conjugate boundary variable is an output of during training and, for prediction, is computed from the learned relations. Its scale is not determined by the observations of the subsystem (see Section 3), whereas the composition equates the boundary variables of two subsystems. Before composition, this scale is therefore calibrated, without retraining, by the following rules. The calibration is applied consistently to , the constitutive relations, and the momenta, preserving the observed trajectories of each subsystem.
Fixing the scale from the interconnection. For junction interconnections, the nonzero connection coefficients are known a priori to have unit magnitude. This prior is used to fix scales and is not imposed on coefficients representing unknown transformer ratios. When the learned interconnection, read in reduced row echelon form, has a row that relates the boundary variable, whose scale is undetermined, to an observed variable, whose physical scale is known, through a junction, that is, with a coefficient of unit magnitude, the scale is fixed by normalizing the absolute value of the learned coefficient to 1. In this case, no additional observation of the boundary variable is needed for the calibration. When a single element is isolated for reuse, its scale is fixed in the same way from the learned interconnection of the subsystem in which it was learned, before the element is taken out. When the row involves several observed variables, the coefficient of the largest magnitude is normalized.
Fixing the scale from measurements. Otherwise, when the scale cannot be fixed from the interconnection and the existing observations, it is calibrated from additional measurements of the boundary variable. With the boundary effort predicted by the model and the measured boundary effort , the scale and the intercept are estimated by
where is the number of measurements, and the calibrated boundary effort is . The intercept is a constant shift of the boundary effort. Since the effort rows of the DAE are preserved by any shift of the efforts with , the intercept is absorbed by constant shifts of the efforts of the C-type storage elements, , which is equivalent to replacing the energy of each C-type storage element by ; the shifts are chosen so that holds for the rescaled matrix and with at the ports of the C-type elements, at the boundary port, and 0 at the other ports.
Fixing the Transformer ratio from measurements. Similarly, if two subsystems are connected through a transformer with an unknown ratio, the ratio is identified after the scales of both subsystems are fixed. The boundary outputs of the two subsystems are evaluated at a few states of the composed system, and the ratio is obtained by closed-form least squares from the relation of the transformer. The ratio is then frozen. This procedure is required for the piston area of Task 4, mentioned in Appendix E.5.
Composed DAE. The composed system is the DAE formed by the frozen DAEs of the subsystems and the connection; the boundary variables are unknowns of this DAE and are solved at every stage of the Radau IIA method together with the states. No data of the composed system are used to retrain the subsystems.
Table 4: Systems of Tasks 1–4.
| Task: system | C | I | R | Se | Sf | Observations | Inputs | ||
|---|---|---|---|---|---|---|---|---|---|
| 1: Three-way junction | 3 | 3 | - | - | - | 6 | (2, 4) | 6 states | - |
| 2: RC ladder | 4 | - | 7 | 2 | - | 13 | (8, 5) | 10 of 13 currents | 2 source voltages |
| 3: Subsystem A | 3 | 3 | 2 | 1 | - | 9 | (6, 3) | 6 states | boundary force |
| Subsystem B | 1 | 2 | 1 | 2 | - | 6 | (4, 2) | 3 states | boundary and external forces |
| 4: Hydraulic | 1 | 1 | 1 | 1 | 1 | 5 | (3, 2) | 2 states | source pressure, boundary flow |
| Mechanical | 3 | 2 | 2 | - | 1 | 8 | (5, 3) | 5 states | boundary velocity |
Boundary variables are recorded separately for training the boundary networks of Coupled Neural ODEs and, for the mechanical subsystem of Task 4, calibrating DINEs (see Table 7).
D.4 ABLATIONS
DINEs (soft). DINEs (soft) replace the exact parameterization of Theorem 1 by independently learned matrices and soft penalties. The loss of Eq. (6) is augmented by
where denotes the Frobenius norm, and both penalties have unit weight. The second term penalizes deviations from row orthonormality of ; exact row orthonormality implies the rank condition of Eq. (2). Both penalties vanish identically under the parameterization of Theorem 1 (see Appendix C for proof). The entries of and are initialized independently from a Gaussian distribution with mean zero and variance . No block structure or value of is enforced. The remaining training settings and the initial-state estimation and time-integration procedures are unchanged. The learned matrices are used directly for prediction, without projection onto a Dirac structure. For this ablation, “not converged” in Tables 2 and 8 denotes a numerical failure during initial-state estimation or time integration that prevents completion of all ten test trajectories for a seed. This designation is not based on a threshold on the training loss or prediction error. Means and standard deviations are reported only over seeds that complete all ten trajectories, with the number of excluded seeds stated in the tables.
Misspecified . DINEs with a misspecified are the model with set to a value different from that of the true interconnection and ; all other settings are unchanged. By Theorem 1, the true Dirac structure is then outside the model family, so that the misspecification leads to a catastrophic failure rather than to a silently wrong model (see Section 3). The values of examined are listed in Appendix E.2.
E EXPERIMENTS
E.1 COMMON SETTINGS
Systems. Table 4 lists the elements, observations, and inputs of the learned systems of Tasks 1–4. The coefficients of the true systems below are disclosed for reproducibility and are not given to any model.
Sampling and data. All trajectories are sampled with the time step in the units of the simulation, without noise. Durations are counted in steps, so that a trajectory of steps has samples, and the frequencies of the inputs are given in cycles per step. Every training set, of Tasks 1 and 2 and of each subsystem of Tasks 3 and 4, consists of 100 trajectories of 500 steps, and every test set of 10 trajectories of 10,000 steps.
Reference trajectories. The reference trajectories are generated by integrating the true equations with the eighth-order Runge–Kutta method DOP853 (Hairer et al., 1993) with the relative tolerance , the absolute tolerance , and the maximum step . The generated data are checked against a second integration with the tolerances and and the maximum step .
Training. All models are trained with five seeds, which change the initialization and the sampling of minibatches, with minibatches of 2,000. The optimizer is Adam (Kingma & Ba, 2015) with the learning rate , , and no weight decay, with cosine annealing (Loshchilov & Hutter, 2017) of the learning rate to zero over all updates. The number of updates is 100,000 unless stated otherwise. Training is in single precision. Whenever a loss is normalized by standard deviations, these are the sample standard deviations over the training set. The parameters after the last update are used, without early stopping and without model selection on the test set.
Prediction. Predictions are computed in double precision. The learned DAEs of DINEs, the composed systems, and the receiving system of Task 5 are integrated as described in Appendices D.2 and D.3. The ODE models are integrated by the adaptive Dormand–Prince method with the relative tolerance and the absolute tolerance , the maximum step , and outputs at every step.
Evaluation metrics. The metrics of Section 4.1 are defined as follows. Let and be the predicted and true observations at the -th sample and the number of observed channels. The squared error at sample and the MSE over an evaluation horizon of steps ( unless stated otherwise), including the initial sample, are
The valid prediction time (VPT) (Vlachas et al., 2020) for a threshold is the fraction of the horizon before first exceeds : with the first index such that ,
and if the threshold is never exceeded. Both metrics are averaged over the ten test trajectories of each seed.
E.2 TASK 1: THREE-WAY JUNCTION
System. Three masses are attached through springs to one massless junction. With the elongation of spring i, the velocity of mass i, and the velocity of the junction,
where the last equation is the force balance at the junction. The spring forces are with , , , and the masses are ; there are no dampers and no inputs. For the reference trajectories, the force balance is differentiated in time, which gives with the tangent stiffness ; this is substituted, and the resulting ODE is integrated. In port-based terms, the system has three C-type and three I-type elements, and the junction imposes two constraints among the flows and four among the efforts.
Data. The initial elongations and are uniform on and the initial velocities uniform on ; is solved from the force balance, whose solution is unique since is monotonic. All six states are observed. The initial states of the test trajectories are drawn from the same distributions as those of the training trajectories.
DINEs. The I-type elements are assumed to be linear, with their masses learned, and the springs are nonlinear. The main setting is ; in the sweep, with , and all other settings, including the initialization rule and the observations, are unchanged. DINEs estimate the initial state from the six observations at the first sample.
Neural ODEs and PoDiNNs. Neural ODEs (Chen et al., 2018) take the observed states as the state x and learn the vector field by a network with two hidden layers of 200 units and the hyperbolic tangent. PoDiNNs (Khosrovian et al., 2025) consist of one network per C-type element for its
Table 5: Resistors of Task 2.
| Resistor | |||
|---|---|---|---|
| 0.8299 | 0.7991 | ||
| 0.6711 | 4.6312 | ||
| 0.7407 | 6.3965 | ||
| 0.6981 | 6.5022 | ||
| 0.5908 | 5.1852 | ||
| 0.7813 | 2.3884 | ||
| 0.7018 | 0.7792 |
energy, of the same multilayer-perceptron structure as the element networks of DINEs but without an explicit quadratic term, following the original implementation, one learned mass per I-type element, and a constant matrix , initialized to zero, that couples the two:
where is the diagonal matrix of the masses, and and are the numbers of C-type and I-type elements. Here, is the I–C coupling block of the matrix of the input-output representation in Section 2.2; on Task 1, which has no resistive elements and no sources, the coupling parameters of the original implementation reduce to this zero-initialized constant matrix. PoDiNNs (Khosrovian et al., 2025) are given the list of elements, the correspondence between the observed channels and the states of the elements, and the linearity of the I-type elements. Neither the constraint nor the state-dependent matrix of the reduced ODE is supplied, and the states are not projected onto the true constraints. Both models are trained by one-step prediction: from a training sample , the state after is predicted by one step of the classical fourth-order Runge–Kutta method. The loss is the squared error to , normalized by the sample standard deviation of each channel over the training set and averaged over the channels and the minibatch. Predictions start from the observed initial state, , and integrate the learned ODE by the adaptive Dormand–Prince method (Dormand & Prince, 1980).
E.3 TASK 2: RC LADDER
System. Two voltage sources and , two nodes and , four grounded linear capacitors , and seven nonlinear resistors are connected as follows: connects source A to node , and connect node to and , connects node to node , and connect node to and , and connects node to source B. In Figure 2, the source voltages are denoted by and . Capacitor has the charge and the voltage with , that is, the capacitances are . Resistor has the voltage drop in the direction of Table 5. The currents satisfy and at the two nodes, and the charges satisfy . The node voltages are algebraic variables determined by Kirchhoff's current laws together with the nonlinear resistor relations. For the reference trajectories, the resulting nonlinear equations are solved by Newton's method at every evaluation. In port-based terms, the system has 13 ports, four C-type elements, seven resistive elements, and two effort sources; its graph has 13 branches and nine nodes, hence eight current-law constraints and five voltage-law constraints.
Inputs and data. Each source voltage is a sum of six cosines and an offset, , where the frequencies are in cycles per step, so that is the frequency per unit time; the inputs are evaluated analytically at all sample, collocation, and stage times. The two sources are generated as a common mode and a differential mode, and , each of which is a sum of three cosines and an offset. The trajectories are divided into six groups, which combine the upper frequency with the level , with the group labels randomly permuted over the trajectories; for each , the training groups contain 17, 17, and 16 trajectories for the three increasing levels and the test groups 2, 2, and 1 trajectories. In each group, the frequencies of the common mode are uniform on the lower half of the band and those of the differential mode on the upper half , the phases are uniform on , and, before the rescaling below, the offset of each mode is uniform on . The rescaling gives the two modes the same mean square on a fixed grid. Before the rescaling, the amplitudes are uniform on for the common mode and on for the differential mode. For the amplitude normalization, provisional frequencies are first drawn independently and uniformly from the full band for both modes, where and . Using these provisional frequencies and the original phases, the sum of the mean squares of the two modes, including their offsets, is computed on the grid , . The frequencies are then mapped to the respective half-bands by
without drawing new frequencies, and the differential-mode phases are shifted by . Finally, the amplitudes and offset of each mode are multiplied by a single factor specific to that mode, so that its mean square, evaluated with the remapped frequencies and updated phases on the same grid, equals . The initial capacitor voltages are obtained from with uniform on and : within the pairs and , the mean of the two voltages is kept and their difference is tripled, which gives , and then with , so that the weighted sum of squares equals that of . This transformation increases the within-pair voltage differences relative to their common components while preserving the specified weighted sum of squares. The initial charges are . The initial states of the test trajectories are drawn from the same distributions as those of the training trajectories. The observed channels are the currents at ten of the 13 ports: the source currents and , the currents of the four capacitors, and the currents of ; all ten are given to all models alike. The current labels in Figure 2 satisfy , , and for . The charges, the node voltages, and the currents of , , and are not observed. That the capacitor currents coincide with the currents of , and and with the currents of and up to sign, is not given to any model. Each test trajectory has 20 samples of inputs and observations before the prediction as the history.
DINEs. The capacitors are assumed to be linear with unknown capacitances, and the resistors are nonlinear. DINEs use , the regularization term (as defined in Appendix D.2) for the flows of the three unobserved resistors , , and , and 500,000 updates. The initial state is estimated from the history of 20 samples, starting from zero charges. The model is then advanced by one step from the last sample of the history, and the following 10,000 steps are evaluated, including the first predicted sample.
CT-SUBNET. CT-SUBNET (Beintema et al., 2023) consists of an encoder that maps the inputs and outputs of the past samples to the state , a vector field , and an observation . The observation map takes the input as well, unlike the original form , because the observed currents depend directly on the source voltages; otherwise the currents would have to be reproduced from the latent state alone. Each of the three maps is the sum of a network with two hidden layers of 64 units and the hyperbolic tangent and an affine map from its input to its output, with zero initial biases. The inputs and outputs are standardized by their means and sample standard deviations over the training set, and the output of is transformed back to physical units. The output of the network of the vector field is divided by a time scale of . At every update, 2,000 windows are drawn from the training set, each consisting of the past samples for the encoder and the following 50 samples. Over the 50 samples, the model is integrated by the classical fourth-order Runge–Kutta method with one step per and the analytic inputs at the stage times. The mean squared error of the 50 predicted outputs, normalized by the sample standard deviation of each output channel, is minimized with respect to , , and jointly. For prediction, the encoder maps the history to the state at the first predicted sample once, and the model is integrated with the known inputs by the adaptive Dormand–Prince method; neither the encoder nor the state is updated by observations afterwards. The state dimension is , and the model is trained for 500,000 updates.
Table 6: Subsystems of Tasks 3 and 4.
| Subsystem | Inertias | Springs (a, b) | Dampers (a, b) | Boundary (prescribed recorded) | Observed |
|---|---|---|---|---|---|
| Task 3, A | 1, 1.2, 1.4 | (0.4, 0.1)(0.3, 0.1)(0.2, 0.1) | (0.07, 0.45)(0.09, 0.55) | 3 q, 3 v | |
| Task 3, B | 0.9, 1.1 | (0.35, 0.15) | (0.08, 0.5) | 1 q, 2 v | |
| Task 4, hydraulic | 0.9 | (0.8, 0) (reservoir) | fluid resistor | 1 q, 1 Q | |
| Task 4, mechanical | 1, 1.4 | (0.4, 0.1)(0.3, 0.1)(0.2, 0.1) | (0.07, 0.45)(0.09, 0.55) | 3 q, 2 v |
E.4 TASK 3: RIGID COUPLING
System. Each subsystem is a chain of masses, springs, and dampers with one boundary port. Springs have , and dampers have with , in our sign convention; the equations of motion below are written with the resistive forces , which are the negatives of the efforts. Subsystem A is a chain from a wall, a spring with a damper, mass , a spring, mass , a spring with a damper, and mass , to which the boundary force is applied. With the absolute positions of the masses, the elongations of the three branches are , which are observed together with the velocities , and the equations of motion are
where is the total force of the spring and the damper of branch , for and . Subsystem B consists of mass , to which the boundary force is applied, a spring with a damper, and mass , to which the external force is applied. With and ,
The recorded boundary velocities are of A and of B; that they coincide with observed mass velocities is not given to any model. Table 6 lists the elements of the subsystems.
Boundary port. During the training of a subsystem, its boundary port is a source: the prescribed boundary variable, a force, is a known input, and the conjugate variable, a velocity, is recorded but excluded from the losses of the dynamics training of every model. The recorded boundary variables of the training data are used for the training of the boundary network of Coupled Neural ODEs (and, in Task 4, for the calibration of DINEs). No observation of the boundary variables is given during the prediction of the composed systems. In the composed system, the boundary velocities are equated, the reaction force acts with on A and on B and is an unknown, and is the only known input; no data of the composed system are used for training. The composed systems are integrated as DAEs with the boundary variables as unknowns, and the initial state is estimated from the nine observations at the first sample.
Data. The initial positions of A are uniform on and its velocities on ; the initial elongation of B is uniform on and its velocities on . The boundary force of A is a sum of three cosines with frequencies uniform on , amplitudes uniform on , and phases uniform on . Each force of B is a sum of four cosines with frequencies drawn from the multiples of the reciprocal of the training duration within , amplitudes uniform on , and phases uniform on . The reference trajectories of the composed system are generated by substituting the coupling variables, computed analytically, into the differential equations and integrating the resulting ODE in the original states of the subsystems with the method and tolerances of Appendix E.1. Here, and are the two coupled masses, and are the forces acting on them other than the reaction force, and the reaction force .
keeps the boundary velocities equal; the initial boundary velocities are set equal.
Test trajectories. The test trajectories of the composed systems are generated by the following rule. Each candidate starts from independently selected subsystem training initial states, adjusted to satisfy the coupling constraints. The input frequencies and amplitudes are taken from the selected training trajectories, with independently redrawn uniform phases. A candidate is accepted if, at all samples of the 10,000 steps of its reference trajectory, every state, known input, recorded boundary variable, and resistive flow stays within the range of the corresponding channel in the training data of the subsystems, and the residual of the coupling constraints, at the samples, stays below (an acceptance criterion after generation, not a tolerance of the integrator). The first ten accepted candidates, out of at most 500, form the test set, which is common to both methods and all seeds.
DINEs. The I-type elements are assumed to be linear with unknown coefficients, and the springs and dampers are nonlinear. The scale of the recorded boundary velocity of each subsystem is fixed from the learned interconnection as described in Appendix D.3, without additional observations of the boundary variable.
Coupled Neural ODEs. Subsystem dynamics. For each subsystem, a Neural ODE of Appendix E.2 takes the observed states as its state x and the prescribed boundary variable, together with the other known inputs, as its input , , and is trained by the same one-step loss, with the known inputs evaluated analytically at the stage times.
Boundary network. Composition also requires the boundary variable conjugate to the prescribed boundary input, so a separate network with two hidden layers of 64 units, the hyperbolic tangent, and one scalar output predicts it from the current state of the subsystem only: the boundary velocity on Task 3. After the training of , its parameters are frozen and is trained separately on the recorded states and the recorded boundary variables of the training data of the subsystem, not on states generated by the learned vector field. At every update, a minibatch of 2,000 pairs is drawn with replacement, and
is minimized, where is the sample standard deviation of the recorded boundary variable over the training set, with the optimizer, the schedule, and the number of updates of Appendix E.1. The normalization is applied to the loss only, so the network predicts the boundary variable in its recorded physical units.
Composition and prediction. Both vector fields and both boundary networks are frozen before composition. During prediction, each boundary network is evaluated on the current predicted state of its subsystem, and its output enters the same connection as for DINEs: on Task 3, the outputs of the two boundary networks are equated as the boundary velocities, and the reaction force is an unknown input of the vector fields. The composed system is integrated, and its initial state is estimated, using the procedures of Appendices D.2 and D.3 and the settings stated above; neither the vector fields nor the boundary networks are retrained on data of the composed system.
E.5 TASK 4: HYDRAULIC-MECHANICAL COUPLING
System. Both subsystems are chains with one boundary port as in Task 3 (see Appendix E.4), the mechanical subsystem with masses, springs, and dampers, and the hydraulic subsystem with a fluid inertia, a reservoir, and a fluid resistor; the springs and dampers have the same forms as in Task 3, with the coefficients of Table 6. The hydraulic subsystem consists of a pressure source , a fluid resistor, one fluid inertia, and a reservoir, with the states and the known inputs and the boundary flow :
where ; the boundary pressure is recorded. The mechanical subsystem is a chain from the boundary with the prescribed velocity , a spring, mass , a spring with a damper, mass , and a spring with a damper, to a wall, with the states and the input only:
where and are the spring forces and the damper forces of Table 6; the boundary force is recorded. The coupling is and with the unknown piston area , whose true value 1.3 is not given.
Boundary port. The protocol of Task 3 applies: the boundary flow is prescribed and the pressure P is recorded for the hydraulic subsystem, and the velocity is prescribed and the force is recorded for the mechanical subsystem (see Table 6). In the composed system, only the pressure source is a known input, and and are unknowns. The composed system is integrated as a DAE with the boundary variables as unknowns, and the initial state is estimated from the seven observations at the first sample.
Data. The initial states of the hydraulic subsystem are uniform on for and on for ; those of the mechanical subsystem are uniform on for and , with , and on for and . Every input is a sum of five cosines: the frequency band is divided into five equal sub-bands and one frequency is drawn uniformly from each, the phases are uniform on , and the amplitudes are with relative amplitudes uniform on and a nominal root-mean-square level . For the pressure source of the hydraulic subsystem, , and for its boundary flow, ; the band is or . For each of these two inputs, the three levels and the two bands form six groups, and the group labels are shuffled separately for the two inputs, so that neither the levels nor the bands are constrained to match within a trajectory. For the boundary velocity of the mechanical subsystem, with the band . The reference trajectories of the composed system are generated as in Task 3. The coupling variables follow from differentiating the force balance with and : and , which are substituted into the ODE of the seven states; the initial state satisfies the force balance. The five trajectories of 100 steps of the composed system, provided for the identification of the area and for the scales of the initialization, start from states consistent with the force balance and within the training ranges.
Test trajectories. The test trajectories of the composed system are generated by the rule of Task 3 (see Appendix E.4), where the residual of the coupling constraints is .
DINEs. The reservoir is assumed to be linear with an unknown coefficient, and the fluid resistor is nonlinear; the I-type elements, springs, and dampers are treated as in Task 3. The scale of the boundary pressure of the hydraulic subsystem is fixed from the learned interconnection as in Task 3, whereas the boundary force of the mechanical subsystem is calibrated from measurements as described in Appendix D.3, with an intercept in addition. For the mechanical subsystem, observations of the boundary force, preselected from the training data of the subsystem by a fixed random draw, are used. The area is identified from four fixed states of the five trajectories of the composed system by the closed-form least squares of Appendix D.3, , where and are the calibrated boundary outputs of the two subsystems at the -th state. The hydraulic boundary output is evaluated with the boundary flow set to zero. The observations of the composed system do not determine the initial rates. In the initial-state estimation, the observation error is therefore normalized by the sample standard deviations of the observed channels over the five trajectories, and a penalty on the initial rates of the observed channels is added, where are the sample standard deviations of the increments divided by over the same trajectories.
Coupled Neural ODEs. Coupled Neural ODEs are as in Task 3 (see Appendix E.4), except that the boundary network predicts the boundary pressure of the hydraulic subsystem, whose boundary input is the flow, and the boundary force of the mechanical subsystem, whose boundary input is the velocity, and that, in the composed system, the boundary flow and velocity are unknown inputs, and the boundary networks supply the pressure and the force of the coupling constraints of the piston. If the connection has a transformer with an unknown ratio, the ratio is identified from the same states of the composed system as for DINEs by the same closed-form least squares, with the outputs of the frozen boundary networks, and is then frozen. The same normalized initial-state objective and rate penalty are used for Coupled Neural ODEs.
E.6 TASK 5: REUSE OF THE LEARNED SPRING
Isolation. The donor is DINEs trained on subsystem A of Task 3, and all five training seeds are used. The energy network of the second spring, including its quadratic term, is isolated and frozen as the constitutive relation . The scale of the force is fixed from the learned interconnection as described in Appendix D.3, since the coefficients of the junctions have unit magnitude and the subsystem contains no unknown transformer ratio. With the learned flow of the source port written in the observed velocities of the masses as , the coefficient of the largest magnitude is selected for each seed, and the scale is
so that the inertia connected to the boundary is identified from the learned interconnection rather than prescribed by its index. The reused constitutive relation is ; the network and its displacement axis are unchanged, and no offset of the force is corrected. Nothing else is transferred from the donor, neither , , the other springs, the dampers, nor the masses, and neither additional measurements of the boundary variable or of the spring force, nor the true constitutive relation of the spring, nor the response of the receiving system is used to determine the scale.
Receiving system. The receiving system is known: a wall is connected to a main mass M by a linear spring with a damper in parallel, the input acts on M, and an auxiliary mass is connected to M by the reused spring with a damper in parallel. With the positions x and measured from the wall and the relative displacement of the reused spring,
where is the derivative of the scaled energy of the spring with respect to r. The observed channels are with and . All coefficients are fixed, , , , , and , and all initial positions and velocities are zero. The prediction is terminated if the argument of the reused constitutive relation, including its evaluations within the Newton iterations, leaves the range of the displacements of the second spring in the training data of the donor; the argument is never clamped to this range.
Data. The reference trajectories use the true relation of the second spring of subsystem A of Task 3, , in place of in the equations of the receiving system, and are generated and checked as in Appendix E.1. Each input is a sum of five cosines, , with one frequency drawn uniformly from each of the bands , , , , and , phases uniform on , and amplitudes with relative amplitudes uniform on and a nominal root-mean-square level . At each level, candidates are generated in order, at most 500 per level, and the first five whose reference responses keep the deformation of the reused spring within the interval between the first and the 99th percentiles of the displacements of the second spring in the training data of the donor are retained; no candidate was rejected. This selection uses the reference system, not the prediction errors, and the same ten inputs are used for all five seeds of the donor. Each test trajectory has 10,000 steps, as in the other tasks.
F ADDITIONAL RESULTS AND DISCUSSIONS
Prior knowledge given to the models. Table 7 summarizes the prior knowledge and assumptions given to the models. The available prior knowledge is not identical across the models, but the comparison was performed under the same data and evaluation procedures.
Table 7: Prior knowledge given to the models. The last row is used for scoring only.
| DINEs | Neural ODEs | PoDiNNs | CT-SUBNET | Coupled Neural ODEs | |
|---|---|---|---|---|---|
| Training observations and known inputs | yes | yes | yes | yes | yes |
| Types and numbers of elements | yes | no | C-type, I-type | no | dimensions only |
| Correspondence of observations to elements | yes | as states | yes | as outputs | states, boundary port |
| Linearity of elements (coefficients unknown) | yes | no | I-type elements | no | no |
| yes | no | no | no | no | |
| True wiring and coefficients | no | no | no | no | no |
| Unobserved true states | no | - | - | no | - |
| Boundary records of the subsystem training data | calibration (Task 4, mechanical only) | - | - | - | boundary-network training |
| Connection of the boundary ports at composition | yes | - | - | - | yes |
| States of the composed system (Task 4) | area, initialization scales | - | - | - | area, initialization scales |
| Displacement-force measurements of the true spring (Task 5) | no | - | - | - | - |
| Test observations after the first sample (after the history on Task 2) | scoring | scoring | scoring | scoring | scoring |
Table 8: VPT of Tasks 1–5 for further thresholds .
| Task | Model | ||||
|---|---|---|---|---|---|
| 1 | Neural ODEs | ||||
| 1 | PoDiNNs | ||||
| 1 | DINEs (soft) | ||||
| 1 | DINEs (ours) | ||||
| 2 | CT-SUBNET () | ||||
| 2 | CT-SUBNET () | ||||
| 2 | CT-SUBNET () | ||||
| 2 | CT-SUBNET () | ||||
| 2 | CT-SUBNET () | ||||
| 2 | DINEs (soft) | (not converged) | |||
| 2 | DINEs (ours) |
| Task | Model | ||||
|---|---|---|---|---|---|
| 3 | Coupled Neural ODEs | ||||
| 3 | DINEs (ours) | ||||
| 4 | Coupled Neural ODEs | ||||
| 4 | DINEs (ours) | ||||
| 5 | DINEs (ours) |
3 of 5 seeds did not converge; averaged over the remaining 2.
VPT for further thresholds. Table 8 reports the VPT for further thresholds . The superiority of DINEs over the other models is consistent.
Readout of the learned interconnection. We show examples of the learned and on Tasks 1 and 2 and read the interconnection from them. For each matrix, linearly independent columns are chosen as the pivot columns and moved to the front, and the matrix is brought to reduced row echelon form, in which the pivot columns form the identity matrix. Since neither system contains transformers, the nonzero coefficients should be . The coefficients of the elements whose port variables are unobserved, the resistive elements in this case, have gauge freedoms, as mentioned in Appendix D.2. These gauge freedoms are eliminated by normalizing the coefficients to . In principle, a very small coefficient could be canceled in scale by a very large flow, effort, or constitutive relation of the element (that is, the resistance) and accidentally removed; this does not happen thanks to the regularization term (as defined in Appendix D.2). Since the learned coefficients are continuous values, those with absolute values of at most are treated as zero.
Task 1: three-way junction. The ports are ordered as , the learned flow constraint matrix and its reduced row echelon form are
Substituting and into the rows gives
This implies that each spring with the velocity is connected between the same junction with the velocity and its own mass with the velocity .
The ports are ordered as so that four independent columns come first, the learned effort constraint matrix and its reduced row echelon form are
The rows give
This implies the force balance at the junction and the action and reaction forces between the springs and their masses .
Task 2: RC ladder. The flows of three of the seven resistive ports are unobserved. The ports are ordered as , where the resistors are numbered by their ports in the learned model and the vertical line separates the pivot columns, the learned flow constraint matrix is
where , , and are unobserved. Its reduced row echelon form is with
Omitting the small coefficients and scaling the remaining coefficients as according to their signs gives
\widehat{B}_{f}=\begin{bmatrix}{{{ \mathrm{Se}_{1} }}&{{{ \mathrm{Se}_{2} }}&{{{ \mathrm{C}_{1} }}&{{{ \mathrm{C}_{2} }}&{{{ \mathrm{C}_{3} }}} \\{{{1}}}&{{{1}}}&{{{1}}}&{{{1}}}&{{{1}}} \\{{{1}}}&{{{0}}}&{{{1}}}&{{{1}}}&{{{0}}} \\{{{-1}}}&{{{0}}}&{{{0}}}&{{{0}}}&{{{0}}} \\{{{0}}}&{{{0}}}&{{{1}}}&{{{0}}}&{{{0}}} \\{{{0}}}&{{{0}}}&{{{0}}}&{{{1}}}&{{{0}}} \\{{{0}}}&{{{0}}}&{{{0}}}&{{{0}}}&{{{1}}} \\{{{-1}}}&{{{-1}}}&{{{-1}}}&{{{-1}}}&{{{-1}}} \\{{{0}}}&{{{-1}}}&{{{0}}}&{{{0}}}&{{{0}}}\end{bmatrix}.Each row represents a Kirchhoff current law at a node of the circuit. With the currents , , and , the rows give
The ports are ordered as , the learned effort constraint matrix is
and its reduced row echelon form is with
Omitting the small coefficients and scaling the remaining coefficients as according to their signs gives
Each row represents a Kirchhoff voltage law around an independent loop of the circuit. We can confirm . The rows give two common voltages
and .
From these relations, we can reconstruct the circuit diagram of the RC ladder, including the three resistors whose roles in the interconnection were unknown.