Resistor mesh: Difference between revisions
Content added Content deleted
Line 1,272: | Line 1,272: | ||
=={{header|Mathematica}}== |
=={{header|Mathematica}}== |
||
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 points. |
||
{{works |
{{works with|Mathematica|8.0}} |
||
<lang mathematica> |
<lang mathematica> |
||
resistanceGraph[g_, prec_:$MachinePrecision]:= |
resistanceGraph[g_, prec_:$MachinePrecision]:= |
||
Line 1,302: | Line 1,302: | ||
{{works with|Mathematica|9.0}} |
{{works with|Mathematica|9.0}} |
||
Alternative implementation using <b>GridGraph</b>. |
|||
<lang mathematica>graphresistor[g_, a_, b_] := |
<lang mathematica>graphresistor[g_, a_, b_] := |
||
LinearSolve[ |
LinearSolve[ |