3. Algebraic relations and networks
Why relations come before algorithms
Section titled “Why relations come before algorithms”Many models are networks of simultaneous statements rather than recipes that calculate one variable after another. Conservation at a junction, compatibility between connected parts, and a constitutive law can all constrain the same unknowns. Calling one variable an “input” too early can hide that structure.
Eqiora writes each statement as a residual equal to zero. An equation such as therefore has the residual . The ordering of the symbols does not assign a computational direction.
Learning outcomes
Section titled “Learning outcomes”After this chapter, you should be able to:
- distinguish unknown quantities, prescribed parameters, and relations;
- count unknowns and independent scalar relations in a small model;
- separate conservation from the law that closes a network;
- compile an algebraic
.eqimodel without selecting a solver; and - identify underdetermined, overconstrained, and inconsistent structures.
What fixes the temperature between two layers?
Section titled “What fixes the temperature between two layers?”Imagine two thermal resistances in series between reservoirs at and . The unknown interface temperature is . Each resistance is a lumped relation , where has units kelvins per watt. Assume no energy accumulates at the interface and no heat escapes sideways.
T_h ── [ R₁ ] ── T_m ── [ R₂ ] ── T_c Q̇₁ → Q̇₂ →Conceptual network. Both arrows point from the hot reservoir toward the cold reservoir; steady interface balance requires equal signed powers.
There are three unknowns: , , and . Two constitutive relations and one balance close the problem:
Eliminating the powers gives
For , , , and , predict and . The larger resistance takes the larger temperature drop. The heat-transfer path derives a slab’s resistance from a spatial field rather than assuming it.
The abstract splitter below keeps the same distinction between balance and closure while making the source small enough to inspect at once.
A two-branch split
Section titled “A two-branch split”Let a prescribed amount split into two unknown branch amounts and . Conservation provides one relation,
That relation alone cannot determine both branches. For a symmetric splitter, the constitutive or design assumption supplies the second relation. Substitution gives . The model stores the two relations, not the order in which you eliminated variables to solve them.
Readable Eqiora source
Section titled “Readable Eqiora source”Save this as split.eqi:
// Two unknown branch amounts closed by conservation and an equal-split law.model split() { parameter supplied: 1 = 1; variable branch_a: 1; variable branch_b: 1;
relation conservation { branch_a + branch_b - supplied = 0; } relation equal_split { branch_a - branch_b = 0; }}Use the environment from Get started to check your file:
$ uv run python -c "import eqiora; eqiora.compile(path='split.eqi')"Compilation checks the source and typed expressions. It does not execute this algebraic model or prove that the two residuals are globally independent.
Count before solving
Section titled “Count before solving”For this example:
| Item | Count | Role |
|---|---|---|
| Prescribed parameters | 1 | supplied is known for one model instance. |
| Scalar unknowns | 2 | branch_a and branch_b must be determined. |
| Scalar relations | 2 | conservation and equal split close this particular structure. |
Matching counts are a useful first check, not a guarantee. Two copies of the conservation
relation would still leave the split undetermined. A third relation demanding
branch_a = supplied would contradict equal split when supplied is nonzero.
Independence and consistency depend on relation content, not names or counts.
From equations to networks
Section titled “From equations to networks”In a physical network, a component usually supplies its constitutive relation, while a connection supplies compatibility or conservation across ports. The model is therefore acausal: the assembled relations, not the order in which connections are written, determine which quantities must be solved together.
Once the equations are understood, import the parts
Section titled “Once the equations are understood, import the parts”The electrical counterpart makes reusable components concrete. For two resistors in parallel across ideal voltage , equal voltage across both branches is compatibility, is the component law, and is junction conservation. These roles follow the circuit reasoning in OpenStax, section 10.3.
For an illustrative , , and , the hand prediction is , , and total current . The supplied power is , equal to dissipated in the two resistors. This second check asks about energy as well as charge.
Here is the actual composition. It imports the resistor, source, and ground definitions, then states which ports connect:
import Eqiora.Electrical.Basic.basic as basic;
public component ParallelDc( parameter supply_voltage: kg * m ^ 2 / (s ^ 3 * A), parameter resistance_two: kg * m ^ 2 / (s ^ 3 * A ^ 2), parameter resistance_four: kg * m ^ 2 / (s ^ 3 * A ^ 2)) { instance source: basic.IdealVoltageSource(voltage = supply_voltage); instance resistor_two: basic.Resistor(resistance = resistance_two); instance resistor_four: basic.Resistor(resistance = resistance_four); instance ground: basic.Ground();
connect source.positive, resistor_two.positive, resistor_four.positive; connect source.negative, resistor_two.negative, resistor_four.negative, ground.terminal;}Open the basic component definitions and locate the resistor’s law. Then find the connection statements above: the library supplies the material relation, and the circuit supplies its connections. The import saves retyping because its equations already express the assumptions we derived. The circuits path develops this into a runnable circuit investigation.
Read the result
Section titled “Read the result”Interpret the two residuals against the hand solution . Each must vanish separately: their sum could hide a positive error in one relation and a negative error in the other. The compiler check prepares the source; substitution is what establishes the solution here.
Deliberate failure: remove the closing relation
Section titled “Deliberate failure: remove the closing relation”Delete equal_split while retaining conservation. The source remains readable
and dimensionally consistent, so the current compile check need not diagnose
the missing physical assumption. By hand, one equation constrains two unknowns:
every pair satisfying is possible. The repair is to state a justified
second relation, not to choose an arbitrary solver default.
Successful compilation does not prove that a model is closed or physically meaningful.
Exercises
Section titled “Exercises”- For , list three distinct pairs that satisfy conservation when
equal_splitis absent. - Replace equal split with . Derive both branch amounts without changing the conservation relation.
- Add the relation to the original symmetric model. For which value of are all three relations consistent?
- Give one circuit or flow-network example in which a connection owns conservation and a component owns a constitutive law. Identify every unknown and prescribed parameter.
Exercise guidance
Section titled “Exercise guidance”Exercise 1 has the family ; nonnegative branch amounts would additionally require . Exercise 2 gives and . In exercise 3, consistency requires .
For a further modeling experiment, give the thermal interface a finite heat capacity . Conservation becomes . The algebraic relations for the resistances stay unchanged, but you now need an initial temperature. Explain why steady state recovers the result above.
References
Section titled “References”- Samuel J. Ling, Jeff Sanny, and William Moebs, University Physics, volume 2 (OpenStax, 2016), section 10.3, Kirchhoff’s rules, for current balance, loop compatibility, and independent circuit equations.
- The same book, section 1.6, Mechanisms of heat transfer, for the physical conduction relation developed into a thermal resistance in the heat-transfer path.
Previous: Quantities, dimensions, and units · Back to the series map · Next: Ordinary differential equations