In [1]:

```
# Variable Declaration
T = 1.00*pow(10,-3) # Time (s)
Tau = 500.00*pow(10,-6) # Pulse Width (s)
A = 10.00 # Amplitude (V)
# Calculation
import math # Math Library
Coeff1 = A*(Tau/T) # Coefficient 1
Coeff2 = 2*A*(Tau/T)*math.sin((Tau/T)*math.pi)/((Tau/T)*math.pi) # Coefficient 2
Coeff3 = 2*A*(Tau/T)*math.sin(2*(Tau/T)*math.pi)/(2*(Tau/T)*math.pi) # Coefficient 3
Coeff4 = 2*A*(Tau/T)*math.sin(3*(Tau/T)*math.pi)/(3*(Tau/T)*math.pi) # Coefficient 4
# Result
print "The Coefficients of First Four Terms in the Fourier Series are:"
print "Coeff1 =",round(Coeff1)
print "Coeff2 =",round(Coeff2,3)
print "Coeff3 =",round(Coeff3)
print "Coeff4 =",round(Coeff4,3)
print "f(t) = [",round(Coeff1),"] + [",round(Coeff2,3),"cos(2pi*10^3*t) ] + [",round(Coeff3),"] + [",round(Coeff4,3),"cos(6pi*10^3*t)","]"
```

In [2]:

```
# Variable Declaration
f = 0.50*pow(10,3) # First Zero Crossing (Hz)
Fw_max = 8.00*pow(10,-3) # Amplitude (V)
# Calculation
import math # Math Library
Tau = 1/f # Pulse Duration (s)
A = Fw_max/Tau # Maximum Voltage (V)
# Result
print "The single pulse has a maximum voltage of",round(A),"V and a duration of",round(Tau*pow(10,3)),"ms."
```