1require_relative "../physics"23question :total_internal_reflection do4 describes "Light in a medium of index %{first_index} meets one of %{second_index} at %{angle}. %{reflected}?"5 given :angle6 given :first_index7 given :second_index8 asks reflected: "How much turns back past the critical angle"9end
1require_relative "../questions/total_internal_reflection"2require_relative "../science/ray_optics_and_optical_instruments/reflection"3require_relative "../science/ray_optics_and_optical_instruments/total_internal_reflection"45solve :total_internal_reflection, using: [ Reflection, TotalInternalReflection ] do6 take angle: :i, first_index: :mu_1, second_index: :mu_27 find_whether :no_refracted_ray?8 take reflected: :r9 find_value :reflected1011 conclusion "All of it turns back. Not most of it: the share is exactly one, and it is one because there is nowhere else for the light to go."12end
1require_relative "../solutions/total_internal_reflection"2require_relative "../science/ray_optics_and_optical_instruments/refractive_media"3require_relative "../pictures/light"45INDEX = 1.0..4.067play_with :total_internal_reflection do8 title "Total Internal Reflection"910 input :i, default: 50.deg11 input :mu_1, INDEX, default: 1.5, marks: REFRACTIVE_MEDIA12 input :mu_2, INDEX, default: 1.0, marks: REFRACTIVE_MEDIA1314 output :no_refracted_ray?, alarm: true15 output :r, in: "%"1617 draw Light::Picture, rising: true do18 media :mu_1, :mu_219 ray "incident", arriving_at: :i, angle: true20 ray "reflected", leaving_at: :i, weight: :r21 ray "refracted", crossing_at: :r_r, angle: true,22 weight: :tau, unless: :no_refracted_ray?23 mark "critical", arriving_at: :c24 note "trapped — every ray turns back", when: :no_refracted_ray?25 end26end