#Variable declaration
A=6.022*10**23 #avagadro's number(/m^3)
d=2.7*10**6 #density of aluminium conductor(g/m^3)
a=26.98 # atomic weight aluminium conductor(g/g-atom)
D=10**4. #current density(A/m^2)
e=1.6*10**-19 #electronic charge(C)
#Calculations
#Part a
n=A*d/a #number of atoms(n/m^3)
#Part b
u=D/(n*e) #drift velocity (m/s)
#Results
print "number of atoms per cubic meter is ",round(n/1e+28,3),"*10^28 /m^3"
print "drift velocity is",round(u/1e-6,2),"*10^-6 m/s"
#Variable declaration
n=10**23 #number of electrons(n/m^3)
e=1.6*10**-19 #electronic charge(C)
u=0.4 #mobility(m^2/Vs)
a=10**-7 #cross sectional area(m^2)
l=15*10**-2 #conductor length(m)
#Calculations
#Part a
G=n*e*u #conductivity(S/m)
#Part b
R=l/(a*G) #resistance(ohm)
#Results
print"conductivity of the conductor is",round((G/1E+3),1),"*10**3 S/m"
print"resistance of the conductor is",round(R,1),"ohm"
#Variable declaration
A=6.022*10**23 #avagadro's number
d=5.32*10**6 #density of Ge at 300k(g/m^3)
a=72.60 #atomic weight of Ge(g/g-atom)
e=1.6*10**-19 #electronic charge(C)
ni=2.4*10**19 #intrinsic concentration(electron-hole pairs/m^3)
un=0.39 #electron mobility(m^2/V.s)
up=0.19 #hole mobility(m^2/V.s)
#Calculations
#Part a
nA=A*d/a #number of atoms(nA/m^3)using avagadro's law
x=nA/ni #Germanium atoms/electron hole pair
#Part b
g=(un+up)*e*ni #intrinsic conductivity(S/m)
r=1/g #intrinsic resistivity(ohm.m)
#Results
print"the relative concentration of Ge and electron hole pairs is",round((x/1E9),2),"*10^9 atoms/electron-hole pair"
print"the intrinsic resistivity of Ge is",round(r,3),"ohm.m"
#Variable declaration
ni=1.5*10**16 #intrinsic concentration(electron-hole pairs/m^3)
n=4.99*10**28 #number of Si atoms(atoms/m^3)
un=0.13 #electron mobility(m^2/V.s)
up=0.05 #hole mobility(m^2/V.s)
e=1.6*10**-19 #electronic charge(c)
#Calculation
#Part a
g=e*ni*(un+up) #intrinsic conductivity(S/m)
r=1/g #interinsic resistivity(ohm.m)
Nd=n/10**8 #doped silicon(atoms/m^3)=nn,majority carriers
pn=ni**2/Nd #minority carrier density(holes/m^3)
#Part b
k=e*un*Nd #conductivity(S/m)
#using Nd in place of nn as Nd=nn
rho=1/k #resistivity(ohm.m)
#Results
print"the minority carrier density of Si is",round(pn/1e+11,2),"*10^11 holes/m^3"
print"the resistivity of Si is",round((rho/1E-2),2),"*10**-2 ohm.m"
import math
#Variable declaration
Vo=0.7 #contact potential(V)
Vf=0.4 #forward biasing voltage(V)
#Calculation
x=math.exp(-20*(Vo-Vf))/math.exp(-20*Vo) #increase in probability of majority carriers
#Result
print"increase in probability of majority carriers is",round(x),"times"
import math
#Variable declaration
I=10 #Ge diode carries current(mA)
V=0.2 #forward bias voltage(V)
#Calculation
#Part a
Is=I/(math.expm1(40*V)-1) #reverse current(mA)
#part b
I1=1*10**-3 #current(mA)
V1=(math.log((I1/Is)+1))/40 #voltage(V)
I2=100*10**-3 #current(mA)
V2=(math.log((I2/Is)+1))/40 #voltage(V)
#Part c
Is1=4*Is #reverse saturation current doubles for every 10 degree celcius temp rise,so for 20 degree rise it will be 4 timese/
x=37.44 #let x=e/kT
I3=Is1*(math.expm1(x*V)) #current when temp doubles(mA)
#Results
print"the reverse current is",round(Is/1e-3,3),"mA" #incorrect units given in the textbook
print"bias voltages are",round(V1,3),"V and", round(V2,3),"V resp"
print"Is at 20 degree is",round(Is1/1e-3,2),"uA and diode current at 0.2 V is",round(I3,2),"mA"
#Variable declaration
V=3. #Voltage(V)
Req=300. #total resistance as per circuit(ohm)
Rfa=20 #forward resistance(ohm)
Vt=0.7 #Thevinine's voltage(V)
Rfb=0 #forward resistance(ohm)
#Calculations
#Part a
I=V/Req #current(A)
#Part b
Id=(V-Vt)/Req #diode current(mA)
#Part c
Rf=20 #forward resistance(ohms)
Id1=(V-Vt)/(Req+Rfa) #diode current(mA)
#Results
print"current in this case is",round(I,2),"A"
print"diode current is",round((Id/1E-3),2),"mA"
print"diode current is",round((Id1/1E-3),2),"mA"
#Variable declaration
Vx=1.4 #voltage at point X(V)
Vt=0.7 #diode voltage(V)
Vcc=5 #cathode voltage(V)
R=1 #circuit resistance(ohm)
Vs=Vx-Vt #supply voltage(V)
#Calculations
I1=(Vcc-Vt-Vs)/R #current throgh D1(mA) for 0<Vs<0.7
I2=0 #current through D2 and D3
I1=I2=(Vcc-Vt-Vs)/R #for Vs>0.7 as D2 and D3 conducts
#Results
print"I1 for 0<Vs<0.7 is",I1,"mA"
print"I2 for 0<Vs<0.7 is",I2,"mA"
print"I1 and I2 for Vs>0.7 is",I1,"mA"
#Variable declaration
Vz=100 #zener voltage(V)
Rz=25 #diode resistance(ohm)
Il=0.05 #load current(A)
Iz=0.01 #zener diode current(A)
Rs=250 #supply resistance(ohm)
#Calculations
Vl=Vz+(Iz*Rz) #load voltage(V)
Vs=Vl+(Il+Iz)*Rs #supply voltage(V)
VL=Vl*1.01 #increase in Vl(V)
IZ=(VL-Vz)/Rz #increase in zener current
VS=Vl+(Il+IZ)*Rs #increase in supply voltage(V)
Vss=(VS-Vs)/Vs #%increase in supply voltage(V)
P=Il*VL #power consumed(W)
#Results
print"load voltage is",Vl,"V"
print"supply voltage is",Vs,"V"
print"increase in supply voltage is",VS,"V"
print"power consumed is",round(P,2),"W"
#Variable declaration
Vbb=5 #bias voltage(V)
Rl=1 #resistance(ohm)
Id=4.4 #from the figure(mA)
#Part a
i=Vbb/Rl #load line intercepts the Id axis at i(mA)
Vl=Id*Rl #load voltage(V)
#Part b
Vd=Vbb-Vl #diode voltage(V)
P=Vd*Id #power absorbed in diode(mW)
#Part c
Ida=1.42 #diode current(mA)for 2V
Idb=7.35 #diode current(mA)for 8V
#Part d
Idc=8.7 #diode current(mA)for Rl=0.5k ohm
Idd=2.2 #diode current(mA)for Rl=2k ohm
#Results
print"diode current is",Id,"mA and voltage across the load is",Vl,"V"
print"power absorbed in diode is",P,"mW"
print"diode current for Vbb=2V is",Ida,"mA","and for Vbb=8V is",Idb,"mA"
print"diode current for Rl=0.5kohm is",Idc,"mA","and for Rl=2kohm is",Idd,"mA"
#Variable declaration
T=300 #temperature(k)
Ig=100*10**-3 #current(mA)
Is=1*10**-9 #current(nA)
x=0.0259 #x=kT/e
#Calculations
Voc=x*math.log(Ig/Is+1) #as Voc=kT/e*ln((Ig/Is)+1) where ln((Ig/Is)+1)=18.42 after solving
Isc=Ig
#Result
print"for a solar cell Voc is",round(Voc,3),"V and Isc is",round(Isc/1E-3),"mA"
import math
#Variable declaration
Idc=0.1 #dc current(A)
Rf=0.5 #forward resistance(ohms)
Rl=20 #load resistance(ohm)
Rs=1 #secondary resistance of transformer(ohm)
#Calculations
#Part a
Vdc=Idc*Rl #dc voltage(V)
Vm=(math.pi/2)*(Vdc+Idc*(Rs+Rf)) #mean voltage(V)
Vrms=Vm/math.sqrt(2) #rms value of voltage(V)
#Part b
Pdc=Idc**2*Rl #dc power supplied to the load
#Part c
PIV=2*Vm #PIV rating for each diode(V)
#Part d
Im=(math.pi/2)*Idc #peak value of current(mA)
Irms=Im/math.sqrt(2) #rms calue of current(A)
Pac=Irms**2*(Rs+Rf+Rl) #ac power input(W)
#Part e
eta=(Pdc/Pac)*100 #conversion efficiency
#Part f
Vr=((Rs+Rf)/Rl)*100 #voltage regulation(V)
#results
print"rms value of voltage is",round(Vrms,2),"V"
print"dc power supplied to load is",Pdc,"W"
print"PIV rating for each diode",round(PIV,2),"V"
print"ac input power is",round(Pac,3),"W"
print"conversion efficiency",round(eta,1),"%"
print"voltage regulation",Vr,"%"
import math
from scipy import integrate
#Variable declaration
Vt=1
Vl=12
Vm=63.63 #peak voltage(V) as Vm=sqr root of 2*45
Idc=8. #charging current(A)
#Calculations
#Part a
theta1=math.degrees(math.asin((Vt+Vl)/Vm))
theta2=180-theta1
Rl=((2*Vm*math.cos(theta1))-(2*(math.pi-2*theta1)*(Vt+Vl)))/(Idc*math.pi)
#Part b
wt = lambda wt: (((((math.sqrt(2)*45*math.sin(wt))-(Vt+Vl))/Rl)*wt)**2)
integ,err = integrate.quad(wt, theta1 , theta2)
print integ
Irms = (integ/math.pi)**0.5
Pl=Irms**2*Rl #power loss in resistance(W)
#Part c
P=Vl*Idc #power supplied to battery(W)
#results
print"Resistance to be added is",round(Rl,2),"Ohms"
print"",Pl
print"power supplied to battery is",P,"W"
print"",Irms
import math
#Variable declaration
Rf=5 #forward resistance(ohms)
Vo=20 #output voltage(V)
Rs=10 #secondary resistance of transformer(ohm)
#Calculations
#Part a
Idc=0.1 #dc current(A)
Vm=Vo*(math.sqrt(2)) #mean voltage(V)
Vdc=(2*Vm/(math.pi))-Idc*(Rs+2*Rf) #dc voltage(V)
#Part b
Idc1=0.2 #full load dc current(A)
Vdc2=((2*(math.sqrt(2))*Vo)/(math.pi))-Idc1*(Rs+2*Rf) #full load dc voltage(V)
Rl=Vdc2/Idc1 #load resistance(ohm)
x=((2*Rf+Rs)/Rl)*100 #% regulation
#Part c
Idc=0.2 #dc current(A)
Im=(math.pi)*Idc/2 #peak current(mA)
Ilrms=Im/math.sqrt(2) #rms current(mA)
Vlrms=Ilrms*Rl #load rms voltage(V)
#Part d
Vldc=14 #load dc voltage(V)
Vlacrms=math.sqrt(Vlrms**2-Vldc**2) #rms value of ac component(V)
#Results
print"dc voltage",round(Vdc),"V"
print"regulation is",round(x,2),"%"
print"rms value of output voltage at dc load current is",round(Vlrms,2),"V"
print"rms value of ac component of voltage",round(Vlacrms,2),"V"
#Variable declaration
Vh=60. #higher output voltage(V)
Vl=45. #lower output voltage(V)
fz=50. #frequency(Hz)
Vr=15. #peak to peak ripple voltage(V)
Rl=600. #resistance(ohms)
#Calculations
Vldc=(Vh+Vl)/2 #avg load dc voltage(V) as voltage drops from 60 to 45
Idc=Vldc/Rl #dc current(A)
T=1/fz #discharging time(ms)
C=(Idc*T)/Vr #linear discharge rate(uF)
C1=C*2 #new capacitance(uF)
'''
CVr(p-p) 234Vr(p-p)*10^3
Idc = -------------- = --------------- ----(1)
T 20
60+[60-Vr(p-p) 120-Vr(p-p)
Idc = --------------- = ------------*1000 ----(2)
2Rl 2*600
Equating equations 1 & 2, we get,
'''
Vr1 = (20*120*1000)/(1200*254)
Idc1=(Vh-(Vr1/2))/Rl #dc load current(mA)
#Results
print"value of capacitance is",round(C/1E-6),"uF"
print"Vr1 is",Vr1,"V"
print"dc load current Idc is",round(Idc1/1E-3),"mA"
import math
#Variable declaration
Vdc=30 #dc voltage(V)
V1=220 #source voltage(V)
f=50 #frequency(Hz)
Rl=1000 #load resistance(k ohms)
#Calculations
C=100/f*Rl #as Vdc/Vr=100
Vm=Vdc+(Vr/2) #peak voltage(V)
V2=Vm/(math.sqrt(2)) #secondary voltage(V)
r=V1/V2 #transformer turn ratio
#Results
print"capacitor filtor is",C,"uF"
print"transformer turn ratio is",round(r,2),""
import math
#Variable declaration
Idc=60*10**-3 #dc current(A)
Vm=60 #peak volage(V)
f=50 #frequency(Hz)
C=120*10**-6 #capacitance(F)
#Calculations
#Part a
Vrms=Idc/(4*(math.sqrt(3))*f*C*Vm) #rms voltage(V)
Vr=2*(math.sqrt(3))*Vrms #ripple factor(V)
#Part b
Vdc=Vm-(Vr/2) #by simplifying
#Part c
r=(Vrms/Vdc)*100 #ripple factor
#Results
print"ripple factor is",round(Vr,3),"Vdc"
print"dc voltage is",round(Vdc),"V"
print"ripple factor",round(r,4),"%"
import math
#Calculations
#Part a
''' 200*1.141 4
v1(t)=-------------(1- - cos628t)
3.14 3
200*1.141 800*1.141
v2(t)=----------- - ------------ cos(628t+<(V2/V1))
3.14 3*3.14
V2/V1|w=0 =0.8;V2/V1|w=628 =6.43*10^-4 <V2/V1|w=628 =180
v2(t)=72.02+0.0538 cos628t
'''
#Part b
vrms=0.0538
vdc=math.sqrt(2)*72.02
r=vrms/vdc
#Results
print"ripple factor is",round((r/1E-4),2),"*10**-4"
import math
#Variable declaration
Vz=2 #zener voltage(V)
r1=10 #resistance after reducing circuit by thevinin(ohms)
r2=20 #resistance after reducing circuit by thevinin(ohms)
V1=7.5 #voltage after circuit reduction(V)
V2=15 #voltage after circuit reduction(V)
Rz=100/3 #zener resistance(ohms)
#Calculations
Vab=V2-(((V2-V1)/(r1+r2))*r2) #thevinin voltage at ab(V)
Rth=(Vab*r2)/(Vab+r2) #thevinin resistance at ab(ohms)
Vd=Vab-Vz #diode voltage(V)
Id=Vd/(Rth+Rz) #diode current(A)
#Results
print"diode current is",round(Id,2),"A"
#Variable declaration
Vd=0.7 #diode voltage(V)
Ro=18 #output resistance(k ohms)
R1=2 #diode1 resistance(k ohms)
R2=2 #diode2 resistance(k ohms)
#Calculations
#Part a
V1=10 #voltage to D1(V)
V2=0 #voltage to D2(V)
Io=(V1-Vd)/(R1+Ro) #output current(mA)
Vo=Io*Ro #output voltage(V)
#Part b
V1=5 #voltage to D1(V)
V2=0 #voltage to D2(V)
Io=(V1-Vd)/(R1+Ro) #output current(mA)
Vo1=Io*Ro #output voltage(V)
#Part c
V1=10 #voltage to D1(V)
V2=5 #voltage to D2(V)
Vo=8.37 #as D1 only conducts,so,Vo is same as in part a
Vd1=V2-Vo #assume D1 conducts
Vo2=8.37 #D2 does not conduct as as Vd1 is negative
#Part d
V1=V2=5 #voltage to D1 and D2(V)
Id1=(V1-Vd-Vo)/2 #diode1 current(mA)
Io=Vo/Ro #output current(mA)
Vo3=(Ro*(V1-Vd))/(Ro+1) #output voltage(V)
print"a)output voltage is",Vo,"V"
print"b)output voltage is",Vo1,"V"
print"c)output voltage is",Vo2,"V"
print"d)output voltage is",round(Vo3,2),"V"
#Variable declaration
Vs=10. #supply voltage(V)
Rs=1 #supply resistane(ohm)
Vl=10. #load voltage(V)
Vi=50. #nput voltage(V)
Iz=32 #zener diode current(mA)
Is=40 #supply current(mA)
#Calculations
#Part a (Rl is min when Iz=0)
Is=(Vi-Vs)/Rs #source current(mA)
Rlmin=Vl/(Vi-Vs) #load resistance minimum(ohm)
#Part b(Rl is maximum when Iz=32 mA)
Il=(Is-Iz)*10**-3 #load current(A)
Rlmax=Vl/Il #maximum load resistance(k ohms)
P=Vl*Iz #max diode wattage consumed(mW)
#Results
print"Range of Rl is",round((Rlmin/1E-3),3),"ohm","to", round((Rlmax/1E+3),2),"k ohm"
print "Il = ",(Il/1E-3),"*10**-3 A"
print"max power consumed is",P,"mW"
#Variable declaration
Vz=20 #zener voltage(V)
Izmax=50 #maximum zener current(mA)
Rz=0 #zener resistance(ohms)
Rl=2. #load resistance(ohm)
Vl=20. #as Vz=Vl(V)
Rs=0.25 #source resistance(k ohms)
#Calculations
#Part a
Il=Vl/Rl #load current(mA)
Vsmin=(Rs+Rl)*Il #as Iz is floating so Iz=0
#Part b
Is=Izmax+Il #source current(mA)
Vsmax=Vz+(Is*Rs) #maximum source voltage(V)
#Results
print"Vsmin",round(Vsmin,1),"V"
print"Range of input voltage is",round(Vsmin,1),"to", Vsmax,"V"
#Variable declaration
Ilmax=100 #load maximum current(mA)
Ilmin=0 #load minimum current(mA)
Rz=0.05 #zener diode resistance(ohms)
Rs=10. #source resistance(k ohms)
Vl=16.015 #load voltage(V)
Vl1=16. #nominal load voltage(V)
Vs=20 #source voltage(V)
Vz=16 #zener diode voltage(V)
#Calculations
#Case 1 (i)
Iz=(Vl-Vl1)/Rz #zener current(mA)
Is=Iz+Ilmax #supply current(A)
#Case 1 (ii)
Is1=(Vs-Vz)/(Rs+Rz) #supply current(mA)
Vl2=Vl1+(Is1*Rz) #voltage(V)
Vr=((Vl2-Vl)/Vl1)*100 #voltage regulation
#Case 2 (i)
Vs=18 #supply voltage(V)
Ilmax=0.1 #load current max(A)
Vl=16.005 #load voltage(V)
Iz=(Vl-Vl1)/Rz #zener current(mA)
Is2=Ilmax+Iz #supply current(A)
#Case 2 (ii)
Ilmin=0
Iz1=(Vs-Vl1)/(Rs+Rz) #minimum diode current(mA)
Vl=Vl1+(Iz*Rz) #load voltage at Ilmin(V)
#Part a
#Variable declaration
Is=0.4 #supply current(A)
Vs=20 #supply voltage(V)
Vl=16.015 #load voltage(V)
Iz=0.3 #zener current(mA)
#Calculations
P=Is**2*Rs #power dissipated by Rs(W)
#Part b
Pd=Vl*Iz #power dissipated(W)
Po=(Vs**2)/Rs #output power(W)
print"maximum power dissipated by Rs is",P,"W"
print"maximum power dissipated by diode is",round(Pd,3),"W"
print"minimum diode current is",round(Iz1,3),"A"
print"voltage regulation is",round(Vr,2),"%"
print"output shorted will be",Po,"W"
import math
#Variable declaration
Vrms=20 #secondary voltage(V)
Rs=10 #Winding resistance(ohm)
Rf=5 #diode has forward resistance(ohms)
Idc=2*10**-3 #load current(mA)
#Calculations
#Part a
Vdc=(Vrms*(math.sqrt(2)))/(math.pi) #no load Vdc
#Part b
Vldc=Vdc-(Idc*(Rs+Rf)) #dc output voltage when load is 20mA
#Part c
Rl=Vldc/Idc #load resistance(ohms)
r=((Rs+Rf)/Rl)*100 #percentage regulation(%)
#Part d
Im=Idc*(math.pi) #peak current(mA)
Ilrms=Im/2 #rms load current(mA)
Vlrms=Ilrms*Rl #rms load voltage(V)
Vlrmsac=math.sqrt((Vlrms**2)-(Vldc**2)) #Ripple voltage rms(V)
f=50*2 #rippLe frequency(Hz)
#Part e
eta=(((2*(math.pi))**2)/(1+((Rs+Rf)/Rl)))*100 #efficiency
#Part f
PIV=Vm=Vrms*(math.sqrt(2)) #peak inverse voltage(V)
#Results
print"no load dc voltage is",round(Vdc),"V"
print"dc output voltage when the load is drawing 20 mA is",round(Vldc,2),"V"
print"percentage regulation at this load is",round((r/1E-1),2),"%"
print"ripple voltage rms is",round(Vlrmsac,2),"V and ripple frequency is",f,"Hz"
print"power conversion efficiency is",round((eta/1E+2),1),"%"
print"PIV is",round(PIV),"V"
import math
#Variable declaration
Vl=24 #battery voltage(V)
Vm=60*(math.sqrt(2)) #peak voltage(V)
Ip=2.5 #peak current(A)
c=20 #charge(Ah)
#Calculations
#Part a
theta=math.asin(Vl/Vm) #angle at which conduction begins
Rs=(Vm-Vl)/Ip #source resistance(ohms)
#Part b
Idc=(Vm/(math.pi)*Rs)*(math.cos(theta))-(((math.pi)-(2*theta))/2*math.pi)*(Vl/Rs) #load current(A)
T=c/Idc #time to deliver 20Ah(h)
#Results
print"resistance connected in series is",round(Rs,1),"ohm"
print"time required to deliver a charge of 20 Ah is",round((T/1E-3),1),"h"
print"Idc",round((Idc/1E+3),2),"A"
import math
#Variable declaration
R=25. #external resistance(ohms)
Vm=200. #peak value of voltage(V) as vs=200 sinwt
Rf=50. #forward resistance(ohms)
#Calculations
#Part a
Id=Vm/(2*Rf+R) #diode current(peak)
#Part b
Idc=(2*Id)/math.pi #dc current(A)
#Part c
PIV=Vm/2 #peak value of voltage across D1
PIVac=100/math.pi #average value of voltage across D1
#Part d
Im=Id #peak value of current(A)
Irms=Im/(math.sqrt(2)) #rms value of current(A)
#Results
print"peak value of current is",Id,"A"
print"dc currect is",round(Idc,2),"A"
print"across D1 are peak voltage is",PIV,"V and average voltage is",round(PIVac,1),"V"
print"Irms is",round(Irms,2),"A"
import math
#Variable declaration
f=50. #frequency(Hz)
dv=7. #difference between maximum and minimum(25-18)voltages across the load(V)
Ic=100. #load current(mA)
#Calculations
dt=1/(2*f) #time of discharge(seconds)
C=Ic/(dv/dt) #capacitance(uF)
#Results
print"value of capacitor is",round((C/1E-3),2),"uF"
import math
#Variable declaration
Vr=10. #peak to peak ripple voltage(V)
Vm=50. #peak output voltage(V)
C=300. #Capacitance(uF)
Rl=470. #load resistance(ohms)
f=50. #frequency(Hz)
#Calculations
#Part a
Vdc=Vm-(Vr/2) #dc voltage(V)
C=Vdc/(f*Vr*Rl) #capacitance(mF)
#Part b
C1=300*10**-6 #capacitance is increased(uF)
Vr=2*Vm/((2*f*C1*Rl)+1)
Vdc=Vm-Vr/2 #load voltage ripple(V)
Idc=Vdc/Rl #average load current(mA)
#Results
print"value of capacitor is",round((C/1E-6),1),"mF"
print"load voltage ripple is",round(Vdc,2),"V and average load current is",round((Idc/1E-4),1),"mA"
import math
#Variable declaration
vo=7.5 #instantaneous voltage(V)
R1=15 #resistance(k ohms)
Von=0.5 #voltage of diode when on(V)
#Calculations
Rth=(R1*vo)/(R1+vo) #equivalent resistance(V)
T=2*(math.pi)/10**4 #time period(ms)
t1=(math.asin(Von/2.5))/10**4 #timimgs when D1 conducts(ms)
t2=(T/2)-t1
#Results
print"time period is",round((T/1E-3),3),"ms"
print"t1 is",t1,"ms"
print "t2 is",round((t2/1E-3),3),"ms"
import math
#Variable declarations
v=12 #output voltage(V)
vm=20. #peak voltage(V)
v1=8 #output voltage(V) for negative half cycle
vm1=20. #peak voltage(V) for negative half cycle
#Calculations
t1=(math.asin(v/vm))/10**4 #for positive half cycle when D1 conducts
t2=(0.1*math.pi)-t1/1e-3
t3=(math.asin(v1/vm1))/10**4 #for negative half cycle when D2 conducts
t4=(0.1*(math.pi))+t3/1e-3
t5=(0.2*(math.pi))-t3/1e-3
#Results
print"t1 is",round(t1/1e-3,3),"ms"
print"t2 is",round(t2,2),"ms"
print"t3 is",round(t3/1e-3,3),"ms"
print"t4 is",round(t4,3),"ms"
print"t5 is",round(t5,3),"ms"
print"vo is","-5.33+6.66*sin(10**4*.15)"