solving a resistor graph (in python)

Discussion in 'Programmer's Corner' started by dadaista, Jan 29, 2007.

  1. dadaista

    Thread Starter New Member

    Jan 29, 2007
    Hi, I'm working on a problem which has as physical equivalent a resistor graph. I need a piece of code (possibly in python but other languages may help anyway) which from two arbitrary points of the graph computes the resulting resistance (only passive resistors).
    Thanx for any clue.
  2. sci-3d

    Well-Known Member

    Aug 22, 2006
    Please specify more about what equation or theory are. Is it Ohm’s Law?

    To plot graph with Python, you need matplotlib which can gives you a beautiful graph.
  3. dadaista

    Thread Starter New Member

    Jan 29, 2007
    Yes. Simply Ohm law. What I need is just the computing of resistance. I don't need any plot but just an algorithm. The input data set is in the form (an example follows with only 4 nodes)

    node | node | resistor
    1 2 10
    1 3 2
    1 4 400
    2 3 15
    2 4 infinity
    3 4 infinity

    For instance nodes 2 and 4 are not directly connected and the resistor value is infinity (open circuit) but the resistance between 2 and 4 can be computed as sum and parallel resistance of other resistors.

    so I need to compute the Rij where i and j can be arbitrary nodes and where i and j can assume very large values (from 10^3 to 10^6) In other words "how to reduce the whole circuit to a simple thevenin equivalent resistor (no active components in my model)?"