#pg 8
#Find the range of tolerance
#soltion
#given
#color coding
orange=3.#
gold=5.#
yellow=4.#
violet=7.#
#band pattern
band1=yellow#
band2=violet#
band3=orange#
band4=gold#
#resistor color coding
r=(band1*10.+band2)*10.**(band3)#
tol=r*(band4/100.)#tolerance
ulr=r+tol##upper limit of resistance
llr=r-tol##lower limit of resistance
print 'The range of resistance =',llr/1000. ,'kOhm','to',ulr/1000,'kOhm'
#Find the range of tolerance
#color coding
blue=6.#
gold=-1.#
gray=8.#
silver=10.#
#band pattern
band1=gray#
band2=blue#
band3=gold#
band4=silver#
#resistor color coding
r=(band1*10.+band2)*10.**(band3)#
tol=r*(band4/100.)#tolerance
ulr=r+tol##upper limit of resistance
llr=r-tol##lower limit of resistance
print 'The Range of resistance is',llr,'ohm','to',ulr,'ohm'
#Find the equivalent current source
#given
Vs=2.;#Volts #dc voltage source
Rs=1.;#ohm #internal resistance
Rl=1.;#ohm #load resistance
Ise=Vs/Rs;#ampere #equivalent current source
# In accordance to figure 1.23a
Il1=Ise*(Rs/(Rs+Rl));#using current divider concept
Vl1=Il1*Rl;
print "In accordance to figure 1.23a\n"
print "The Load current (current source Il=",Il1,'A'
print "The Load voltage (current source Vl=",Vl1,'V','\n'
# In accordance to figure 1.23b
Vl2=Vs*(Rs/(Rs+Rl));#using voltage divider concept
Il2=Vl2/Rl;
print "\nIn accordance to figure 1.23b"
print "\nThe Load voltage (voltage source) Vl=",Vl2,'V'
print "The Load current (voltage source) Il=",Il2,'A'
print "\nTherefore they both provide same voltage and current to load"
#Find percentage variation in load current and load voltage
#given
Vs=10.;#volt#Supply voltage
Rs=100.;#ohm#internal resistance
# In accordance to figure 1.24a
#For 1ohm - 10 ohm
Rl11=1.;#ohm#min extreme value of Rl
Rl12=10.;#ohm#max extreme value of Rl
Il11=Vs/(Rs+Rl11);
Il12=Vs/(Rs+Rl12);
Pi1=(Il11-Il12)*100./Il11;#Percentage variation in current
Vl11=Il11*Rl11;
Vl12=Il12*Rl12;
Pv1=(Vl12-Vl11)*100./Vl12;#Percentage variation in voltage
print '%s' %("In accordance to figure 1.24a \n");
print '%s %.2f %s' %("Percentage variation in Current(1-10 ohm)=",Pi1,'percent');
print '%s %.1f %s ' %("Percentage variation in Voltage(1-10 ohm)=",Pv1,'percent\n\n');
# In accordance to figure 1.24b
#For 1kohm - 10kohm
Rl21=1000.;#ohm#min extreme value of Rl
Rl22=10000.;#ohm#max extreme value of Rl
Il21=Vs/(Rs+Rl21);
Il22=Vs/(Rs+Rl22);
Pi2=(Il21-Il22)*100./Il21;#Percentage variation in current
Vl21=Il21*Rl21;
Vl22=Il22*Rl22;
Pv2=(Vl22-Vl21)*100./Vl22;#Percentage variation in voltage
print '%s' %("In accordance to figure 1.24b \n");
print '%s %.f %s' %("Percentage variation in Current(1-10 ohm)=",Pi2,'percent');
print '%s %.f %s ' %("Percentage variation in Voltage(1-10 ohm)=",Pv2,'percent \n');
print 'In book the percentage variation in voltage(1kohm-10kohm) is 9 percent due to'
print 'the incorrect value of Il22 i.e. 0.000999 Amp correct value is 0.0009901 Amp'