1require_relative "../physics"23question :reflectance do4 describes "Light meets a surface between indices %{first_index} and %{second_index} at %{angle}. %{transmitted}?"5 given :angle6 given :first_index7 given :second_index8 asks transmitted: "How much of it gets through"9end
1require_relative "../questions/reflectance"2require_relative "../science/ray_optics_and_optical_instruments/reflection"3require_relative "../science/ray_optics_and_optical_instruments/reflectance"45solve :reflectance, using: [ Reflection, Reflectance ] do6 take angle: :i, first_index: :mu_1, second_index: :mu_27 find_value :r_r8 find_whether :no_refracted_ray?9 find_value :r_s10 find_value :r_p11 find_value :r12 take transmitted: :tau13 find_value :transmitted1415 conclusion "It depends on the angle, and on polarisation: the two polarisations are reflected in quite different measure, and at one angle one of them is not reflected at all."16end
1require_relative "../solutions/reflectance"2require_relative "../science/ray_optics_and_optical_instruments/refractive_media"3require_relative "../pictures/light"45INDEX = 1.0..4.067play_with :reflectance do8 title "Reflectance"910 input :i, default: 50.deg11 input :mu_1, INDEX, default: 1.0, marks: REFRACTIVE_MEDIA12 input :mu_2, INDEX, default: 1.5, marks: REFRACTIVE_MEDIA1314 output :r_r15 output :no_refracted_ray?, alarm: true16 output :r_s, in: "%"17 output :r_p, in: "%"18 output :r, in: "%"19 output :tau, in: "%"2021 draw Light::Picture do22 media :mu_1, :mu_223 ray "incident", arriving_at: :i, angle: true24 ray "reflected", leaving_at: :i, weight: :r25 ray "refracted", crossing_at: :r_r, angle: true,26 weight: :tau, unless: :no_refracted_ray?27 mark "critical", arriving_at: :c28 note "no refracted ray — Fresnel has nothing to say", when: :no_refracted_ray?29 end30end