question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :an_object_before_a_concave_mirror do 4 kind :numerical 5 describes "An object is placed %{distance} in front of a concave mirror of radius of curvature %{radius}. " \ 6 "%{where}, in cm, measured along the incoming light from the mirror?" 7 given distance: "10 cm" 8 given radius: "15 cm" 9 asks where: "Where is the image" 10 end
1 require_relative "../questions/an_object_before_a_concave_mirror" 2 require_relative "../science/ray_optics_and_optical_instruments/spherical_mirror" 3 4 solve :an_object_before_a_concave_mirror , using: SphericalMirror do 5 objects :mirror 6 7 take distance: mirror . distance_in_front 8 take radius: mirror . size_of_the_radius 9 10 deduce_from "concave" , mirror . radius_of_curvature => - mirror . size_of_the_radius 11 12 where = mirror . image_distance 13 answer where :, in: "cm" , figures: 2 14 15 conclusion "Distances in front of the mirror are negative; the image at minus thirty centimetres is real, " \ 16 "in front of the mirror, inverted and three times the size." 17 end
1 require_relative "../solutions/an_object_before_a_concave_mirror" 2 3 play_with :an_object_before_a_concave_mirror do 4 title "An Object Before a Concave Mirror" 5 end