from __future__ import division
#peak reverse recovery current
#given data :
itt=10 # time in micro seconds
qtt=150 #charge in micro colums
prrc=((2*qtt)/itt) #peak reverse recovery current in amperes
print "Peak reverse recovery current = %0.f A" %prrc
from __future__ import division
from math import pi, sqrt, cos
#voltage of the capacitor
r=10 #in ohms
l=10 #/inductance in mH
c=10 #capacitance in micro farads
v=100 #in volts
t=((pi)/(sqrt((1/(l*10**-3*c*10**-6))-(r**2/(4*(l*10**-3)**2))))) # time in seconds
vc= v*(1-cos(t/(sqrt(l*10**-3*c*10**-6))*pi/180)) #in volts
print "The capacitor voltage = %0.2f V" %vc
#answer is wrong in the textbook
from __future__ import division
from math import pi, sqrt, cos
#voltage of the capacitor
r=15 #in ohms
l=12 #/inductance in mH
c=8 #capacitance in micro farads
v=100 #in volts
t=((pi)/(sqrt((1/(l*10**-3*c*10**-6))-(r**2/(4*(l*10**-3)**2))))) # time in seconds
vc= v*(1-cos(t/(sqrt(l*10**-3*c*10**-6))*pi/180)) #in volts
print "The capacitor voltage = %0.2f V" %vc
#this question is not solved in the textbook
from __future__ import division
#Turn Off Time
#given data :
Vs=200 #in volts
R1=10 # in ohm
R2=R1
C=5 # in micro-farad
Tc=(R1*C)/1.44
print "The Circuit Turn Off Time, Tc = %0.2f micro-sec" %Tc
from __future__ import division
#Peak Current and turn off time
#given data :
Vs=200 #in volts
R1=10 # in ohm
R2=R1
Vc=200 #in volts
C=10 # in micro-farad
I1=Vs/R1
I2=(Vs+Vc)/R2
It1=I1+I2
print "Peak Current, It1 = %0.2f A " %It1
Tc=(R1*C)/1.44
print "The Circuit Turn Off Time, Tc = %0.2f micro-sec " %Tc
from __future__ import division
from math import pi
#L and C
#given data :
V=100 # in volts
Irm=40 # in A
tq=40 # in micro-sec
Del_t=(50/100)*tq # in micro-sec
C=(Irm*(tq+Del_t))/V
print "Capacitance, C = %0.f micro-farad " %C
L_min=(V/Irm)**2*C
print "Minimum inductance, L_min = %0.f micro-Henry" %L_min
T=2.5 # assume one cycle period in ms
L_max=((0.01*(T*10**-3)**2)/(pi**2*C*10**-6))*10**6
print "Maximum inductance, L_max = %0.2f micro-Henry " %L_max