#Initialisation
w=1000 #Angular Frequency
L=10**-3 #Inductance
#Calculation
Xl=w*L #Reactance
#Result
print'Reactance, Xl = %d Ohm'%Xl
import math
#Initialisation
f=50 #frequency
C=2*10**-6 #Capacitance
#Calculation
w=2*math.pi*f #Angular Frequency
Xc=1/(w*C) #Reactance
#Result
print'Reactance, Xl = %.2f KOhm'%(Xc/1000)
import math
#Initialisation
f=100 #frequency
l=25*10**-3 #Inductance
Vl=5 #AC Voltage (Sine)
#Calculation
w=2*math.pi*f #Angular Frequency
Xl=w*l #Reactance
Il=Vl*Xl**-1
#Result
print'Peak Current, IL = %d mA'%(Il*10**3)
import math
#Initialisation
Ic=2 #sinusoidal Current
C=10*10**-3 #Capacitance
w=25 #Angular Frequency
#Calculation
Xc=1/(w*C) #Reactance
Vc= Ic*Xc #Voltage
#Result
print'Voltage appear across the capacitor, V = %d V r.m.s'%(Vc)
import math
#Initialisation
I=5 #sinusoidal Current
R=10 #Resistance in Ohm
f=50 #Frequency in Hertz
L=0.025 #Inductancec in Henry
#Calculation
Vr=I*R #Voltage across resistor
Xl=2*math.pi*f*L #Reactance
VL= I*Xl #Voltage across inductor
V=math.sqrt((Vr**2)+(VL**2)) #total voltage
phi=math.atan(VL*Vr**-1) #Phase Angle in radians
#Result
print'(a) V = %.1f V'%(V)
print'(b) V = %.2f V'%(phi*180/math.pi) #phase angle in degree
import math
#Initialisation
R=10**4 #Resistance in Ohm
f=10**3 #Frequency in Hertz
C=3*10**-8 #Capacitance in Farad
V=10 #Voltage
#Calculation
Xc=1/(2*math.pi*f*C) #Reactance
a=((10**4)**2)+(5.3*10**3)**2
I=math.sqrt((V**2)/a) #Current in Amp
Vr=I*R #Voltage
Vc=Xc*I #Voltage
phi=math.atan(Vc/Vr) #Phase Angle in radians
#Result
print'(a) Current, I = %d uA'%round(I*10**6)
print'(b) V = %.2f V'%(-phi*180/math.pi) #phase angle in degree
import math
#Initialisation
I=5 #sinusoidal Current
R=200 #Resistance in Ohm
f=50 #Frequency in Hertz
L=400*10**-3 #Inductancec in Henry
C=50*10**-6 #Capacitance in Henry
#Calculation
Vr=I*R #Voltage across resistor
Xl=2*math.pi*f*L #Reactance
Xc=1/(2*math.pi*f*C) #Reactance
i=Xl-Xc
#Result
print'Z = %d + j %d Ohms'%(R,i)
import math
from numpy import ones
#Initialisation
R1=5 #Resistance in Ohm
R2=50 #Resistance in Ohm
w=500 #rad/s
L=50*10**-3 #Inductancec in Henry
C=200*10**-6 #Capacitance in Henry
v=10
#Calculation
Xc=1/(w*C) #Reactance
Z1=complex(R1,-Xc) #taking in complex form
a=(R2*w**2*L**2)/(R2**2+(w**2*L**2))
b=(R2**2*w*L)/(R2**2+(w**2*L**2))
Z2=complex(a,b) #taking in complex form
Z3=(Z1+Z2)
Z=Z2/Z3
r=math.sqrt((Z.real)**2 + (Z.imag)**2) #converting in polar (absolute)
r1=v*r
phi=math.atan(Z.imag/Z.real) #converting in polar (phase)
#Result
print'vo = %.1f < %.1f'%(r1,(phi*180/math.pi))
print'Therefore'
print'vo = %.1f sin(%d t + %.1f)'%(r1,w,(phi*180/math.pi))