Advanced maths

Differential algebraic equation calculator with a linear constraint

A differential-algebraic system combines time evolution with constraints that must hold at every instant.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

A differential-algebraic system combines time evolution with constraints that must hold at every instant. This calculator handles a constant-coefficient semi-explicit index-one family, eliminates an invertible algebraic block and solves the resulting affine differential equation with an augmented matrix exponential. Consistent initial algebraic values are derived from the supplied differential state.

THE FORMULAx′=Ax+Bz+c; 0=Cx+Dz+e; z=−D^−1(Cx+e).

A worked example

For x′=z and 0=x+z, the constraint gives z=−x. Starting from x(0)=1 therefore requires z(0)=−1 and produces x(t)=exp(−t), z(t)=−exp(−t). The algebraic residual at time one is zero up to numerical roundoff.

Good to know

Bounded small constant matrices with square invertible D and matching dimensions. No higher-index, nonlinear or singular-D problems. The initial algebraic state is derived, not independently imposed. Matrix-exponential norm limits and conditioning checks apply.

Algebraic consistency is enforced by elimination

The differential state x has its own initial value, while the algebraic state z must satisfy the constraint at that same instant. Solving the invertible D block derives z(0) from x(0). This avoids accepting two inconsistent initial vectors and then silently projecting one of them to a different problem.

Matrix dimensions distinguish the differential and algebraic state counts. A, B, C and D must match those counts, and the constant vectors must match their respective equations. A scalar demonstration uses the same formulas as a small coupled system; no assumption that every block is one-dimensional is hidden in the elimination.

The algebraic constraint keeps z opposite to xx(t) = exp(−t)z(t) = −exp(−t)Constraint: x+z = 0
For x′=z and 0=x+z, the constraint gives z=−x. Starting from x(0)=1 therefore requires z(0)=−1 and produces x(t)=exp(−t), z(t)=−exp(−t). The algebraic residual at time one is zero up to numerical roundoff.

The Linear system solver covers the nearby task. A DAE couples time evolution to algebraic constraints; a static linear solve has no consistency or drift issue.

Index one depends on an invertible constraint block

Invertibility of D lets the algebraic state be expressed as a linear function of x, leaving an affine ordinary differential equation. The page solves that equation by adding a constant homogeneous coordinate and evaluating a matrix exponential. This method does not numerically drift away from a separately integrated algebraic variable.

A singular D can indicate a higher-index or otherwise differently structured DAE. Replacing its inverse with an arbitrary pseudoinverse would not preserve the stated mathematical model. Such inputs are rejected, and the error does not imply that all singular-block systems lack meaningful constrained solutions under another formulation.

The residual tests the constraint, not every possible DAE

At the selected time, the recovered differential and algebraic states are substituted into Cx+Dz+e. The maximum residual is printed as a numerical consistency check. A small value supports that constraint calculation but does not certify a nonlinear DAE, an event-driven system or a physical model not supplied in the matrix blocks.

The default reduces exactly to x′=−x and z=−x, making the exponential state and consistent initial algebraic value independently available. More general checks compare the eliminated affine equation and the original residual. Time and matrix norm caps reflect the bounded exponential implementation rather than a claim that larger theoretical DAE solutions do not exist.

Eliminate the algebraic state before evolving time

The form solves x′=Ax+Bz+c together with 0=Cx+Dz+e. When D is invertible, z=−D⁻¹(Cx+e). Substitution gives x′=(A−BD⁻¹C)x+(c−BD⁻¹e). The algebraic variables are therefore determined by the differential state at every time, not integrated as independent free coordinates.

An augmented matrix exponential handles the constant forcing without requiring the reduced matrix to be invertible. Appending a constant coordinate turns the affine equation into a homogeneous linear system in one extra dimension. This avoids an invalid formula involving an inverse of A−BD⁻¹C when that matrix is singular.

Check both the constraint and the differential equation

For the default scalar values A=0, B=1, C=1, D=1 and zero forcing terms, the constraint is x+z=0. Thus z=−x and x′=−x. Starting with x(0)=1 gives x(t)=exp(−t), z(t)=−exp(−t). At time one the two values are approximately 0.367879 and −0.367879.

Their sum is zero, verifying the algebraic constraint, and the returned derivative equals z, verifying the differential equation. As a second case, setting C=0, D=1, e=−2, A=0, B=1 and c=0 forces z=2 and gives x(t)=x(0)+2t. This illustrates why constant algebraic forcing changes the reduced ODE even when A is zero.

Supply dimensions and consistent initial conditions

If x has n entries and z has m, A is n×n, B is n×m, C is m×n and D is m×m. The vectors c and x(0) have n entries, while e has m. Matching dimensions are necessary before the equations have a defined meaning; adding or removing a zero merely to make a matrix square can change the model.

Only x(0) is entered independently. The calculator derives z(0)=−D⁻¹(Cx(0)+e), ensuring consistency with the constraint. A separate desired z(0) that disagrees would describe incompatible initial data. For physical models, check whether the derived algebraic state also satisfies any additional sign or feasibility restrictions outside these linear equations.

Know what the residual can and cannot certify

The displayed residual measures the computed violation of Cx+Dz+e at the selected time. A small value is a useful algebraic check, but by itself it does not validate the original physical model or reveal every conditioning problem. Nearly singular D can amplify input perturbations even when a computed solution has a small residual.

This is a constant-coefficient, semi-explicit index-one family. If D is singular, elimination is not justified and the problem may need differentiation of constraints, a different variable partition or a higher-index treatment. No pseudoinverse fallback is used to turn such a system into an apparently valid answer. Nonlinear or time-varying constraints likewise require a dedicated DAE solver.

A few questions, answered

How is the initial algebraic state chosen?

It is derived from Cx(0)+Dz(0)+e=0 using invertible D.

Can this solve a higher-index DAE?

No. It supports only the stated constant linear index-one family.

Why is there no independent initial-z field?

For invertible D, the constraint uniquely determines z(0) from x(0). Entering an unrelated value could make the initial conditions inconsistent.

Does a zero constraint residual prove the physical simulation is correct?

No. It checks one algebraic relation for the supplied linear model. Units, conditioning, model assumptions and physical feasibility still need examination.

Find your calculator

Start typing to explore the library.