from __future__ import division
from math import pi,sqrt,cos,acos
RL=100#
Vm=300#
#load power P= Vdc*Idc
a=(Vm/(2*pi))**2*(1/RL)#
print "a=%0.3f"%a
p=25#
#1+cosb=sgrt(25/a)
b=a*1+cos(sqrt(p/a))#
cosalpha=(sqrt(p/a))-1#
p=80#
cosalpha=(sqrt(p/a))-1#
print "cosalpha=%0.3f"%cosalpha
#or#
alpha=acos(cosalpha)*180/pi
print 'alpha=%0.3f'%alpha,'degree'
from __future__ import division
vm=200#
Rl=1*10**3#
#ALPHA=0degree
Vdc=vm*0.318#
Idc=Vdc/Rl#
P=Vdc*Idc#
print "P=%0.2f"%(P*1e3),'mW',"OR"
print "P=%0.2f"%P,'W'
#alpha=45 degree
Vdc=vm*0.27#
Idc=Vdc/Rl#
P=Vdc*Idc#
print "P=%0.2f"%(P*1e3),'mW',"OR"
print "P=%0.2f"%P,'W'
#alpha=90 degree
Vdc=vm*0.159#
Idc=Vdc/Rl#
P=Vdc*Idc#
print "P=%02f"%(P*1e3),'mW',"OR"
print "P=%0.2f"%P,'W'
#alpha=135 degree
Vdc=vm*0.04660#
Idc=Vdc/Rl#
P=Vdc*Idc#
print "P=%0.2f"%(P*1e3),'mW',"OR"
print "P=%0.2f"%P,'W'
from __future__ import division
from math import sqrt,pi,cos
Vrms=220#
a=60#
Vm=sqrt (2)*Vrms#
print 'Vm=%02.f'%Vm,"V"
Vdc=(Vm/(2*pi))*(1+cos(pi/180*60))#
print 'Vdc=%0.2f'%Vdc,"V"
from __future__ import division
from math import sqrt,pi,cos
Vrms=100#
a=45#
Idc=0.5#
Vm=sqrt (2)*Vrms#
print 'Vm=%0.2f'%Vm,"V"
#Idc=(Vm/(2*pi*RL))*(1+cosd(a))#
RL=(Vm/(2*pi*Idc))*(1+cos(pi/180*a))#
print "RL=%0.2f"%RL,'ohm'
from __future__ import division
Ton=30*10**-6#
Toff=10*10**-6#
#consider duty cycle=a
a=Ton/(Ton+Toff)#
print "a=%0.2f"%a
f=(1/(Ton+Toff))
print "f=%0.2f"%(f*10**-3),'kHZ'
from __future__ import division
Ton=30*10**-3#
Toff=10*10**-3#
Vdc=200#
a=Ton/(Ton+Toff)#
print "a=%0.2f"%a
Vl=Vdc*a#
print 'Vl=%0.2f'%(Vl),"V"