from __future__ import division
from sympy import symbols, solve
#refractive index
l=0.47##in db
nf=10**((l/-10))##
x=symbols("x")
p=1+-2.22*x+x**2##
y=solve(p,x)##
print "refractive index = %0.2F"%y[1]
from __future__ import division
from math import log10, acos, pi
#loss
print "part (a)"
dya=0.1##
n1=1.50##refrative index
na=1##
k1=n1/n1##
k2=1##
nf=((16*(n1)**2)/((n1+1)**4))##
nlat=(2/(3.14))*(acos(dya/2)-(dya/2)*(1-(dya/2)**2)**(1/2))##
nt=nf*nlat##
lt=(-10*log10(nt))##in dB
print "insertion loss at the joint = %0.2f dB"%lt
print "part (b)"
dya=0.1##
n1=1.50##refrative index
na=1##
k1=n1/n1##
k2=1##
nf=((16*(n1)**2)/((n1+1)**4))##
nlat=(2/(pi))*(acos(dya/2)-(dya/2)*(1-(dya/2)**2)**(1/2))#
nt=k2*nlat##
lt=(-10*log10(nt))##in dB
print "insertion loss at the joint = %0.3f dB"%lt
from __future__ import division
from math import sqrt,pi,acos,log10
#loss
d=100##micro meter
dx=0##
dy=3##in micro mete
dth=3##in degree
dthr=dth*(pi/180)##
dya=0.02##
n1=1.48##refrative index
na=1##
k1=n1/n1##
k2=1##
nf=((16*(n1)**2)/((n1+1)**4))##
nlat=(2/(pi))*(acos(dy/100)-(dy/100)*(1-(dy/100)**2)**(1/2))##
NA=n1*(sqrt(2*dya))##
nang=((1-(na*dthr)/(pi*NA)))##
nt=nf*nlat*nang##
lt=(-10*log10(nt))##in dB
print "total loss = %0.2f dB"%lt
from __future__ import division
from scipy import log10
#loss
d1=80##micro meter
na1=0.25##
alpha1=2##
d2=60##in micro meter
na2=0.21##
alpha2=1.9##
ncd=(d2/d1)**2##
nna=(na2/na1)**2##
nalpha=((1+(2/alpha1))/(1+((2/alpha2))))##
nt=ncd*nna*nalpha##
lt=(-10*log10(nt))##in dB
print "total loss = %0.4f dB"%lt
from __future__ import division
from scipy import log10
#loss
d1=60##micro meter
na1=0.25##
alpha1=2.1##
d2=50##in micro meter
na2=0.20##
alpha2=1.9##
ncd=(d2/d1)**2##
nna=(na2/na1)**2##
nalpha1=1##
nalpha=((1+(2/alpha1))/(1+((2/alpha2))))##
ncd1=1##
nna1=1##
nt=ncd*nna*nalpha1##
ltf=(-10*log10(nt))##in dB
nt1=ncd1*nna1*nalpha##
ltb=(-10*log10(nt1))##in dB
print "total loss forward direction = %0.2f dB"%ltf
print "total loss backward direction = %0.3f dB"%ltb