from __future__ import division
from math import sqrt
V_max=200#in V
V_rms=(V_max)/sqrt(2)
R=100#in ohm
I_rms=V_rms/R
print "Voltage = %0.2f V"%V_rms
print "Current = %0.2f Amps"%I_rms
C=8*10**-6
X_c=1/(377*C)
print "Resistance = %0.2f ohm"%X_c
I_rms=150/X_c
print "Current = %0.2f Amps"%I_rms
L=25*10**-3#In H
w=377
X_L=w*L#In ohm
print "Resistance = %0.2f ohm"%X_L
I_rms=150/X_L#In A
print "Current = %0.2f Amps"%I_rms
from math import atan, degrees, sqrt
R=250#in ohm
Xc=758#in ohm
Xl=226#in Ohm
X=Xl-Xc
V_max=150#in Volt
Z=sqrt(R**2+X**2)
I=V_max/Z
q=degrees(atan(X/R))
print "Impedence = %0.2f ohm"%Z
print "Current = %0.2f Amps"%I
print "Angle = %0.2f degree"%q
V_R=I*R
V_C=I*Xc
V_L=I*Xl
print "Voltage at Resistance = %0.2f Volt"%V_R
print "Voltage at Inductance = %0.2f Volt"%V_L
print "Voltage at Capacitance = %0.2f Volt"%V_C
from math import sqrt
V_max=150#in V
V_rms=(V_max)/sqrt(2)
I_max=.255#in ohm
I_rms=I_max/sqrt(2)
cos=.426
P=V_rms*I_rms*cos
print "Voltage = %0.2f V"%V_rms
print "Current = %0.2f Amps"%I_rms
print "Power = %0.2f watt"%P
L=20*10**-3#in H
C=1/(25*10**6*L)
print "Capacitance = %0.e Farad"%C
I1=100
v1=4*10**3
v2=2.40*10**5
I2=(I1*v1)/v2
R=30#in ohm
p_lost=I2*I2*R
P_output=I1*v1
p_per=(p_lost*100/P_output)
print "Solution a"
print "Percentage of power lost = %0.2f"%p_per
P_lost=I1*I1*R
per=(P_lost*100)/(4*10**5)
print "Solution B"
print "Percentage of power lost = %0.2f"%per