I just did my physics exams a few hours ago hoping to be free from circuit diagrams, resistors and objects colliding into each other. And here I am looking at this comic and my mind thinks, V=IR solve for R. Randall Get Out of My Head

Assuming I didn't mess anything up the resistor blob comes out to 1.3141 Ohms... And now that I have been adequately nerd sniped by Randall, I'm going to sleep. Night all.

They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety. - Benjamin Franklin

pyroman wrote:Assuming I didn't mess anything up the resistor blob comes out to 1.3141 Ohms... And now that I have been adequately nerd sniped by Randall, I'm going to sleep. Night all.

I get precisely 167294/195327 ohms. That's approximately .856481694798978123864...

(Apparently I didn't resist the temptation. Thoroughly sniped.)

EDIT: Missed the missing resistor, see below.

Last edited by hthall on Wed Apr 21, 2010 7:27 am UTC, edited 1 time in total.

Look at me, still talking when there's Science to do.

# The circuit resembles: # | # 0-----4 # /|\ /| # / | \ / | # 1--2 3 | # /| | /|\ \ # / | |/ | \ | # 5 | X | \| # |\ | /| / || # | 7+- |/ || # |/ 8--2--9--10 # 6 | /|\ | / # \ |/ | \|/ # 11--13-12 # | # numbers represent nodes, all lines are resistors, except the entrance and exit wires, # and the line between the two "2" nodes, which is just a wire # - that's why there's two "2" nodes (they're really the same node) # + or X represents two wires crossing without a node

# Adjacency matrix for this graph: adj_matrix = [ [0,1,1,1,1,0,0,0,0,0,0,0,0,0], [1,0,1,0,0,1,0,0,1,0,0,0,0,0], [1,1,0,1,0,0,0,0,1,1,0,1,1,1], [1,0,1,0,1,0,0,1,0,0,1,0,0,0], [1,0,0,1,0,0,0,0,0,0,1,0,0,0], [0,1,0,0,0,0,1,1,0,0,0,0,0,0], [0,0,0,0,0,1,0,1,0,0,0,1,0,0], [0,0,0,1,0,1,1,0,0,0,0,0,0,0], [0,1,1,0,0,0,0,0,0,0,0,1,0,0], [0,0,1,0,0,0,0,0,0,0,1,0,1,0], [0,0,0,1,1,0,0,0,0,1,0,0,1,0], [0,0,1,0,0,0,1,0,1,0,0,0,0,1], [0,0,1,0,0,0,0,0,0,1,1,0,0,1], [0,0,1,0,0,0,0,0,0,0,0,1,1,0], ] # sanity checks if adj_matrix != [[adj_matrix[i][j] for i in xrange(len(adj_matrix))] for j in xrange(len(adj_matrix[0]))]: raise "adj_matrix isn't reflexive" if [len([j for j in i if j]) for i in adj_matrix] != [4,4,8,5,3,3,3,3,3,3,4,4,4,3]: raise "degrees aren't as expected"

# build linear equations # since every resistor has the same resistance, this is simple - each node must be the average of its neighbours # Build linear equations as Ax=b, then find x=A^-1 b A = [] b = [] for n,i in list(enumerate(adj_matrix))[1:-1]: # loop through the nodes that aren't our start and end nodes i = i[:] # copy list i[n] = -len([j for j in i if j]) A.append(i) b.append(0) # We've just added "sum of all adjacent nodes - n*this node = 0", which is the same as saying this node is the average if its neighbours # Now add two equations for our fixed nodes A.append([1] + [0] * (len(adj_matrix) - 1)) b.append(1) A.append([0] * (len(adj_matrix) - 1) + [1]) b.append(0)

# sanity check if len(A) != len(A[0]): raise "A isn't square"

# Turn our lists of integers into rationals, for exact divisions A = [[Fraction(j) for j in i] for i in A] b = [Fraction(i) for i in b]

#solve our equations by Gauss-Jordan for i in xrange(len(A)): x = A[i][i] A[i] = [j/x for j in A[i]] b[i] = b[i]/x for j in xrange(i+1,len(A)): x = A[j][i] A[j] = [l - x*k for k,l in zip(A[i],A[j])] b[j] = b[j] - x*b[i] for i in xrange(len(A)-1, -1, -1): for j in xrange(i): x = A[j][i] A[j] = [l - x*k for k,l in zip(A[i],A[j])] b[j] = b[j] - x*b[i]

# b is now a vector of the voltage at each node - need to find the current going in the entrance and out the exit # since our resistance on each link is 1 ohm, the current through a resistor is simply the difference of the voltages at each end

# The net current at any intermediate node should be 0 for node in xrange(1,len(A)-1): current = 0 for i in xrange(len(A)): if adj_matrix[node][i]: current += b[node] - b[i] if current != 0: raise "Current at node %d isn't zero" % node # find the node going in the entrance and the current going out the exit in_current = 0 for i in xrange(len(A)): if adj_matrix[0][i]: in_current += b[0] - b[i] out_current = 0 for i in xrange(len(A)): if adj_matrix[-1][i]: out_current += b[i] - b[-1] if in_current != out_current: raise "Entrance and exit currents aren't equal"

# Our test voltage was 1V, so our net resistance is 1/current print "Equivalent resistance: %s = %f" % (1/in_current,1/in_current)

The magic blue smoke, 120 ohm or to taste resistor and the moral rectifier all made me laugh heartily. I have an instrumentation exam on Monday and I pretty much have to design circuits like the rectifier and choose resistor values using the "to taste" method. I didn't get into Mechanical Engineering for this...

phlip wrote:My result for the mess of resistors is 25265/33783 = 0.747861 Ohms.

Oops, I missed the one connection without a resistor. I ran my Maple code again and I also get 25265/33783.

In this case, the adjacency matrix is also the matrix of conductances (except that the diagonal should be infinite). From this matrix you can eliminate any column and the corresponding row by taking their outer product (column vector times row vector), dividing it by their common sum (not counting that diagonal entry), and adding the result to the original matrix before crossing out that row and column. Once you have eliminated everything down to a 2 x 2 matrix, the off-diagonal entry is the reciprocal of the resistance between those two nodes.

Look at me, still talking when there's Science to do.

# The circuit resembles: # | # 0-----5 # /|\ /| # / | \ / | # 1--2 4 | # /| | /|\ \ # / | |/ | \ | # 6 | X | \| # |\ | /| / || # | 8+- |/ || # |/ 9--3-10--11 # 7 | /|\ | / # \ |/ | \|/ # 12--14-13 # | # numbers represent nodes, all lines are resistors, except the entrance and exit wires # The line between 2 and 3 is a wire in the comic, but is being treated as a resistor here as an illustration # + or X represents two wires crossing without a node

# Adjacency matrix for this graph: adj_matrix = [ [0,1,1,0,1,1,0,0,0,0,0,0,0,0,0], [1,0,1,0,0,0,1,0,0,1,0,0,0,0,0], [1,1,0,1,0,0,0,0,0,0,0,0,0,0,0], [0,0,1,0,1,0,0,0,0,1,1,0,1,1,1], [1,0,0,1,0,1,0,0,1,0,0,1,0,0,0], [1,0,0,0,1,0,0,0,0,0,0,1,0,0,0], [0,1,0,0,0,0,0,1,1,0,0,0,0,0,0], [0,0,0,0,0,0,1,0,1,0,0,0,1,0,0], [0,0,0,0,1,0,1,1,0,0,0,0,0,0,0], [0,1,0,1,0,0,0,0,0,0,0,0,1,0,0], [0,0,0,1,0,0,0,0,0,0,0,1,0,1,0], [0,0,0,0,1,1,0,0,0,0,1,0,0,1,0], [0,0,0,1,0,0,0,1,0,1,0,0,0,0,1], [0,0,0,1,0,0,0,0,0,0,1,1,0,0,1], [0,0,0,1,0,0,0,0,0,0,0,0,1,1,0], ] # sanity checks if adj_matrix != [[adj_matrix[i][j] for i in xrange(len(adj_matrix))] for j in xrange(len(adj_matrix[0]))]: raise "adj_matrix isn't reflexive" if [len([j for j in i if j]) for i in adj_matrix] != [4,4,3,7,5,3,3,3,3,3,3,4,4,4,3]: raise "degrees aren't as expected"

# build linear equations # since every resistor has the same resistance, this is simple - each node must be the average of its neighbours # Build linear equations as Ax=b, then find x=A^-1 b A = [] b = [] for n,i in list(enumerate(adj_matrix))[1:-1]: # loop through the nodes that aren't our start and end nodes i = i[:] # copy list i[n] = -len([j for j in i if j]) A.append(i) b.append(0) # We've just added "sum of all adjacent nodes - n*this node = 0", which is the same as saying this node is the average if its neighbours # Now add two equations for our fixed nodes A.append([1] + [0] * (len(adj_matrix) - 1)) b.append(1) A.append([0] * (len(adj_matrix) - 1) + [1]) b.append(0)

# sanity check if len(A) != len(A[0]): raise "A isn't square"

# Turn our lists of integers into rationals, for exact divisions A = [[Fraction(j) for j in i] for i in A] b = [Fraction(i) for i in b]

#solve our equations by Gauss-Jordan for i in xrange(len(A)): x = A[i][i] A[i] = [j/x for j in A[i]] b[i] = b[i]/x for j in xrange(i+1,len(A)): x = A[j][i] A[j] = [l - x*k for k,l in zip(A[i],A[j])] b[j] = b[j] - x*b[i] for i in xrange(len(A)-1, -1, -1): for j in xrange(i): x = A[j][i] A[j] = [l - x*k for k,l in zip(A[i],A[j])] b[j] = b[j] - x*b[i]

# b is now a vector of the voltage at each node - need to find the current going in the entrance and out the exit # since our resistance on each link is 1 ohm, the current through a resistor is simply the difference of the voltages at each end

# The net current at any intermediate node should be 0 for node in xrange(1,len(A)-1): current = 0 for i in xrange(len(A)): if adj_matrix[node][i]: current += b[node] - b[i] if current != 0: raise "Current at node %d isn't zero" % node # find the node going in the entrance and the current going out the exit in_current = 0 for i in xrange(len(A)): if adj_matrix[0][i]: in_current += b[0] - b[i] out_current = 0 for i in xrange(len(A)): if adj_matrix[-1][i]: out_current += b[i] - b[-1] if in_current != out_current: raise "Entrance and exit currents aren't equal"

# Our test voltage was 1V, so our net resistance is 1/current print "Equivalent resistance: %s = %f" % (1/in_current,1/in_current)

So yeah, that's where you messed up... I'm pretty sure my answer is right.

[edit] Ninjaed...

hthall wrote:In this case, the adjacency matrix is also the matrix of conductances (except that the diagonal should be infinite). From this matrix you can eliminate any column and the corresponding row by taking their outer product (column vector times row vector), dividing it by their common sum (not counting that diagonal entry), and adding the result to the original matrix before crossing out that row and column. Once you have eliminated everything down to a 2 x 2 matrix, the off-diagonal entry is the reciprocal of the resistance between those two nodes.

Yeah, I know there are other ways of manipulating this... I just went with the flat adjacency matrix 'cause it was the easiest to type, and then turned that into the system of linear equations (via Kirchoff's current law) 'cause that's the systematic method I'm most familiar with... which meant I could code it quicker (I could write Gauss-Jordan in my sleep), and have a better chance of being the first one to get the answer... 'cause minor bragging rights are more important than elegance.

