from sympy import symbols, sqrt
#Given data :
epsilon_o, mu_o = symbols('epsilon_o, mu_o ')
epsilon=2*epsilon_o
mu=2*mu_o
v=(1/sqrt(mu*epsilon))
print "v =",v," ...eqn(1)"
c = 1/sqrt(epsilon_o*mu_o) # formula
print "c =",c," ...eqn(2)"
c=3*10**8 #speed of light in m/s
v=c/2 #in m/s(from above 2 eqn)
print "These two equation gives,"
print "Velocity of light in medium %0.1e m/s " %v
from math import asin, pi
#Given data :
n1=1.5 #refractive index
n2=1.47 #refractive index
#Formula : sin(theta_c)=n2/n1
theta_c=asin(n2/n1)*180/pi #in Degree
print "Critical Angle = %0.2f Degree" %theta_c
#Note : Answer in the book is wrong.
from math import sin
#Given data :
n1=1.52 #refractive index
#Formula : sin(theta_c)=n2/n1
theta_c=73.2 #in Degree
n2=n1*sin(theta_c*pi/180)
print "Refractive Index of another medium = %0.2f" %n2
#Given data :
n=1.33 #refractive index
#Formula : velocity_of_light_in_medium=velocity_of_light_in_free_space/Refractive_Index
c=3*10**8 #in m/s
v=c/n #in m/s
print "velocity of light in medium = %0.2e m/s" %v
#Given data :
c=3*10**8 #in m/s
v=1.1*10**8 #in m/s
#Formula : velocity_of_light_in_medium=velocity_of_light_in_free_space/Refractive_Index
n=c/v #in m/s
print "Refractive Index of medium = %0.2f " %n