import math
import scipy.integrate
#Given
d=10.0
fd_ratio=0.5
f=3*10**9
v=3*10**8
lamda=float(v)/f
theta=math.atan((0.5*fd_ratio)/(fd_ratio**2-(1/16.)))
eff=24*((sin(theta/2))**2+log(cos(theta/2)))**2*(1/tan(theta/2))**2
print "Aperture Efficiency: %d" %(100*eff)
D=eff*((pi*d)/lamda)**2
print "Total directivity: %f dB" %(10*log10(D))
spill_eff=(scipy.integrate.quad(lambda x:(cos(x*pi/180)**2)*sin(x*pi/180),0,53.13)[0])/(scipy.integrate.quad(lambda x:(cos(x*pi/180)**2)*sin(x*pi/180),0,90)[0])
print "Spillover efficiency : %f " %(100*spill_eff)
taper_eff=2*eff/1.568
print "Taper efficiency: %f" %(100*taper_eff)
m=pi/8
direc=(1-(m**2)/2)**2*D
print "directivity for phase error of pi/8 : %f dB" %(10*log10(direc))
#Given
v=3*3.28083*10**8
f=11.2*10**9
lamda=v/f
print "wavelength: %f ft" %lamda
delta=lamda/16
R=5
a=((14.7*(delta/lamda)*R**4)/(R/lamda))**(0.25)
print "Maximum permissible aperture: %f feet"%a