Last edited by phlip on Wed Apr 21, 2010 7:31 am UTC, edited 2 times in total.

So, I wasted two sheets of paper doing delta-Y transforms and got about half way through, then gave up and made a spice simulation that just hooked the whole mess up to a 12V source and measured the current going through the source... much faster. I got about 0.77Ohms

edit: so I didn't see the python solutions until after I was finished and had posted. Glad i was close.

Last edited by mu-zak on Wed Apr 21, 2010 7:32 am UTC, edited 1 time in total.

nathanst wrote:"Brown, Blue, Orange" 1,6,x1000, (no tolerance band) or (no initial band),1,X1000000,+/-3%

is there a joke here?

long, long (long, long, long...) time since I did this stuff, but from memory it's the tolerance band that's optional, so that would be a 16k resistor (which I think is one of the standard values). And I seem to recall that 10% tolerance is the default.

mu-zak wrote:So, I wasted two sheets of paper doing delta-Y transforms and got about half way through, then gave up and made a spice simulation that just hooked the whole mess up to a 12V source and measured the current going through the source... much faster. I got about 0.77Ohms

edit: so I didn't see the python solutions until after I was finished and had posted. Glad i was close.

I also did a spice simulation and ended up with about 0.758 ohms. More than good enough for 2 minutes worth of work I say.

