import math
##Example 23.1
##calculation of relative permittivity
##given values
E=1000.;##electric field in V/m
P=4.3*10**-8;##polarization in C/m**2
e=8.85*10**-12;##permittivity in F/m
##calculation
er=1.+(P/(e*E));
print'%s %.2f %s'%('relative permittivity of NaCl is ',er,'');
import math
##Example 23.2
##calculation of electronic polarizability
##given values
e=8.85*10**-12;##permittivity in F/m
er=1.0024;##relative permittivity at NTP
N=2.7*10**25.;##atoms per m**3
##calculation
alpha=e*(er-1)/N;
print'%s %.3e %s'%('electronic polarizability (in F/m^2)is ',alpha,'');
import math
##Example 23.3
##calculation of electronic polarizability and relative permittivity
##given values
e=8.85*10**-12.;##permittivity in F/m
N=9.8*10**26.;##atoms per m**3
r=.53*10**-10.;##radius in m
##calculation
alpha=4*math.pi*e*r**3;
print'%s %.3e %s'%('electronic polarizability (in F/m**2)is ',alpha,'');
er=1+(4*math.pi*N*r**3);
print'%s %.2f %s'%('relative permittivity is',er,'')
import math
##Example 23.4
##calculation of electronic polarizability and relative permittivity
##given values
w=32.;##atomic weight of sulphur
d=2.08*10**3.;##density in kg/m**3
NA=6.02*10**26.;##avogadros number
alpha=3.28*10**-40.;##electronic polarizability in F.m**2
e=8.854*10**-12.;##permittiviy
##calculation
n=NA*d/w;
k=n*alpha/(3.*e);
er=(1+2*k)/(1.-k);
print'%s %.2f %s'%('relative permittivity is',er,'')
import math
##Example 23.5
##calculation of ionic polarizability
##given values
n=1.5;##refractive index
er=6.75;##relative permittivity
##calculation
Pi=(er-n**2.)*100./(er-1.);
print'%s %.2f %s'%('percentage ionic polarizability (in %)) is',Pi,'')
import math
##Example 23.6
##calculation of frequency and phase difference
##given values
t=18*10**-6;##relaxation time in s
##calculation
f=1/(2*math.pi*t);
print'%s %.2f %s'%('frequency at which real and imaginary part of complx dielectric constant are equal is',f,'');
alpha=math.atan(1)*180/math.pi;## phase difference between current and voltage( 1 because real and imaginry parts are equal of the dielectric constant)
print'%s %.2f %s'%('phase diffeerence (in degree) is',alpha,'');
import math
##Example 23.7
##calculation of frequency
##given values
t=5.5*10**-3.;##thickness of plate in m
Y=8*10**10.;##Young's modulus in N/m**2
d=2.65*10**3.;##density in kg/m**3
##calculation
f=math.sqrt(Y/d)/(2.*t);##in Hz
print'%s %.2f %s'%('frequency of fundamental note(in KHz) is',f/10**3,'');