# unknown resistance(refer fig. 1.4(a))
import math
#VAriable declaration
Ir=10*10**-3 #current drawn by resistor
Vr=100.0 #voltage across resistor
Rv=40*10**3 #voltmeter resistance
#Calcualtions
Ru=(Vr/Ir)*(1/(1-(Vr/(Ir*Rv))))
#Result
print("output resistance:")
print("Ru = %d ohm"%Ru)
# unknown resistance(refer fig. 1.4(b))
import math
#Variable declaration
Ir=10*10**-3 #current drawn by resistor
Vr=100.0 #voltage across resistor
Rv=40*10**3 #voltmeter resistance
Ra=1.0 #ammeter resistance
#Calculations
Ru=(Rv/Ir)-Ra
#Result
print("output resistance:")
print("Ru = %.2f ohm"%Ru)
# Answer in the book is in k-ohm
# find ammeter reading
import math
#Variable declaration
Rv=40*10**3 #voltmeter resistance
Ra=1.0 #ammeter resistance
Vr=40.0 #voltmeter reading
Ru=10*10**3 #unknown resistance
#Calculations
Ir=(Vr*(Rv+Ru))/(Ru*Rv)
Ir1=(Vr/(Ru+Ra))
#Result
print("ammeter reading case1:")
print("Ir = %d mA"%(Ir*10**3))
print("\nammeter reading case2:")
print("Ir1 = %.d mA"%(Ir1*10**3))
# unknown resistance
import math
#Variable declaration
Vs=3.0 #supply voltage
Vu=2.75 #voltmeter reading
Rp=10*10**3 #parallel resistance
#Calculations
Ru=Rp*((Vs/Vu)-1)
#Result
print("unknown resistance:")
print("Ru = %.2f ohm"%Ru)
#Answer in the book is not matching
# Find input vlotage
#with input voltage exceding 2Vd,diodes conduct and the voltage divider circuit with diodes can allow only a Vi given by Vi=2Vd
#Result
print("input voltage to amplifier:")
print("Vi = 2*Vd")
# find shunt resistance
import math
#Variable declaration
Rm=1000.0 #meter resistance
Is=900*10**-6 #shunt current
Vm=100*10**-3 #drop across meter
#Result
Rs=Vm/Is
It=1*10**-3
#Is=It*(Rm/(Rs+Rm))
Rs=(Rm*(It-Is))/Is
#Result
print("shunt resistance:")
print("Rs = %.1f ohm"%Rs)
# find series resistor
import math
#Variable declaration
If=100*10**-6 #full scale current
Rm=1000.0 #meter resistance
Vf=10.0 #full scale voltage
#Calculations
Rs=(Vf/If)-Rm
#Result
print("series resistance:")
print("Rs=%.0f ohm"%Rs)
# sensitivity
import math
#Variable declaration
If=100*10**-6 # Current
#Calculations
S=1/If
#Result
print("sensitivity:")
print("S = %.2f ohm/volt"%S)
# error in measurment
import math
# Variable declaration
#assume that the voltmeter full scale reading is 12V which gives its resistance as 1.2*10^6 ohm
#which is in parallel with 10*10^6 ohm making as equivalent of Rq given as
R=1.2*10**6 #voltmeter resistance
R1=10*10**6 #voltage divider resistance
Vin=12.0 #input voltage to divider network
Rs=4*10**6 # series resistance
#Calculations
Rq=(R*R1)/(R+R1)
Vq=(Rq*Vin)/(Rq+Rs) #voltage across equivalent combination
Va=(R1*Vin)/(R1+Rs) #actual volatge
er=(Vq-Va)/Va #error
#Result
print("error in measurement:")
print("\ner = %.3f i.e %.1f%%"%(er,er*100))