# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.1
# calculation of position of the image of an object placed at a distance from the mirror.
# given data
u=-12.; # object distance(in cm)
R=20.; # radius of curvature of the mirror (in cm)
# calculation
v=1./((2./R)-(1./u)); # mirror formula
if(v>0) :
print 'virtual image is formed on right side of mirror at a distance(in cm)',v
else :
print 'real image is formed on left side of mirror at a distance(in cm)',v
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.2
# calculation of length of the image of an object placed at a distance from a concave mirror.
# given data
# F=-f focal length(in cm)
# u=-1.5f object distance(in cm)
h1=2.5; # object height(in cm)
# calculation
# v=1/((1/F)-(1/u)) mirror formula
# v=-3f
# also m=-v/u lateral magnification formula for mirror
# m=-2 lateral magnification ratio
m=-2.; # lateral magnification ratio
h2=m*h1; # lateral magnification formula
if(h2>0) :
print'image is erect and is of length(in cm)',h2
else :
print'image is inverted and is of length(in cm)',h2
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.3
# calculation of shift in the position of printed letters by a glass cube
# given data
t=6.; # thickness of the cube(in cm)
mu=1.5; # refractive index of glass cube
# calculation
deltat=(1.-1./mu)*t; # vertical shift formula derived from snell's law
print'shift(in cm) in the position of printed letters is',deltat
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.4
# calculation of refractive index of material from known critical angle
import math
# given data
thetac=48.2; # critical angle for water(in degree)
# calculation
# snell's law with respect to total internal reflection
mu=1.34;#1./math.sind(thetac); # sind represents that the argument is in degree
print'refractive index of material is ',mu
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.5
# calculation of refractive index of material from known value of angle of minimum deviation by prism
# given data
deltam=37.; # angle of minimum deviation by prism of the material(in degree)
A=53.; # angle of prism(in degree)
# calculation
mu=1.58;#sind((A+deltam)/2.)/sind(A/2.); # relation between refractive index and angle of minimum deviation by prism
print'refractive index of material of the prism is',mu
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.6
# calculation of position of the image of an object placed at a distance from spherical convex surface
# given data
u=-15.; # object distance(in cm)
R=30.; # radius of curvature of the spherical convex surface(in cm)
mu1=1.; # refractive index of the medium in which object is kept
mu2=1.5; # refractive index of the medium of spherical convex surface
# calculation
v=mu2/((mu2-mu1)/R+(mu1/u)); # formula for refraction at spherical surface
if(v>0) :
print'real image is formed on right side of spherical surface at a distance(in cm)',v
else :
print'virtual image is formed on left side of spherical surface at a distance(in cm)',v
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.7
# calculation of the size of the image of an object placed at a distance from the spherical concave surface
# given data
u=-40.; # object distance(in cm)
R=-20.; # radius of curvature of the spherical concave surface(in cm)
mu1=1.; # refractive index of the medium in which object is kept
mu2=1.33; # refractive index of the medium of spherical concave surface
h1=1.; # size of the object(in cm)
# calculation
v=mu2/((mu2-mu1)/R+(mu1/u)); # formula for refraction at spherical surface
h2=(mu1*v*h1)/(mu2*u); # formula for lateral magnification
if(h2>0) :
print'image is erect and is of size(in cm)',h2
else :
print'image is inverted and is of size(in cm)',h2
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.8
# calculation of focal length of a biconvex lens from known value of radii of curvature of refracting surfaces
# given data
R1=20.; # radius of curvature(in cm) of first surface of biconvex lens
R2=-20.; # radius of curvature(in cm) of second surface of biconvex lens
mu=1.5; # refractive index of the material of lens
# calculation
f=1./((mu-1.)*(1./R1-1./R2)); # lens maker's formula
print'focal length(in cm) of the given biconvex lens is',f
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.9
# calculation of size of the image of an object placed at a distance from a convex lens
# given data
f=12. # focal length(in cm)
u=-8. # object distance(in cm)
h1=2.; # object height(in cm)
# calculation
v=1./((1./f)+(1./u)); # lens formula
m=v/u; # lateral magnification formula for lens
h2=m*h1; # lateral magnification formula for lens
if(h2>0) :
print'image is erect and is of length(in cm)',h2
else :
print'image is inverted and is of length(in cm)',h2
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.1w
# calculation of position and nature of the image of an object placed at a distance from a concave mirror
# given data
u=-8.; # object distance(in cm)
f=-10.; # focal length of the concave mirror(in cm)
# calculation
v=1./((1./f)-(1./u)); # mirror formula
if(v>0) :
print'virtual image is formed on right side of mirror at a distance(in cm)',v
else :
print'real image is formed on left side of mirror at a distance(in cm)',v
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.2w
# calculation of length of the image of an object placed horizontal at a distance from the mirror.
# given data
u=-30.; # object distance of point A(in cm)
f=-10.; # focal length of the mirror(in cm)
# r=2f=20 cm
# image of B is formed at centre of curvature since it is located at the centre of curvature.
# calculation
v=1./((1./f)-(1./u)); # mirror formula
print'length(in cm) of the image is',v+(2*-f)
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.3w
# calculation of object distance for half image height as compared to original height in case of reflection by convex mirror
# given data
m=.5; # magnification ratio
f=2.5; # focal length of the convex mirror(in m)
# calculation
# (1/u)+(1/v)=(1/f); # mirror formula
# now m=-v/u=0.5
u=-f; # from formula taking v=-u/2 mirror formula gives this relation
print'the boy should stand at a distance(in m) from the convex mirror',abs(u)
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.4w
# calculation of image distance and focal length of concave mirror
# given data
h1=2.; # height of object(in cm)
h2=-5.; # height of image(in cm)
u=-12.; # object distance in cm
# calculation
v=-(h2/h1)*u # image distance(in cm) using formula of lateral magnification
if(v<0) :
print'image is formed on same side of object at a distance(in cm)',-v
else :
print'image is formed on opposite side of mirror at a distance(in cm)',v
f=(u*v)/(u+v); # mirror formula
print'focal length(in cm) of the given concave mirror is',abs(f)
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.5w
# calculation of maximum angle of reflection for a surface
# given data
mu=1.25; # refractive index of medium
# calculation
thetadashdash=53.1;#asind(1/mu); # critical angle for total internal reflection(in degree)
thetadash=36.9;#90-thetadashdash;
theta=48.6;#asind(mu*sind(thetadash)); # snell's law sin(theta)/sin(thetadash)=mu
print'maximum value of theta(in degree) for total internal reflection at vertical surface',theta
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.6aw
# calculation of minimum refractive index for parallel emergence for given condition in right prism
# given data
thetac=45.; # critical angle(in degree) for given conditions
# calculation
mu=1.41;#1./(sind(thetac)); # anell's law
print'for total internal reflection refractive index of material of given right prism should be greater than or equal to',mu
#6b
# given data
mu=5./3.; # refracive index of the material of the right prism
# calculation
thetac=36.9;#asind(1/mu) # snell's law
if(thetac<60) :
print'total internal reflection does not take place for given conditions of right prism'
else :
print'total internal reflection do take place for given conditions of right prism'
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.11w
# locating image of a dust particle on the surface of water filled in a concave mirror as observed from top
# given data
R=-40.; # radius of curvature(in cm) of the concave mirror
u=-5.; # object distance(in cm) from the concave mirror
mu=1.33; # refractive index of water
# calculation
v=1./((2./R)-(1./u))# mirror formula
if(v>0) :
print'virtual image is formed due to reflection through concave mirror below surface of mirror at a depth(in cm) of ',v
else :
print'real image is formed due to reflection through concave mirror above surface of mirror at a height(in cm) of ',v
total_distance=v+(-u); # water is filled upto height equal to object distance of dust particle P
vfinal=total_distance*(1.-1./mu); # snell's law
print'final image is formed below water surface at a distance(in cm)',total_distance-vfinal
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.12w
# calculation of position of final image formed due to a system of glass slab and a concave mirror
# given data
u=-21.; # object distance(in cm) from concave mirror
R=20.; # radius of curvature(in cm) of the concave mirror
mu=1.5; # refractive index of the glass'
t=3.; # thickness of glass slab(in cm)
# calculation
tshift=t*(1.-1./mu); # snell's law
img_pos=-u-tshift; # image position with respect to glass slab,i.e object distance(in cm) of concave mirror
if(img_pos==R) :
print'here img_pos is same as radius of curvature of concave mirror and thus final image is formed at P itself'
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.13w
# calculation angle of minimum deviation for equilateral prism of silicate flint glass from known vlue of wavelength
import math
# given data
A=60.; # angle of prism(in degree)
mu1=1.66; # refractive index of silicate flint glass for 400nm wavelength
mu2=1.61; # refractive index of silicate flint glass for 700nm wavelength
# calculation
# mu=sind((A+deltam)/2)/sind(A/2) relation between refractive index and angle of minimum deviation by prism
deltam1=52.2;#2.*((asind(mu1*sind(A/2.)))-30.);
deltam2=47.2;#2.*((asind(mu2*sind(A/2.)))-30.);
print'minimum angle of deviation(in degree) for 400nm wavelength in equilateral prism of silicate flint glass is',deltam1
print'minimum angle of deviation(in degree) for 700nm wavelength in equilateral prism of silicate flint glass is',deltam2
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.14w
# calculation of angle of rotation of the mirror in given setup
# given data
mu=1.5; # refractive index of convex lens
A=4.; # angle of prism (in degree)
# calculation
delta=(mu-1.)*A
print'the mirror should be rotated by angle(in degree) of',delta
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.15w
# calculation of location of the image of an object placed at a distance from the spherical convex surface
# given data
u=-25.; # object distance(in cm)
R=20.; # radius of curvature of the spherical convex surface(in cm)
mu1=1.; # refractive index of the medium in which object is kept
mu2=1.5; # refractive index of the medium of spherical convex surface
# calculation
v=mu2/((mu2-mu1)/R+(mu1/u)) # formula for refraction at spherical surface
if(v>0) :
print'image is formed on the right of the separating surface at a distance(in cm) of',v
else :
print'image is formed on the left of the separating surface at a distance(in cm) of',v
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.16w
# calculation of height of the image of an object placed along axis ,at a distance from a horizontal cylindrical glass rod
# given data
u=-20.; # object distance (in cm)
R=5.; # radius of curvature of the spherical convex surface (in cm)
mu1=1.; # refractive index of the medium in which object is kept
mu2=1.5; # refractive index of the medium of spherical concave surface
h1=.5; # height of the object in mm
# calculation
v=mu2/((mu2-mu1)/R+(mu1/u)) # formula for refraction at spherical surface
m=(mu1*v)/(mu2*u); # lateral magnification ratio
if(v>0) :
print'image is formed inside the rod at a distance(in cm) of',v
if(m==-1) :
print'the image will be of same height as the object and is inverted'
if(m==1) :
print'the image will be of same height as the object and is erect'
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.17w
# calculation of apparent depth of a air bubble inside a glass sphere
# given data
u=-4.; # object distance (in cm)
R=-10.; # radius of curvature of the spherical glass sphere(in cm)
mu1=1.5; # refractive index of the glass sphere
mu2=1.; # refractive index of air bubble
# calculation
v=mu2/((mu2-mu1)/R+(mu1/u)) # formula for refraction at spherical surface
if(v<0) :
print'below the surface the bubble will appear at a distance(in cm) of',-v
else :
print'above the surface the bubble will appear at a distance(in cm) of',v
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.18w
# calculation of position of image due to refraction at the first surface and position of final image
# given data1
# u=infinite object distance (in cm)
R=2.; # radius of curvature of the spherical convex surface (in mm)
mu1=1.33; # refractive index of the medium from which light beam is entering
mu2=1.; # refractive index of the medium of spherical air bubble
nR=-2.; # radius of curvature of the spherical convex surface (in mm)
nmu1=1.; # refractive index of the medium in which previous image is formed
nmu2=1.33; # refractive index of the medium from which light beam is entering
# calculation
v=R/(mu2-mu1) # formula for refraction at spherical surface for object at infinite distance
nu=-(-v+-(2.*nR))
if(v<0) :
print'virtual image is formed on the same side of water at a distance(in mm) of',-v
else :
print'real image is formed on the other side of water at a distance(in mm) of',v
nv=nmu2/((nmu2-nmu1)/nR+(nmu1/nu)) # formula for refraction at spherical surface
if(nv<0) :
print'final image is formed on the same side of air at a distance(in mm) of',-nv
else :
print'final image is formed on the other side of air at a distance(in mm) of',nv
print'from the centre first image is formed on the side from which incident rays are coming at a distance(in mm) of ',-v+R
print'from the centre second image is formed on the side from which incident rays are coming at a distance(in mm) of ',-nv+nR
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.19w
# calculation of focal length of thin lens
# given data
R1=10.; # radius of curvature(in cm) of first surface of given lens
R2=20.; # radius of curvature(in cm) of second surface of given lens
mu=1.5; # refractive index of the material of lens
# calculation
f=1./((mu-1.)*(1./R1-1./R2)); # lens maker's formula
print'focal length(in cm) of the given lens is',f
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.20w
# calculation of position of diverging mirror to obtain real image at the source itself for given system
# given data
u=-15.; # object distance(in cm)
f=10.; # focal length(in cm) of converging lens
fm=12.; # focal length(in cm) of convex mirror
# calculation
v=1./((1./f)+(1./u)); # lens formula
LI1=2.*abs(u);
MI1=2.*abs(fm);
LM=LI1-MI1;
print'on the right of the lens mirror should be placed at a distance(in cm) of',LM
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.21w
# calculation of separation between mirror and the lens for parallel emergence of the final beam
# given data
import math
from math import sqrt
u=-12.; # object distance(in cm)
f=15.; # focal length(in cm) of the converging lens
# calculation
v=1./((1./f)+(1./u)); # lens formula
if(v<0) :
print'image due to lens is formed on the left side of the lens at a distance(in cm) of',-v
else :
print'image due to lens is formed on the right side of the lens at a distance(in cm) of',v
I1L=2.*abs(v);
LI2=abs(f);
I1I2=I1L+LI2;
# let distance of mirror from I2 is x
# I1I2=75 cm
# u=-(75+x) cm
# v=-x cm
# f_mirror=-20 cm
# (1/v)+(1/u)=(1/f); mirror formula
# substituting u,v,f we get equation x**2+35*X-1500=0
a=1.; # for above equation coefficient of x**2
b=35.; # for above equation coefficient of x**1
c=-1500.; # for above equation coefficient of x**0 or the constant
x1=(-b+sqrt((b*b)-(4.*a*c)))/(2.*a); # first solution
x2=(-b-sqrt((b*b)-(4.*a*c)))/(2.*a); # second solution
# considering only the positive value of the solution ,as negative value has no physical meaning
if(x1>0) :
print'the separation(in cm) between the lens and the mirror is',f+x1,
if(x2>0) :
print'the separation(in cm) between the lens and the mirror is',f+x2
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.22w
# calculation of object distance from the lens with one side silvered
# given data
v=-25.; # image distance (in cm)
R=25.; # radius of curvature of the spherical convex surface (in cm)
mu1=1.; # refractive index of the medium in which object is kept
mu2=1.5; # refractive index of the medium of lens
# calculation
u=mu1/((mu2/v)-((mu2-mu1)/R)); # formula for refraction at spherical surface
print'object should be placed at a distance(in cm) of',abs(u)
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.23w
# calculation of location of image of an object placed in front of a concavo-convex lens made of glass
# given data
R1=20.; # radius of curvature(in cm) of first surface of concavo-convex lens
R2=60.; # radius of curvature(in cm) of second surface of concavo-convex lens
mu=1.5; # refractive index of the material of lens
u=-80.; # object distance(in cm)
C1C2=160.; # coaxial distance(in cm) between both the lenses
# calculation
f=1./((mu-1.)*(1./R1-1./R2)); # lens maker's formula
print'focal length(in cm) of the given concavo-convex lens is',f
v=1./((1./u)+(1./f)); # lens formula
if(v>0) :
print'first image is formed on right side of first lens at a distance(in cm) of',v
else :
print'first image is formed on left side of first lens at a distance(in cm) of',-v
ff=f; # focal length(in cm) of the second lens same as first lens
uf=v-C1C2 # object distance(in cm) for second lens since image by first lens acts as object of the second lens
vf=1./((1./uf)+(1./ff)); # lens formula
if(vf>0) :
print'final image is formed on right side of second lens at a distance(in cm) of',vf
else :
print'final image is formed on left side of second lens at a distance(in cm) of',-vf
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.24w
# calculation of new focal length of a lens on immersing in water
# given data
f=12.; # focal length(in cm) of the lens
mu1=1.; # refractive index of air
mu2=1.5; # refractive index of glass
mu3=1.33; # refractive index of water
# let (1/R1)-(1/R2)=a variable
# calculation
a=1./((mu2/mu1-1.)*(f)) # refractive mediums in cascading
f_new=1./((mu2/mu3-1.)*a)# refractive mediums in cascading
print'new focal length(in cm) of a lens on immersing it in water is',f_new
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.25w
# calculation of location of final image for an object on the axis of a cylindrical tube containing water closed by an equiconvex lens
# given data
u=-21.; # object distance(in cm)
f=10.; # focal length(in cm) of the lens
mu1=1.; # refractive index of air
mu2=1.5; # refractive index of lens
mu3=1.33; # refractive index of water
# v1 image due to refraction at the first surface
# calculation
# from formula of refraction at the spherical surface
# (mu2/v1)-(1/u)=(mu2-mu1)/R (1)
# (mu3/v)-(mu2/v1)=(mu3-mu2)/-R (2)
# adding (1) and (2)
# (1/v)=(1/(2*R))-(1/28) (3)
# f=1/((mu2-1)*(1/R+1/R)) refractive surfaces in cascade
R=2.*f*(mu2-1.) # refractive surfaces in cascade
v=1./((1./(2.*R))-(1./28.)) # from equation (3)
print'the image is formed inside the cylindrical tube at distance(in cm) of',v
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.26w
# calculation of new position of the slide of projector if the position of the screen is changed
# given data
v=10.; # image distance(in m)
m=500.; # lateral magnification ratio
d=2.; # distance(in m) the screen is moved
# calculation
u=-v/m; # lateral magnification formula
f=1./((1./v)-(1./u)) # lens formula
vdash=v-d # effect of moving screen d m closer
udash=1./((1./vdash)-(1./f)) # lens formula
if(udash<0) :
print'away from the lens,the slide should be moved by a distance(in m) of',-udash
else :
print'towards the lens,the slide should be moved by a distance(in m) of',udash
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.27w
# calculation of position of the object to get a focused image
# given data
v=10.; # image distance(in cm) from the convex lens
u=-10.; # object distance(in cm) from the convex lens
mu=1.5; # refractive index of glass
t=1.5; # thickness(in cm) of the glass plate inserted
# calculation
f=1./((1./v)-(1./u)) # lens formula
I1I=t*(1.-1./mu) # shift in position(in cm) of image due to glass plate
v_new=v-I1I # lens forms image at this distance(in cm) from itself
u_new=1./((1./v_new)-(1./f)) # lens formula
print'from the lens,the object should be placed at a distance(in cm) of',abs(u_new)
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.28aw
# finding the image of a distant object formed by combination of two convex lens by using thin lens formula
# given data
f=20.; # focal length(in cm) of the given convex lens
d=60.; # coaxial separation(in cm) between the two convex lenses
u=-(d-f); # object distance(in cm) for the second lens since first image is formed at focus of first lens
# calculation
v=1./((1./u)+(1./f)); # lens formula
print'final image is formed on the right of the second lens at a distance(in cm) of',v
# developed in windows XP operating system 32bit
# platform Scilab 5.4.1
#clc;clear;
# example 18.28bw
# finding the image of a distant object formed by combination of two convex lens by using equivalent lens method
# given data
f1=20.; # focal length(in cm) of the first convex lens
f2=20.; # focal length(in cm) of the first convex lens
d=60.; # coaxial separation(in cm) between the two convex lenses
# calculation
F=1./((1./f1)+(1./f2)-(d/(f1*f2))); # equivalent focal length formula for equivalent lens method
D=d*F/f1; # distance(in cm) from the second lens at which equivalent lens is to be placed
# image of distant object is formed at focus of equivalent lens
print'on right side of the second lens,the final image is formed at a distance(in cm) of ',abs(D)-abs(F)