Talk:Resistor mesh: Difference between revisions

Content added Content deleted
Line 12: Line 12:
:: The general idea is this: given a circuit and some input, what's the response of the system? For this particular problem, the input is two voltage values on nodes A and B, and the response is the voltage values on every other node. By Ohm's law, if two neighoring nodes have voltages <math>V_i</math> and <math>V_j</math>, then the current flowing from i to j is <math>(V_i - V_j)/R_{ij}</math> where R is the resistance (=1 here). Given a set of voltages on the nodes, you can calculate net current flow out of each node; to be a valid solution, the total current out of each node must be zero unless the node is an electrode (i.e. given a fixed voltage as part of boundary condition). The C code gives A 1 volt and B -1 volt, calculates what voltage each other node has, then calculates the current I flowing out of A and into B (they must be equal); the resistance is again given by Ohm's law: R = 2/I.
:: The general idea is this: given a circuit and some input, what's the response of the system? For this particular problem, the input is two voltage values on nodes A and B, and the response is the voltage values on every other node. By Ohm's law, if two neighoring nodes have voltages <math>V_i</math> and <math>V_j</math>, then the current flowing from i to j is <math>(V_i - V_j)/R_{ij}</math> where R is the resistance (=1 here). Given a set of voltages on the nodes, you can calculate net current flow out of each node; to be a valid solution, the total current out of each node must be zero unless the node is an electrode (i.e. given a fixed voltage as part of boundary condition). The C code gives A 1 volt and B -1 volt, calculates what voltage each other node has, then calculates the current I flowing out of A and into B (they must be equal); the resistance is again given by Ohm's law: R = 2/I.
:: Of course the interesting part is how to get the voltage values, and there are multiple ways to do it. The C code just give the circuit some arbitrary values initially, then at each iteration calculates how much voltage difference is needed on each node to locally sastisfy the current flow constraint on that node, and adds it onto the voltage. For this task it converges and pretty quickly at that. --[[User:Ledrug|Ledrug]] 15:45, 29 August 2011 (UTC)
:: Of course the interesting part is how to get the voltage values, and there are multiple ways to do it. The C code just give the circuit some arbitrary values initially, then at each iteration calculates how much voltage difference is needed on each node to locally sastisfy the current flow constraint on that node, and adds it onto the voltage. For this task it converges and pretty quickly at that. --[[User:Ledrug|Ledrug]] 15:45, 29 August 2011 (UTC)
:::Given the problem size, even Gauss pivoting will do. Now, for a larger circuit, you would simply use a sparse symmetric solver, and there are many good ones already written. Maybe conjugate gradient would be a nice starting point. See also Maxima solution for an exact value. At least it will help checking other methods ;-) [[User:Capra Hircus|Capra Hircus]] 11:11, 28 August 2012 (UTC)