# chapter1 - Overview of optical fiber communications¶

## Example 1.6.1, page 1-15¶

In [6]:
from __future__ import division
Bit_rate = 2*10**9       # bit rate of channel
# Given sequence is 010111101110
Shortest_duration = 1*(1/Bit_rate)      # shortest duration is '1'
Widest_duration = 4*(1/Bit_rate)      #widest duration is '1111'
Shortest_duration = Shortest_duration        # seconds
Widest_duration = Widest_duration      # seconds
print "Shortest duration is %.1g seconds." %Shortest_duration
print "Widest duration is %.1g seconds." %Widest_duration

Shortest duration is 5e-10 seconds.
Widest duration is 2e-09 seconds.


## Example 1.12.1, page 1-28¶

In [8]:
from __future__ import division
from numpy import log2
Bandwidth = 2*10**6      #Bandwidth of channel
Signal_to_Noise_ratio = 1               #Signal to Noise ratio of channel
Capacity = Bandwidth * log2(1 + Signal_to_Noise_ratio)  #computing capacity
Capacity=Capacity/10**6
print "Maximum capacity of channel is %d Mb/sec." %Capacity

Maximum capacity of channel is 2 Mb/sec.


## Question 10, page 1-31¶

In [9]:
from __future__ import division
Bit_rate = 2*10**9       # bit rate of channel
# Given sequence is 010111101110
Shortest_duration = 1*(1/Bit_rate)      # shortest duration is '1'
Widest_duration = 4*(1/Bit_rate)      #widest duration is '1111'
Shortest_duration = Shortest_duration        # seconds
Widest_duration = Widest_duration      # seconds
print "Shortest duration is %.1g seconds." %Shortest_duration
print "Widest duration is %.1g seconds." %Widest_duration

Shortest duration is 5e-10 seconds.
Widest duration is 2e-09 seconds.