Geometrical Optics: Lenses & Mirrors Simulator

Programmed by Eidan A. Abdullah – Optics Course, College of Science, Wasit University - Iraq

DOI: 10.5281/zenodo.18070606 · GitHub repository ⭐ (support the project)
Lens Type & Sign Convention
Convex (+f)
Concave (−f)
Thin-Lens Equation:
1/f = 1/s + 1/s′
  • f > 0 convex, f < 0 concave
  • s > 0 object on the left (real object)
  • s < 0 object on the right (virtual object on image side)
  • s′ > 0 real image (right), s′ < 0 virtual (left)
Object & Lens Parameters
Focal length |f| (cm) 15.00 cm
Object distance s (cm) 30.00 cm
Positive: object on the left of the lens (real object).
Negative: object on the right of the lens (virtual object, s < 0).
Object height y (cm) 10.00 cm
Rays & Examples
Image distance s′
Image height y′
Magnification M
Nature
Position
Adjust parameters to see how the sign of s and s′ controls the nature of the image.
Lens 1 & Lens 2 Types
Lens 1: Convex
Lens 1: Concave
Lens 2: Convex
Lens 2: Concave
Two-Lens System
  • Lens 1: 1/f₁ = 1/s₁ + 1/s₁′
  • Lens 2: 1/f₂ = 1/s₂ + 1/s₂′
  • s₂ = d − s₁′ (with signs!)
  • Total magnification M = M₁ · M₂
Parameters
|f₁| (cm)
|f₂| (cm)
Object distance s₁ (cm)
s₁ < 0 ⇒ virtual object for lens 1 (on right side).
Lens separation d (cm)
Object height y (cm)
s₁′
s₂
s₂′
Total M
Final y₂′
Lens 1 forms an intermediate image that acts as the object for Lens 2. The signs of s₁′ and s₂ are crucial.
Section 3: Lens Maker's Formula
Refractive index n 1.52
Enter refractive index value directly.
Front radius R₁ (cm) +15.0
Positive → convex toward object. Negative → concave.
Back radius R₂ (cm) +5.0
Positive → convex toward image. Negative → concave.
Lens Maker’s Formula:
1/f = (n − 1) (1/R₁ − 1/R₂)
  • R₁, R₂ in meters
  • Plano: |R| → ∞ → 1/R = 0
  • Optical power P = 1/f
Focal length f
Optical power P
Lens type
R₁ (cm)
R₂ (cm)
Move n, R₁ and R₂. The program uses the exact Lens Maker's formula and draws each spherical surface from its radius. Very large |R| (> 300 cm) is treated as plano (flat surface). Centers of curvature C₁ and C₂ are marked to make the sign convention visually clear.
Mirror Type & Sign Convention
Concave Mirror (+f)
Convex Mirror (−f)
Spherical Mirror Equation:
1/f = 1/s + 1/s′
  • f > 0 concave mirror, f < 0 convex mirror
  • s > 0 real object (in front of mirror)
  • s < 0 virtual object (behind mirror)
  • s′ > 0 real image (in front of mirror)
  • s′ < 0 virtual image (behind mirror)
Object & Mirror Parameters
Radius of curvature |R| (cm) 15.00 cm
Object distance s (cm) 30.00 cm
Positive: object in front of the mirror (real object).
Negative: object behind the mirror (virtual object, s < 0).
Object height y (cm) 10.00 cm
Rays
Image distance s′
Image height y′
Magnification M
Nature
Position
Adjust parameters to explore image formation in spherical mirrors.