"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"from __future__ import division\n",
"import math\n",
"import cmath\n",
"#initializing the variables:\n",
"C = 500E-9;# in Farad\n",
"R = 100000;# in Ohm\n",
"V = 50;# in VOlts\n",
"ti = 0.15;# in sec\n",
"tc = 0.08;# in sec\n",
"Vrt = 35;# in Volts\n",
"\n",
" #calculation:\n",
" #Initial current, \n",
"i0 = (V/R)\n",
" #when time t = 150ms current is\n",
"i150 = (V/R)*math.e**(-1*ti/(R*C))\n",
" #capacitor voltage, Vc\n",
"Vc = V*(1 - math.e**(-1*tc/(R*C)))\n",
" #time, t\n",
"tvr = -1*R*C*math.log(Vrt/V)\n",
"\n",
"\n",
"#Results\n",
"print \"\\n\\n Result \\n\\n\"\n",
"print \"\\n initial value of current flowing is \",round(i0*1E3,2),\"mA\"\n",
"print \"\\n current flowing at t = 150ms is \",round(i150*1E6,2),\"uA\"\n",
"print \"\\n value of capacitor voltage at t = 80ms is \",round(Vc,2),\" V\"\n",
"print \"\\n the time after connection when the resistor voltage is 35 V is \",round(tvr*1E3,2),\"msec\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
" Result \n",
"\n",
"\n",
"\n",
" initial value of current flowing is 0.5 mA\n",
"\n",
" current flowing at t = 150ms is 24.89 uA\n",
"\n",
" value of capacitor voltage at t = 80ms is 39.91 V\n",
"\n",
" the time after connection when the resistor voltage is 35 V is 17.83 msec\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
Example 2, page no. 905
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"from __future__ import division\n",
"import math\n",
"import cmath\n",
"#initializing the variables:\n",
"C = 5E-6;# in Farad\n",
"R = 2000000;# in Ohm\n",
"V = 200;# in VOlts\n",
"tc = 20;# in sec\n",
"\n",
" #calculation:\n",
" #capacitor voltage, Vc\n",
"Vc = V*(math.e**(-1*tc/(R*C)))\n",
"\n",
"\n",
"#Results\n",
"print \"\\n\\n Result \\n\\n\"\n",
"print \"\\n value of capacitor voltage at t = 20s is \",round(Vc,2),\" V\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
" Result \n",
"\n",
"\n",
"\n",
" value of capacitor voltage at t = 20s is 27.07 V"
]
}
],
"prompt_number": 2
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
Example 3, page no. 907
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"from __future__ import division\n",
"import math\n",
"import cmath\n",
"#initializing the variables:\n",
"L = 0.05;# in Henry\n",
"R = 5;# in Ohm\n",
"V = 110;# in VOlts\n",
"ti = 0.004;# in sec\n",
"tvr = 0.006;# in sec\n",
"tvl = 0.006;# in sec\n",
"it = 15;# in amperes\n",
"\n",
" #calculation:\n",
" #steady state current i\n",
"i = V/R\n",
" #when time t = 4ms current is\n",
"i4 = (V/R)*(1 - math.e**(-1*ti*R/L))\n",
" #resistor voltage, VR\n",
"VR6 = V*(1 - math.e**(-1*tvr*R/L))\n",
" #inductor voltage, VL\n",
"VL6 = V*(math.e**(-1*tvl*R/L))\n",
" #time, t\n",
"ti = (-1*L/R)*math.log(1 - it*R/V)\n",
"\n",
"\n",
"#Results\n",
"print \"\\n\\n Result \\n\\n\"\n",
"print \"\\n steady state current i is \",round(i,2),\" A\"\n",
"print \"\\n when time t = 4ms current is is \",round(i4,2),\" A\"\n",
"print \"\\n value of resistor voltage at t = 6ms is \",round(VR6,2),\" V\"\n",
"print \"\\n value of inductor voltage at t = 6ms is \",round(VL6,2),\" V\"\n",
"print \"\\n the time after connection when the current is 15 V is \",round(ti,5),\" sec\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
" Result \n",
"\n",
"\n",
"\n",
" steady state current i is 22.0 A\n",
"\n",
" when time t = 4ms current is is 7.25 A\n",
"\n",
" value of resistor voltage at t = 6ms is 49.63 V\n",
"\n",
" value of inductor voltage at t = 6ms is 60.37 V\n",
"\n",
" the time after connection when the current is 15 V is 0.01145 sec"
]
}
],
"prompt_number": 3
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
Example 4, page no. 909
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"from __future__ import division\n",
"import math\n",
"import cmath\n",
"#initializing the variables:\n",
"i = 5;# in Amperes\n",
"L = 2# in Henry\n",
"i1 = 0.2;# in Amperes\n",
"R = 10;# in Ohm\n",
"\n",
" #calculation:\n",
" #time t\n",
"ti = (-1*L/R)*math.log(i1/i)\n",
" #voltage across the resistor is a maximum \n",
"VRm = i*R\n",
"\n",
"\n",
"#Results\n",
"print \"\\n\\n Result \\n\\n\"\n",
"print \"\\n time t for the current in the 2 H inductor to fall to 200 mA is \",round(ti,3),\" sec\"\n",
"print \"\\n max voltage across the resistor is \",VRm,\" V\""
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"\n",
" Result \n",
"\n",
"\n",
"\n",
" time t for the current in the 2 H inductor to fall to 200 mA is 0.644 sec\n",
"\n",
" max voltage across the resistor is 50 V"
]
}
],
"prompt_number": 4
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"