In [1]:

```
#given
Vm=100 #Maximum voltage in V
R=50 #resitance in ohms
#Calculations
import math
Vrms=(Vm/math.sqrt(2))
Irms=(Vrms/R)
Im=(Vm/R)
#Output
print"rms current is ",round(Irms,2),"A and maximum current is ",Im,"A"
```

In [2]:

```
#given
c=50 #Capacitor in micro F
Vm=220 #Maximum voltage in V
f=50 #Frequency in Hz
#Calculations
import math
Xc=(1/(2.0*3.14*c*10**-6*f))
I=(Vm/Xc)
Irms=I/math.sqrt(2)
#Output
print"rms current is ",round(Irms,2),"A"
```

In [3]:

```
#given
L=2 #Inductance in H
Vrms=220 #rms voltage in V
f=50 #Frequency in Hz
#Calculations
Xl=(2*3.14*f*L)
Irms=(Vrms/Xl)
#Output
print"rms current is ",round(Irms,3),"A"
```

In [4]:

```
#given
Vm=220 #Maximum voltage in V
f=50 #frequency in Hz
R=2000 #Resistance in ohms
C=5*10**-6 #Capacitor in F
#Calculations
import math
Xc=(1/(2*3.14*f*C))
Z=math.sqrt(R**2+Xc**2)
Vc=(Vm*Xc)/Z
#Output
print"Maximum potential difference across the capacitor is ",round(Vc,1),"V"
```

In [1]:

```
#given
R=5000 #Resistance in ohms
L=2 #Inductance in H
Vrms=200 #rms Voltage in V
f=50 #Frequency in Hz
#Calculations
import math
Xl=(2*3.14*f*L)
Z=math.sqrt(R**2+Xl**2)
Vl=(Vrms*Xl)/Z
#Output
print"rms potential difference across the inductor is ",round(Vl,2),"V"
```

In [5]:

```
#given
R=10.0 #Resistance in ohms
L=5*10**-3 #Inductance in H
C=10.0*10**-6 #Capacitance in F
V=100 #Voltage in V
f=50.0 #Frequency in Hz
#Calculations
import math
Xc=1/(2.0*3.14*f*C)
Xl=(2*3.14*f*L)
Z=math.sqrt(R**2+(Xl-Xc)**2)
I=(V/Z)
q=math.atan((Xl-Xc)/R)*180/3.14
Vr=(I*R)
Vc=(I*Xc)
Vl=(I*Xl)
#Output
print"Total impedence is ",round(Z,1),"ohms"
print"Current is ",round(I,2),"A"
print"Phase angle is ",round(q,1),"degrees"
print"Voltage across resistor is ",round(Vr,2),"V"
print"Voltage across capacitor is ",round(Vc,0),"V"
print"Voltage across inductor is ",round(Vl,3),"V"
```

In [6]:

```
#given
R=5.0 #Resistance in ohms
L=2.0*10**-3 #Inductance in H
C=25.0*10**-6 #Capacitance in F
V=50 #Voltage in V
#Calculations
import math
w=1/math.sqrt(L*C)
f=(w/(2.0*3.14))
Q=(w*L)/R
#Output
print"Resonating frequency is ",round(f,0),"Hz"
print"Q factor is ",round(Q,2)
```

In [26]:

```
#given
L=(20*10**-3) #Inductance in H
Q=8.0 #Q factor
f=1000 #Frequency in Hz
#Calculations
R=(2*3.14*f*L)/Q
C=(1/((2.0*3.14*f)**2*L))/10**-6
#Output
print"Capacitance and resistance of coil is ",round(C,2),"micro F and",R,"ohms respectively"
```