from __future__ import division
from numpy import pi
# Given data
q = 1.6 * 10**-19 # in C
N_D = 10**15 # in electrons/cm**3
N_D = N_D * 10**6 # in electrons/m**3
epsilon_r = 12
epsilon_o = (36 * pi * 10**9)**-1
epsilon = epsilon_o * epsilon_r
a = 3 * 10**-4 # in cm
a = a * 10**-2 # in m
V_P = (q * N_D * a**2)/( 2 * epsilon) # in V
print "The Pinch off voltage = %0.1f V " %V_P
# V_GS = V_P * (1-(b/a))**2
b = (1-0.707) *a # in m
print "The value of b = %0.3f µm " %(b*10**6)
print "Hence the channel width has been reduced to about one third of its value for V_GS = 0"
# Note : The unit of b in the book is wrong since the value of b is calculated in µm.
from math import sqrt
# Given data
I_DSS = 8 # in mA
V_P = -4 # in V
I_D = 3 # in mA
V_GS = V_P * (1 - sqrt(I_D/I_DSS)) # in V
print "The value of V_GS = %0.2f V " %V_GS
V_DS = V_GS - V_P # in V
print "The value of V_DS = %0.2f V " %V_DS
# Given data
V_P = -4 # in V
I_DSS = 9 # in mA
I_DSS = I_DSS * 10**-3 # in A
V_GS = -2 # in V
I_D = I_DSS * ((1 - (V_GS/V_P))**2) # in A
print "The drain current = %0.2f mA " %(I_D*10**3)
# Given data
I_DSS = 12 # in mA
I_DSS = I_DSS * 10**-3 # in A
V_P = -(6) # in V
V_GS = -(1) # in V
g_mo = (-2 * I_DSS)/V_P # in A/V
g_m = g_mo * (1 - (V_GS/V_P)) # in S
print "The value of transconductance = %0.2f mS " %(g_m*10**3)
# Given data
I_DSS = 10 # in mA
I_DSS = I_DSS * 10**-3 # in A
V_P = -(5) # in V
V_GS = -(2.5) # in V
g_m = ((-2 * I_DSS)/V_P) * (1 -(V_GS/V_P)) # in S
g_m = g_m * 10**3 # in mS
print "The Transconductance = %0.f mS " %g_m
I_D = I_DSS * ((1 - (V_GS/V_P))**2) # in A
print "The drain current = %0.1f mA " %(I_D*10**3)