In [2]:

```
# resistance
import math
#Variable declaration
Iz=10*10**-3 # reverse current in ampere
Vz=0.05 # zener voltage in volts
#Calculations
Rz=Vz/Iz # resistance in ohm
#Result
print("resistance (ohm) = %.f "%Rz);
```

In [1]:

```
# terminal voltage
import math
#Variable declaration
v=4.7 # in volts
r=15 # in ohm
i=20*10**-3 # in ampere
#Calculations
Vz=(v+(i*r)) # terminal voltage in volts
#Result
print("terminal voltage = %.f V"%Vz)
```

In [6]:

```
# tuning range of the circuit
import math
#Variable declaration
C1=5.0*10**-12 # minimum capacitance in farad
C2=50.0*10**-12 # maximum capacitance in farad
L=10.0*10**-3 # in henry
#Calculations
CTmin= (C1/2) # minimum total capacitance of varactor diode
p= (math.sqrt(L*CTmin)) # calculating square root
q= (2*math.pi*p)
fomax= (1/q) # maximum resonant frequency
CTmax= ((C2*C2)/(C2+C2)) # maximum total capacitance of varactor diode
r= (math.sqrt(L*CTmax)) # calculating square root
s= (2*math.pi*r)
fomin= (1/s) # minimum resonant frequency
#Result
print("maximum resonant frequency = %.f MHz"%(fomax/10**6))
print("minimum resonant frequency = %.f kHz"%(fomin/1000))
```

In [9]:

```
# standard resistor
import math
#Variable declaration
vf=1.8 # in volts
If=16*10**-3 # in ampere
vo=8 # in volts
#Calculations
rs=(vo-vf)/If # resistor in ohm
#Result
print("standard resistor (ohm) = %.1f"%rs)
```

In [9]:

```
# min and max value of led current
import math
#Variable declaration
v1=1.5 # in volts
v2=2.3 # in volts
vs=10.0 # in volts
r1=470.0 # in ohm
#Calculations
I1=(vs-v1)/r1 # in ampere
I2=(vs-v2)/r1 # in ampere
#Result
print("maximum current = %.1f mA"%(I1*10**3))
print("minimum current = %.1f mA"%(I2*10**3))
```

In [13]:

```
# which supply voltage will keep brighness of diode constant
import math
#Variable declaration
v1=1.8 # in volts
v2=3.0 # in volts
vs=24.0 # in volts
rs=820.0 # in ohms
vs1=5.0 # in volts
rs1=120.0 # in ohms
r1=470.0 # in ohmI1=(vs-v1)/r1; // in ampere
#Calcualtions
# case1
Imin=((vs-v2)/rs)
Imax=((vs-v1)/rs)
# case2
Imin1=((vs1-v2)/rs1)
Imax1=((vs1-v1)/rs1)
#Result
print("maximum current in ampere in case1 = %.1f mA"%(Imax*10**3))
print("minimum current in ampere in case1 = %.1f mA"%(Imin*10**3))
print("maximum current in ampere in case2 = %.1f mA"%(Imax1*10**3))
print("minimum current in ampere in case2 = %.1f mA"%(Imin1*10**3))
print("\nBrightness in the first case will remain constant")
print("where as in second case it will be changing,")
print("Therefore, in order to get an approximately constant")
print("brighntness we use as large a supply voltage as possible.")
```

In [14]:

```
# photocurrent
import math
#Variable declaration
r=0.85 # reponsivity of a photodiode in apmere per watt
p1=1.0 # incident light power in milli watt
#Calculations
Ip=r*p1
#Result
print("photocurrent = %.2f mA"%Ip)
```

In [20]:

```
# photocurrent
import math
#Variable declaration
r=0.85 # reponsivity of a photodiode in apmere per watt
p1=2.0 # incident light power in milli watt
#Result
print("Given input power saturation is 1.5mw so Ip is not proportional to Pop")
print("hence we cannot find the value of photocurrent")
```

In [15]:

```
# quantum efficiency
import math
#Variable declaration
EHP=5.4*10**6
photons=6*10**6
#Calcualtions
n=EHP/photons
#Result
print("Quantum efficiency = %.1f"%n)
```

In [1]:

```
# Responsivity
import math
#Variable declaration
h=6.62*10**-34 # planc's constant
c=3*10**8 # speed of light in vaccum
e=0.70 # efficiency
Eg=0.75*1.6*10**-19 # Energy gap in volts
#Calculations
w=((h*c)/Eg) # wavelength in meters (This answer is wrong in the book)
w = 1664*10**-9 # value used in book
R=((e/1248.0)*w) # in ampere per watt
#Result
print("Responsivity = %.3f * 10^-10 AW^-1"%(R*10**10))
```