question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_tower_through_a_small_telescope do 4 kind :numerical 5 describes "A small telescope has an objective lens of focal length %{focal_length}. The telescope is used to " \ 6 "view a %{height} tall tower %{distance} away. %{image_height}, in cm, counted negative when " \ 7 "inverted?" 8 given focal_length: "140 cm" 9 given height: "100 m" 10 given distance: "3 km" 11 asks image_height: "What is the height of the image of the tower formed by the objective lens" 12 end
1 require_relative "../questions/a_tower_through_a_small_telescope" 2 require_relative "../science/ray_optics_and_optical_instruments/thin_lens" 3 4 solve :a_tower_through_a_small_telescope , using: ThinLens do 5 objects :objective 6 7 take focal_length: objective . focal_length 8 take height: objective . object_height 9 take distance: objective . distance_in_front 10 11 image_height = objective . image_height 12 answer image_height :, in: "cm" , figures: 2 13 14 conclusion "The tower is far compared with the focal length, so its real, inverted image forms almost at the " \ 15 "focus, scaled down by the ratio of the two distances." 16 end
1 require_relative "../solutions/a_tower_through_a_small_telescope" 2 3 play_with :a_tower_through_a_small_telescope do 4 title "A Tower Through a Small Telescope" 5 end