from __future__ import division
Idss=10e-3#
Vgs_off=-4#
print"For Vgs =0 V"
Vgs=0#
Id=Idss#
print"\n Idss=%.0f mA \n"%(Id*1e3)
print"\n For Vgs =-1 V"
Vgs=-1#
Id=Idss*(1-Vgs/Vgs_off)**2#
print"\n Idss=%.3f mA \n"%(Id*1e3)
print"\n For Vgs =-4 V"
Vgs=-4#
Id=Idss*(1-Vgs/Vgs_off)**2#
print"\n Idss=%.0f A \n"%(Id)
#In the book this example is mention as Example-4_3
#but it is the first example in this chapter so I've taken this as Example-7_1
Vi=50e-3#input supply
Rd=5e3#
Yfs_max=4000e-6#
Yfs_min=1000e-6#
print " For Yfs_max=4000e-6"
Id_delta=Yfs_max*Vi#
print"\n Change in Id is +/- %.1f mA \n"%(Id_delta*1e3)
Vo=Id_delta*Rd##output voltage
Av=Vo/Vi##voltge gain
print"\n Voltage gain is %.0f \n"%(Av)
print " For Yfs_min=1000e-6"
Id_delta=Yfs_min*Vi#
print"\n Change in Id is +/- %.2f mA \n"%(Id_delta*1e3)
Vo=Id_delta*Rd##output voltage
Av=Vo/Vi##voltge gain
print"\n Voltage gain is %.0f \n"%(Av)
#In the book this example is mention as Example-7_1
#but it is the second example in this chapter so I've taken this as Example-7_2