question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :an_object_before_a_concave_lens do 4 kind :numerical 5 describes "An object of size %{size} is placed %{distance} in front of a concave lens of focal length " \ 6 "%{focal_length}. %{where}, in cm, measured along the light from the lens?" 7 given size: "3.0 cm" 8 given distance: "14 cm" 9 given focal_length: "21 cm" 10 asks where: "Where is the image" 11 end
1 require_relative "../questions/an_object_before_a_concave_lens" 2 require_relative "../science/ray_optics_and_optical_instruments/thin_lens" 3 4 solve :an_object_before_a_concave_lens , using: ThinLens do 5 objects :lens 6 7 take size: lens . object_height 8 take distance: lens . distance_in_front 9 take focal_length: lens . size_of_the_focal_length 10 11 deduce_from "concave lens" , lens . focal_length => - lens . size_of_the_focal_length 12 13 where = lens . image_distance 14 answer where :, in: "cm" , figures: 2 15 16 conclusion "A concave lens always forms a virtual, upright image on the same side as the object, between the " \ 17 "lens and its focus." 18 end
1 require_relative "../solutions/an_object_before_a_concave_lens" 2 3 play_with :an_object_before_a_concave_lens do 4 title "An Object Before a Concave Lens" 5 end