question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :photons_from_a_laser do 4 kind :numerical 5 describes "Monochromatic light of frequency %{frequency} is produced by a laser. The power emitted is %{power}. " \ 6 "%{photons}?" 7 given frequency: "6.0e14 Hz" 8 given power: "2.0e-3 W" 9 asks photons: "How many photons per second, on an average, are emitted by the source" 10 end
1 require_relative "../questions/photons_from_a_laser" 2 require_relative "../science/dual_nature_of_radiation_and_matter/photon" 3 4 solve :photons_from_a_laser , using: Photon do 5 objects :beam 6 7 take frequency: beam . frequency 8 take power: beam . emitted_power 9 10 photons = beam . photons_a_second 11 answer photons :, in: "s-1" , figures: 2 12 13 conclusion "Each photon carries Planck's constant times the frequency, so a beam's power is a vast " \ 14 "number of very small parcels a second." 15 end
1 require_relative "../solutions/photons_from_a_laser" 2 3 play_with :photons_from_a_laser do 4 title "Photons from a Laser" 5 end