import math
#Initialisation
V=50 #Voltage
I=5 #Current in Ampere r.m.s
phase=30 #in degrees
#Calculation
S=V*I #apparent power
pf=math.cos(phase*math.pi/180) #power factor
apf=S*pf #active power
#Result
print'(a) Apparent power, S = %d VA'%S
print'(b) Power Factor = %.3f'%pf
print'(c) Active Power, P = %.1f'%apf
import math
#Initialisation
pf=0.75 #power factor
S=2000 #apparent power in VA
V=240 #Voltage in volts
#Calculation
apf=S*pf #active power
sin=math.sqrt(1-(pf**2))
Q=S*sin #Reactive Power
I=S*V**-1 #Current
#Result
print' Apparent Power, P = %d W'%S
print' Active Power, P = %d W'%apf
print' Reactive Power, Q = %d var'%Q
print' Current I = %.2f A'%I
import math
#Initialisation
pf=0.75 #power factor
S=1500 #apparent power in W
V=240 #Voltage in volts
P1 = 2000 #apparent power
P2 = 1500 #active power
Q = 1322 #reactive power
I = 8.33 #current in amp
f=50 #frequency in hertz
#Calculation
Xc=V**2/Q #reactive capacitance
C=1/(Xc*2*math.pi*f) #capacitance
I=S*V**-1 #current
#Result
print' Apparent Power, S = %d W'%S
print' Active Power, P = %d W'%apf
print' Reactive Power, Q = %d var'%Q
print' Current I = %.2f A'%I
import math
import numpy as np
#Initialisation
Zo=complex(50,-20) #complex form of output impedance
#Calculation
Zl=np.conjugate(Zo) #complex form of Load impedance
#Result
print'Zl = %s'%Zl