question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :the_candle_s_image do 4 kind :numerical 5 describes "A small candle, %{size} in size is placed at %{distance} in front of a concave mirror of radius of " \ 6 "curvature %{radius}. A screen is placed to obtain a sharp image. %{image_height}, in cm, counted " \ 7 "negative when inverted?" 8 given size: "2.5 cm" 9 given distance: "27 cm" 10 given radius: "36 cm" 11 asks image_height: "What is the size of the image" 12 end
1 require_relative "../questions/the_candle_s_image" 2 require_relative "../science/ray_optics_and_optical_instruments/spherical_mirror" 3 4 solve :the_candle_s_image , using: SphericalMirror do 5 objects :mirror 6 7 take size: mirror . object_height 8 take distance: mirror . distance_in_front 9 take radius: mirror . size_of_the_radius 10 11 deduce_from "concave" , mirror . radius_of_curvature => - mirror . size_of_the_radius 12 13 image_height = mirror . image_height 14 answer image_height :, in: "cm" , figures: 2 15 16 conclusion "The image lies farther from the mirror than the candle does, so it is magnified; being real, it is " \ 17 "inverted." 18 end
1 require_relative "../solutions/the_candle_s_image" 2 3 play_with :the_candle_s_image do 4 title "The Candle's Image" 5 end