Lenses: Python Code

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

LENSES

VUW SCPS Physics Laboratory Activity


Page |1

Simulation
1) Create a python code that will generate a value for the location, magnification and height of the
image formed, as well as the nature of the image produced given the focal length of the lens,
type of lens and object distance as input.
Python Code
import numpy as np
from matplotlib import pyplot as plt
O= 15
f= 15
ho = 1
#IMAGE DISTANCE

if(O!=f):
I = 1/((1/f)-(1/O))
#MAGNIFICATION
M = I/O
#IMAGE HEIGHT
hi = M*ho
print("Image distance:", I)
print("Image Height:", hi)
print("Magnification:", M)

if (I>0 and f>0 and 1>M>0) :


print("Image is real, inverted and diminished")
elif (I>0 and f>0 and M==1) : # what condition?
print("Image is real, inverted and same size")
elif (I>0 and f>0 and M>1) : # what condition?
print("Image is real, inverted and magnified")
else:
print("Image is virtual, upright and magnified")
else:
print("no image, since O=F")

Data Gathering: Lenses

Complete the following table:


Nature of Image
Object distance (O) Image distance (I) (upright/inverted, magnified/diminished,
and or real/virtual)
O > 2f 17 cm 13cm Inverted, real, diminished
O = 2f 15 cm 15cm Inverted, real, Constant
75 mm 2f > O > f 10 cm 30cm Inverted, real, magnified
Lens Lines are parallel, no point of
O=f 7.5 cm NA
convergence
O<f 5 cm NA Virtual image
O > 2f 32 cm 28cm Real, inverted, diminished
O = 2f 30 cm 30cm Real, inverted, constant
150 2f > O > f 20 cm 60cm Real, inverted, magnified
mm O=f 15 cm NA Lines are parallel, no point of
Lens convergence
O<f 10 cm NA Virtual image, cannot be seen in
setup.
LENSES
VUW SCPS Physics Laboratory Activity
Page |2

Questions:
1. Compare your theoretical values (from Python) with the experimental values. Comment on the
similarities and differences. Explain the cause of difference in results.

Our python code proved our theoretical values to be accurate as our results only varied by
magnitudes up to 5mm. The slight inaccuracy’s are most likely due to our readings being
misinterpreted, as our method for gathering Image distance was done by estimating(without a
computer).

2. Double-lens System
i) 2 lenses of focal lengths of focal lengths 75 mm and 150 mm are 35 cm apart from each other. If
an object is placed in 15 cm front of the 75 mm – lens, determine the following for the final image
produced by the lens system:
a) Distance of the final image from the 150 mm – lens
60 cm
b) Distance of the final image from the 75 mm – lens
95cm
c) Magnification of the final image with respect to the object
ML1 = 15cm/15cm = 1
ML2 = 60cm/15cm = 4
MT = 4*1 = 4

d) The nature of the image (upright/inverted, magnified/diminished, and or real/virtual)


Upright, magnified, real

ii) Show your working that includes ray diagram for the system.

iii) Set-up the lens-system in the optical bench as shown below.


object 150 mm
Locate the final image and record the
75 mm
distance of the image from the 150 mm
– lens. Compare this experimental value
with your answer in ii.a (Distance of the
final image from the 150 mm – lens).
Explain the cause of the differences in your values.

Our experimental results showed the final image to be at a distance of 59 cm from the 150mm lens,
this value has a 1.68% percentage difference to our theoretical result. The slight inaccuracy’s are
most like likely due to the uncertainty’s in measurements, as we have four different variables(75mm
lense,150mm lensed, object, target) that could be slightly off, skewing our results.

You might also like