"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"from __future__ import division\n",
"import math\n",
"#initializing the variables:\n",
"R = 1;# in ohms\n",
"\n",
"#calculation\n",
"R1 = 1/(1/R + 1/R + 1/R + 1/R)\n",
"R2 = 2*R*2*R/(4*R)\n",
"R3 = 1/(1/R + 1/R + 1/R) + 1\n",
"R4 = R*R/(2*R) + 2*R\n",
"\n",
"print \"\\n\\nResult\\n\\n\"\n",
"print \"\\n(a)All four in parallel for \",R1,\" ohm\\n\"\n",
"print \"\\n(b)Two in series, in parallel with another two in series for\",R2,\" ohm\\n\"\n",
"print \"\\n(c)Three in parallel, in series with one for \",round(R3,2),\" ohm\\n\"\n",
"print \"\\n(d)Two in parallel, in series with two in series for \",R4,\" ohm\\n\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
"Result\n",
"\n",
"\n",
"\n",
"(a)All four in parallel for 0.25 ohm\n",
"\n",
"\n",
"(b)Two in series, in parallel with another two in series for 1.0 ohm\n",
"\n",
"\n",
"(c)Three in parallel, in series with one for 1.33 ohm\n",
"\n",
"\n",
"(d)Two in parallel, in series with two in series for 2.5 ohm\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"from __future__ import division\n",
"import math\n",
"#initializing the variables:\n",
"#series connection\n",
"n = 3;# no. of identical lamp\n",
"Vt = 150;# in volts\n",
"\n",
"#calculation:\n",
"V = Vt/3# Since each lamp is identical, then V volts across each.\n",
"\n",
"print \"\\n\\nResult\\n\\n\"\n",
"print \"\\n a)Voltage across each resistor = \",V,\" Volts(V)\\n\"\n",
"print \"\\n b)If lamp C fails, i.e., open circuits, no current will flow and lamps A and B will not operate.\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
"Result\n",
"\n",
"\n",
"\n",
" a)Voltage across each resistor = 50.0 Volts(V)\n",
"\n",
"\n",
" b)If lamp C fails, i.e., open circuits, no current will flow and lamps A and B will not operate."
]
}
],
"prompt_number": 21
}
],
"metadata": {}
}
]
}