Navigation Bar

Article: xkcd Resistor Network

Back to Articles Index

A bit of fun, this time. You may've seen this whimsical diagram before:

xkcd: Circuit Diagram

That jumble of resistors?

It's about 3/4 ohm.



First, we label the nodes. These are assigned roughly in rows, left to right, top to bottom. Note that nodes 5 and 10 are really the same thing, so we'll join them with an inconsequential value resistor.

A Contrived Resistor Network

Drawn up, with designators assigned to the resistors, and rearranged with square lines and even spacing, gives this schematic: xkcd Resistor Network.SchDoc

xkcd: Circuit Diagram

There is also an inconsequential resistor to GND, because SPICE requires a ground reference node.

Some features of the overall structure are apparent:

To run the simulation, open the schematic in Altium Designer (or—I'm not intimately familiar with the free Circuit Studio, but I understand it can import AD files, and if they left the simulator in, this should all go pretty much the same!). In the menus, select: Design - Simulate - Mixed Sim (keyboard shortcut D, S, S). This opens the simulation dialog. Under General Setup, select "V1#branch" from the Available Signals list. Press ">" to push it over to the Active Signals list. Enable the Operating Point Analysis and disable other analyses. (Custom parameters under Advanced Options will not be necessary here.) Press OK. This should pop up:

Simulation Result

1.337A flows out from the source (hence, negative). The source is 1.0V, therefore the load resistance is 1 / 1.337 = 0.7479Ω. About three-quarters of an ohm.

But a numerical solution is always so unsatisfying (especially one that's only as accurate as a slide rule, or as building it physically!). Wouldn't it be cool to get the exact value (a rational number)? There's a certain magic about this: the structure (down to symmetries) uniquely defines the pattern of digits, the prime factors, all sorts of cool number-theoretic properties of the result. An infinite network can even have irrational or transcendental values!

There is a wonderful calculator: Resistor Network Solver by Kirill Kryukov. You enter a simplified netlist, and not only does it solve it numerically, but it does so with "infinite" precision (showing the rational result). And you get a graph showing the nodes, and resistances linking them! (Notice I'm late to the party: this network is already provided as an example!)

The netlist format is weird, unfortunately: you name the nodes alphabetically, and the resistances (numerical) between node names. You can keep going, by extending the statement with another branch to another node, or starting over by entering another node. So, as far as I know, "a 1 b 1 c" is equivalent to "a 1 b / b 1 c" (indicating an optional newline with '/'; white space is simply collapsed together). Curiously, the graph drawing engine parses these differently, putting nodes and edges in different positions, but still drawing the same graph.

It should be sufficient to convert SPICE netlists into this format by: 1. stripping the designator and any model information, 2. renaming any numerically named nodes to an alphanumeric name (numerical net names can't be disambiguated as net or value), 3. moving the value parameter inbetween the node names, and 4. converting fractional suffixes (m, u, n, p, f) to decimal (1m → 0.001) or fraction (1u → 1/1000000) format. (Multiplicative suffixes are okay: k = 1000, m = 1000000, etc.) (Note that, since the computation is rational, there is no loss of accuracy with fractional inputs!)

Interestingly, his example also shows the "big node" split: nodes o (my 5) and l (my 10) are connected with a 0-ohm jumper.


Back to Articles Index


Copyright Notice