4
$\begingroup$

Let's assume I have n identical resistors. I can connect them either in series or in parallel (let's disregard bridge connections for now). Now, I want to list all possible connections along with their equivalent resistances.

For example:

"pp" represents a parallel connection.
"ss" represents a series connection.

  1. With one resistor, we have just "R."
  2. With two resistors, we can have:
    {R pp R, R/2} - Two resistors in parallel, equivalent resistance is R/2.
    {R ss R, 2R} - Two resistors in series, equivalent resistance is 2R.
  3. For three resistors, we get:
    {R pp R pp R, R/3} - Three resistors in parallel, equivalent resistance is R/3.
    {(R pp R) ss R, 3R/2} - Two resistors in parallel, then in series with one resistor, equivalent resistance is 3R/2.
    {(R ss R) pp R, 2R/3} - Two resistors in series, then in parallel with one resistor, equivalent resistance is 2R/3.

I would like to present this information in a way that allows me to reconstruct the circuit and know the equivalent resistance of the circuit. Do you have any suggestions on how to achieve this for any number of resistors?

EDIT:

These are the formulas for resistors in series or in parallel:

The equivalent resistance of resistors in series is calculated by adding their individual resistances: R1 ss R2 ss R3 ss ... Rn = R1 + R2 + R3 + ... + Rn

The equivalent resistance of resistors in parallel is determined by taking the reciprocal of the sum of the reciprocals of their individual resistances: R1 pp R2 pp R3 pp ... Rn = (1/R1 + 1/R2 + 1/R3 + ... + 1/Rn)^-1

I want to find the minimum number of resistors together with the circuit connections to get a given equivalent resistance value. This is a related post: https://math.stackexchange.com/questions/2160766/how-many-resistors-are-needed

$\endgroup$

2 Answers 2

6
$\begingroup$
Clear["Global`*"];
n = 4;
rs = Table[R, n];
ts = Tuples[{p, s}, {n - 1}];
combs = Riffle[rs, #] & /@ ts;
eqvres = First@FixedPoint[
      SequenceReplace[#
        , {{h___, x_, p, y_, k___} :> Sequence[h, (x y)/(x + y), k]
         , {h___, x_, s, y_, k___} :> Sequence[h, x + y, k]
         }] &, #] & /@ combs;

Visualization

Transpose[{combs, eqvres}] /. { p -> "∥", 
    s -> "≈"} // Map[MapAt[Row, #, {1}] &] // 
 Grid[#, Alignment -> Center, ItemSize -> {Automatic, 2}, 
   Dividers -> All] &

enter image description here

$\endgroup$
12
  • $\begingroup$ I think this is above my level but it works, nice visualization and much faster than Domen's version. $\endgroup$
    – emnha
    Sep 25 at 14:18
  • $\begingroup$ For large n such as 17 it is still slow. I don't know how long it would take. $\endgroup$
    – emnha
    Sep 25 at 14:25
  • 2
    $\begingroup$ What is your application? You may want to contact Analog Insydes if symbolic circuit modeling and analysis is what you are looking for. $\endgroup$
    – Syed
    Sep 25 at 14:30
  • $\begingroup$ I want to find the minimum number of resistors (together with the circuit connections) math.stackexchange.com/questions/2160766/… $\endgroup$
    – emnha
    Sep 25 at 14:32
  • 2
    $\begingroup$ Put your intended application and this link in the post and it will get more visibility. $\endgroup$
    – Syed
    Sep 25 at 14:40
6
$\begingroup$

You can represent a circuit with binary trees containing two binary operators, p and s. For example, two resistors in series, then in parallel with one resistor:

p[R, s[R, R]] 

Now we define a function for calculating the equivalent resistance:

eq[c_] := c //. {p[R1_, R2_] :> 1/(1/R1 + 1/R2), s[R1_, R2_] :> R1 + R2}

eq[p[R, s[R, R]]]
(* 2R/3 *)

To get all possible circuits, use Groupings. For example, all possible circuit resistances for three equivalent resistors with resistance $R$:

Groupings[{R, R, R}, {p -> {2, Orderless}, s -> {2, Orderless}}]
(* {p[p[R, R], R], p[s[R, R], R], s[p[R, R], R], s[s[R, R], R]} *)

eq /@ %
(* {R/3, (2 R)/3, (3 R)/2, 3 R} *)

For higher $n$, however, we will also get some circuits that have the same equivalent resistance. We can use DeleteDuplicatesBy to remove them:

allCircuits[n_] := 
 DeleteDuplicatesBy[
  Groupings[Table[R, n], {p -> {2, Orderless}, s -> {2, Orderless}}], eq]

This method, however, is still inefficient for larger $n$ because it first enumarates all possible circuits (the number grows as OEIS A248748), then remove duplicates.

The number of possible circuits with unique equivalent circuits grows as:

Table[Length[allCircuits[n]], {n, 1, 10}]
(* {1, 2, 4, 9, 22, 53, 131, 337, 869, 2213} *)

which you can read more about in OEIS A048211.

$\endgroup$
2
  • $\begingroup$ +1, nice work. That solved my problem. Just one more question if that can be done. Because all resistors are same, so there are some duplcates such as s[s[R,R],R],s[R,s[R,R]] ,etc, would it be possible to delete duplicates? $\endgroup$
    – emnha
    Sep 25 at 13:26
  • 1
    $\begingroup$ @emnha, please see my update. Also, I strongly suggest reading OEIS A048211 and the links therein, which might help answering your question. $\endgroup$
    – Domen
    Sep 27 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.