question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :the_glass_of_a_double_convex_lens do 4 kind :numerical 5 describes "The radii of curvature of the faces of a double convex lens are %{first} and %{second}. Its focal length " \ 6 "is %{focal_length}. %{index}?" 7 given first: "10 cm" 8 given second: "15 cm" 9 given focal_length: "12 cm" 10 asks index: "What is the refractive index of glass" 11 end
1 require_relative "../questions/the_glass_of_a_double_convex_lens" 2 require_relative "../science/ray_optics_and_optical_instruments/thin_lens" 3 4 solve :the_glass_of_a_double_convex_lens , using: ThinLens do 5 objects :lens 6 7 take first: lens . first_radius 8 take second: lens . size_of_the_second_radius 9 take focal_length: lens . focal_length 10 11 deduce_from "double convex" , lens . second_radius => - lens . size_of_the_second_radius 12 deduce_from "radii of curvature" , lens . index_of_the_surroundings => "1" 13 14 index = lens . refractive_index_of_the_lens 15 answer index :, figures: 2 16 17 conclusion "Both faces bulge outward, so the second face's radius counts negative and the two faces add " \ 18 "their bending; the lens-maker's formula then gives the glass." 19 end
1 require_relative "../solutions/the_glass_of_a_double_convex_lens" 2 3 play_with :the_glass_of_a_double_convex_lens do 4 title "The Glass of a Double Convex Lens" 5 end