Resistor mesh: Difference between revisions

Content added Content deleted
Line 1,273: Line 1,273:
{{works with|Mathematica|8.0}}
{{works with|Mathematica|8.0}}


<break>
Use <b>KirchhoffMatrix</b>, <b>PseudoInverse</b>, and <b>GridGraph</b> to compute the resistance between <em>any</em> two points.

Use <b>KirchhoffMatrix</b>, <b>PseudoInverse</b>, and <b>GridGraph</b> to compute the resistance between <em>any</em> two nodes in an <em>m</em> by <em>n</em> grid to the desired precision.


<lang mathematica>resistanceGraph[g_, prec_:$MachinePrecision]:=
<lang mathematica>resistanceGraph[g_, prec_:$MachinePrecision]:=
Line 1,303: Line 1,305:


{{works with|Mathematica|9.0}}
{{works with|Mathematica|9.0}}

Alternative implementation using <b>GridGraph</b>.
Alternative implementation using <b>GridGraph</b>.

<break>

<lang mathematica>graphresistor[g_, a_, b_] :=
<lang mathematica>graphresistor[g_, a_, b_] :=
LinearSolve[
LinearSolve[