In [1]:

```
import math
import scipy.integrate
#Variable declaration
def integrand(theta, phi):
return (math.cos(theta)*math.sin(theta))
#Integrand (unitless)
Um = 1 #Maximum radiation intensity (unitless)
#Calculation
P = scipy.integrate.dblquad(integrand, 0, 2*math.pi,
lambda x: 0, lambda x: math.pi/2)
#Total power radiated (relative to Um)
D = (4*math.pi)/P[0] #Directivity (unitless)
#Result
print "The directivity is ", round(D)
```

In [2]:

```
import math
import scipy.integrate
#Variable declaration
def integrand(theta, phi):
return (math.cos(theta)*math.sin(theta))
#Integrand (unitless)
Um = 1 #Maximum radiation intensity (unitless)
#Calculation
P = scipy.integrate.dblquad(integrand, 0, 2*math.pi,
lambda x: 0, lambda x: math.pi/2)
#Total power radiated (relative to Um)
D = (4*math.pi)/(2*P[0]) #Directivity (unitless)
#Result
print "The directivity is ", round(D)
```

In [3]:

```
import math, scipy.integrate
#Variable declaration
def integrand(theta, phi):
return (math.sin(theta)**2)
#Integrand (unitless)
Um = 1 #Maximum radiation intensity (unitless)
#Calculation
P = scipy.integrate.dblquad(integrand, 0, 2*math.pi,
lambda x: 0, lambda x: math.pi)
#Total radiated power (relative to Um)
D = 4*math.pi/P[0] #Directivity (unitless)
#Result
print "The directivity is", round(D,2)
```

In [4]:

```
import math, scipy.integrate
#Variable declaration
def integrand(theta, phi):
return (math.sin(theta)**3)
#Integrand (unitless)
Um = 1 #Maximum radiation intensity (unitless)
#Calculation
P = scipy.integrate.dblquad(integrand, 0, 2*math.pi,
lambda x: 0, lambda x: math.pi)
#Total radiated power (relative to Um)
D = 4*math.pi/P[0] #Directivity (unitless)
#Result
print "The directivity is", round(D,2)
```

In [5]:

```
import math, scipy.integrate
#Variable declaration
def integrand(theta, phi):
return (math.sin(theta)*math.cos(theta)**2)
#Integrand (unitless)
Um = 1 #Maximum radiation intensity (unitless)
#Calculation
P = scipy.integrate.dblquad(integrand, 0, 2*math.pi,
lambda x: 0, lambda x: math.pi/2)
#Total radiated power (relative to Um)
D = 4*math.pi/P[0] #Directivity (unitless)
#Result
print "The directivity is", round(D,2)
```

In [6]:

```
import math
#Variable declaration
lobes = [0.25,0.37,0.46,0.12,0.07] #Normalized power of lobes (unitless)
#Calculation
ohm_a = 0 #Beam area (sr)
sum_lobes = 0 #Sum of all lobes (unitless)
for i in lobes:
ohm_a += 2*math.pi*(math.pi/36)*(i)
sum_lobes += i
D = 4*math.pi/ohm_a #Directivity (unitless)
D_db = 10*math.log10(D) #Directivity (in dBi)
e_m = lobes[0]/sum_lobes #Beam efficiency (unitless)
#Result
print "The directivity is", round(D), "or", round(D_db,1), "dBi"
print "The beam efficiency is", round(e_m, 2)
```

In [1]:

```
import math
#Variable declaration
a = 25 #Height of vertical conducting wall (m)
r = 100 #Distance to the receiver (m)
wave_lt = 10e-2 #Transmitter dimension (m)
#Calculation
k = math.sqrt(2/(r*wave_lt)) #contant (unitless)
S_av = (r*wave_lt)/(4*(math.pi**2)*(a**2)) #Relative signal level (unitless)
S_av_db = 10*math.log10(S_av) #Signal level (in db)
#Result
print "The signal level at the receiver is", round(S_av,5), "or", round(S_av_db), "dB"
```