#lambda is very small
lamda=0.0001
#Length of infinitesimal dipole
l=lamda/50
#Calculation of radiation resistance
R_r=80*(pi**2)*(l/lamda)**2
print 'Radiation resisitance:',R_r,'Ohms'
#Lamda is a variable value in this example and therefore we will write a function to calculate the differences by passing different values of lambda
def phase_diff(z,r,lamda):
R1=sqrt(z**2+r**2)
R2=r
phase_diff=(2*pi/lamda)*(R1-R2)
print 'The phase difference is:',phase_diff,'radians.'
def amp_diff(z,r,lamda):
R1=sqrt(z**2+r**2)
R2=r
amp_diff=(1/R1)-(1/R2)
print 'The amplitude difference is:',amp_diff
#We will assume lamda = 50
lamda=50
#Given
l=5*lamda
r=60*lamda
#z=2.5lamda at 90 degree
z=2.5*lamda
phase_diff(z,r,lamda)
amp_diff(z,r,lamda)
#Given is the input resistance of dipole
R=50
#Calculation of gain G
G=pow(float(R)/24.7,1/2.5)
print G