A circuit can be viewed as having nodes, a ground node, and branches; where a node is a junction where current can split or combine, and a branch represents a path in the circuit containing one or more components in series connecting two nodes. This results in a directed graph where corresponds to nodes and corresponds to branches. The graph can be encoded as an incidence matrix by denoting for the source of a directed edge, and for the destination as shown below:

Let denote the vector of signed branch currents, denote the vector of branch voltages, and denote the vector of node voltages. Then it follows from Kirchoff’s circuit laws that
That is, the algebraic sum of the current entering/leaving node is zero and the voltage across a branch is given by the difference between the voltages at either end.
Given the above, we describe the relation between and through device equations. These equations could be linear, non-linear, or differential equations. For now we focus on two types:
- Type 1 devices are defined by the equation , where is a matrix, is a vector and is the number of type 1 devices. Examples include conductances, constant current sources, and voltage-controlled current sources.
- Type 2 devices are defined by the equation , where and are matrices and is a vector. Examples include constant voltage sources and current-controlled current/voltage sources.
We rearrange our incidence matrix such that so that () is the submatrix corresponding to Type 1 (Type 2) devices. Then we can describe the circuit by the following system of equations:
Combining equations together gives us the modified nodal formulation (MNA):
Notice that the MNA equation only has variables for the node voltages, , and the currents through the Type 2 elements, . If there are no Type 2 elements, then this simplifies to and is called the nodal formulation.
Non-linear device equations are often captured by a first-order Taylor series expansion. For instance a device of the form can be approximated by taking the first-order Taylor series about the point :
The expansion point is updated identical to Newton’s method. A more general framework combines all devices, linear and nonlinear, using the Jacobian:
Devices can also be described by differential equations; in such a case, one may use methods such as Euler’s method to numerically approximate their solution. This all cumulates into the following simulation pipeline:
- At each iteration :
- For the current time step , convert the differential equations into nonlinear and linear equations
- Linearize nonlinear equations to obtain a system of linear equations
- Solve the system of linear equations
- If we have simulated the desired time period, stop. Otherwise, increment the current time step and continue to iteration .