1require_relative "../physics"23question :water_to_air do4 describes "Light in water meets air at %{angle}. %{refracted}?"5 given :angle6 asks refracted: "Which way does it bend coming out"7end
1require_relative "../questions/water_to_air"2require_relative "../science/ray_optics_and_optical_instruments/refraction"3require_relative "../science/ray_optics_and_optical_instruments/refractive_media"45solve :water_to_air, using: Refraction do6 take angle: :i7 deduce_from "water", mu_1: REFRACTIVE_MEDIA.fetch("water")8 deduce_from "air", mu_2: REFRACTIVE_MEDIA.fetch("air")9 take refracted: :r_r10 find_value :refracted11 find_whether :no_refracted_ray?1213 conclusion "It bends away from the normal instead, and far enough round there is no way across at all."14end
1require_relative "../solutions/water_to_air"2require_relative "../science/ray_optics_and_optical_instruments/refractive_media"3require_relative "../pictures/light"45play_with :water_to_air do6 title "Refraction: Water to Air"78 input :i, default: 45.deg910 output :r_r11 output :no_refracted_ray?, alarm: true1213 draw Light::Picture, rising: true do14 media "water", "air"15 ray "incident", arriving_at: :i, angle: true, extended: true16 ray "refracted", crossing_at: :r_r, angle: true, unless: :no_refracted_ray?17 note "no refracted ray", when: :no_refracted_ray?18 end19end