from __future__ import division
AC= 1.8-.1#in m
AD=.5*AC
CF=.10#/in m
X=.5*CF#in m
FA=1.8#in m
d=FA-AD-X
print "The hight = %0.2f m"%d
p=25#in cm
f=10#in cm
x=(1/f)-(1/p)
q=1/x
p=25
M=-(q/p)
print "part a"
print "The magnification when object is at 25cm : %0.2f"%M
p=5#in cm
f=10#in cm
x=(1/f)-(1/p)
q=1/x
p=5
M=-(q/p)
print "part c"
print "The magnification when object is at 5cm : %0.2f"%M
p=20#in cm
f=-8#in cm
x=(1/f)-(1/p)
q=1/x
p=25
M=-(q/p)
print "part a"
print "The position of final image = %0.2f cm"%q
print "part b"
print "The magnification : %0.2f"%M
p=40#in cm
q=-(2*p)
x=(1/p)-(1/q)
f=1/x
print "The focal length = %0.2f cm"%f
#Answer given in book is wrong
p=20#in cm
n1=1.5#in cm
n2=1#in cm
R=-30#in cm
x=(n2-n1)/R
y=n1/p
s=x-y
q=1/s
print "The position of final image = %0.2f cm"%q
M=(n1*q)/(n2*p)
print "The magnification when object = %0.2f cm"%M
h=2#in cm
h1=-M*h
print "The Position of image = %0.2f cm"%h1
p=30#in cm
f=10#in cm
x=(1/f)-(1/p)
q=1/x
M=-(q/p)
print "part a"
print "The position of final image = %0.2f cm"%q
print "The magnification : %0.2f"%M
p=5#in cm
f=10#in cm
x=(1/f)-(1/p)
q=1/x
M=-(q/p)
print "part b"
print "The position of final image = %0.2f cm"%q
print "The magnification : %0.2f"%M
p=30#in cm
f=-10#in cm
x=(1/f)-(1/p)
q=1/x
M=-(q/p)
print "part a"
print "The position of final image = %0.2f cm"%q
print "The magnification : %0.2f"%M
p=10#in cm
f=-10#in cm
x=(1/f)-(1/p)
q=1/x
M=-(q/p)
print "part b"
print "The position of final image = %0.2f cm"%q
print "The magnification : %0.2f"%M
p=5#in cm
f=-10#in cm
x=(1/f)-(1/p)
q=1/x
M=-(q/p)
print "part c"
print "The position of final image = %0.2f cm"%q
print "The magnification : %0.2f"%M
p=30#in cm
f=10#in cm
x=(1/f)-(1/p)
q=1/x
M1=-(q/p)
p=5#in cm
f=20#in cm
x=(1/f)-(1/p)
q=1/x
M2=-(q/p)
M=M1*M2
print "The magnification : %0.2f"%M