"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"'''Power Dissipation and accuracy of result'''",
"",
"#variable Declaration",
"i=10*10**-3 # current in A",
"R=1000.0 # resistance in ohm",
"P=(i**2)*R # Power",
"err_R=10.0 # Error in Resistance measurement",
"err_I=(2.0/100)*25*100/10 # Error in current measurement",
"",
"#calculation",
"err_I2=2*err_I",
"err_p=err_I2+err_R",
"",
"#Result",
"print('%% error in I^2 = \u00b1 %d%%\\n%% error in Power = \u00b1 %d%%'%(err_I2,err_p))"
],
"language": "python",
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"% error in I^2 = \u00b1 10%",
"% error in Power = \u00b1 20%"
]
}
],
"prompt_number": 2
},
{
"cell_type": "markdown",
"source": [
"
Example 8.3, Page Number: 508
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"'''max and min levels of input supply current'''",
"",
"#variable Declaration",
"i1=37.0 # current in branch 1 ",
"i2=42.0 # current in branch 2",
"i3=13.0 # current in branch 3",
"i4=6.7 # current in branch 4",
"",
"#Calculation",
"Imax=(i1+i2)+(i1+i2)*(3.0/100)+(i3+i4)+(i3+i4)*(1.0/100)",
"Imin=(i1+i2)-(i1+i2)*(3.0/100)+(i3+i4)-(i3+i4)*(1.0/100)",
"",
"#result",
"print('Maximum level of total supply current = %.3f mA'%Imax)",
"print('\\nMinimum level of total supply current = %.3f mA'%Imin)"
],
"language": "python",
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Maximum level of total supply current = 101.267 mA",
"",
"Minimum level of total supply current = 96.133 mA"
]
}
],
"prompt_number": 3
},
{
"cell_type": "markdown",
"source": [
"
"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"'''temperature and altitude calculation from first order thermometer placed in balloon'''",
"",
"#calculations",
"R=0.15*10/50 # Temperature gradient",
"K=1.0 # constant",
"tow=15.0 # time constant ",
"",
"#Calculations",
"deg=K*R*tow",
"",
"#(i)",
"a=15-deg",
"",
"#(ii)",
"alt_red=deg*50.0/0.15",
"h=5000-alt_red",
"",
"#result",
"print('(i)The actual temperature when instrument reads 15\u00b0C is %.2f\u00b0C'%a)",
"print('\\n The true temperature at 5000 metres = %.2f '%a)",
"print('\\n(ii)\\nThe true altitude at which 15\u00b0C occurs is %d metres'%h)"
],
"language": "python",
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"(i)The actual temperature when instrument reads 15\u00b0C is 14.55\u00b0C",
"",
" The true temperature at 5000 metres = 14.55 ",
"",
"(ii)",
"The true altitude at which 15\u00b0C occurs is 4850 metres"
]
}
],
"prompt_number": 10
}
]
}
]
}