Resistance calculator: Difference between revisions

Content added Content deleted
No edit summary
Line 17: Line 17:
* Infix: ((((R8 + R10) * R9 + R7) * R6 + R5) * R4 + R3) * R2 + R1
* Infix: ((((R8 + R10) * R9 + R7) * R6 + R5) * R4 + R3) * R2 + R1
* RPN: 10 2 + 6 * 8 + 6 * 4 + 8 * 4 + 8 * 6 +
* RPN: 10 2 + 6 * 8 + 6 * 4 + 8 * 4 + 8 * 6 +
* Voltage = 18.0 V
== Output ==
== Output ==
* Voltage = 18.0 V
* 10.000 ohms in the upper left corner is the equivalent resistance.
* 10.000 ohms in the upper left corner is the equivalent resistance.
* The first operation is 10 + 2 = 12 which can be found in the three middle rows.
* The first operation is 10 + 2 = 12 which can be found in the three middle rows.
Line 43: Line 43:
6.000 10.800 1.800 19.440 | r
6.000 10.800 1.800 19.440 | r


=={{header|Python}}==
;Python RPN
<lang python>
<lang python>
# RPN
class Resistor :
class Resistor :
def __init__(self, resistance, a=None, b=None, symbol='r'):
def __init__(self, resistance, a=None, b=None, symbol='r'):
Line 93: Line 92:
</lang>
</lang>


=={{header|Python}}==
;Python Infix
<lang python>
<lang python>
# Infix
class Resistor :
class Resistor :
def __init__(self, resistance, a=None, b=None, symbol='r') :
def __init__(self, resistance, a=None, b=None, symbol='r') :
Line 138: Line 136:
</lang>
</lang>


=={{header|CoffeeScript}}==
;CoffeeScript RPN
<lang coffeescript>
<lang coffeescript>
nd = (num) -> num.toFixed(3).padStart 8
nd = (num) -> num.toFixed(3).padStart 8