I don't know which to be more surprised at: the lack of a "Magic" / "More Magic" switch in the schematic, or the fact that it's been three pages with nobody mentioning it. Tsk tsk tsk.

EDIT: Dammit, ninja'd!

The parts that really burnt my cheese were "May use actual sandal instead", "Pull this wire really tight", and "Not a resistor; wire just does this".

EE 201 happens to be the class number for introductory EE for non-EE majors at Cal Poly as well. I took it as a technical elective.

Stephen Hawking: Great. The entire universe was destroyed. Fry: Destroyed? Then where are we now? Al Gore: I don't know. But I can darn well tell you where we're not—the universe!

You know, I really wish this comic had more nerd inside jokes, instead of just drawing "electric eels" and stuff... I mean, the point of xkcd is so you can boast that you are nerdy... if it becomes a regular comic, I don't see what makes it different from the googol other webcomics out there....

I got probably 20% of the jokes in there and have always considered myself nerdy (nerdish? nerdlike? nerdesque?). My point being, there are many types of "nerds." I count myself among their ranks but am NOT an engineer nor an electrician.

Wait a minute. If you have to be a "nerd' to get the jokes, maybe I'm a geek. Poindexter? Melvin?

Please. If I'm going to be disincluded from the nerd category because I don't get these jokes, just don't consider me "normal!"

King of all the "nerds" replying here is the guy who said, "I think I'll work out the equivalent resistance on the train tomorrow." WINNER!

pretty sure that Randall posted this, sat back with a chronometer, and counted the time to see the first post trying to resolve this...maybe there's a poll... some betting.... yeah... and the "one mile=one kilometer" joke is for THOSE COUNTRIES that still uses miles...

Don't protest against my methods, if you want to continue living of my results