question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :an_electron_falls_in_a_field do 4 kind :numerical 5 describes "An electron falls from rest through a distance of %{distance} in a uniform electric field of magnitude " \ 6 "%{field}. Taking its charge as %{charge} and its mass as %{mass}, %{time}, in seconds?" 7 given distance: "1.5 cm" 8 given field: "2.0e4 N/C" 9 given charge: "1.6e-19 C" 10 given mass: "9.11e-31 kg" 11 asks time: "what is the time of fall" 12 end
1 require_relative "../questions/an_electron_falls_in_a_field" 2 require_relative "../science/electric_charges_and_fields/electric_field" 3 require_relative "../science/laws_of_motion/newtons_second_law" 4 5 solve :an_electron_falls_in_a_field , using: [ ElectricField , NewtonsSecondLaw ] do 6 objects :electron 7 electron . goes ( :falling ) 8 9 take field: E 10 take charge: electron . charge 11 take mass: electron . mass 12 take distance: electron . final_position 13 14 deduce_from "falls from rest" , electron . initial_velocity => "0 m/s" , electron . initial_position => "0 m" 15 deduce_from "in a uniform electric field" , electron . net_force => electron . force_of_the_field 16 17 take time: falling . time_taken 18 answer find_value ( :time , in: "s" , figures: 2 ) 19 20 conclusion "Unlike a fall under gravity, the field's pull grows with the charge but not with the mass, so " \ 21 "the light electron is flung through the gap in nanoseconds." 22 end
1 require_relative "../solutions/an_electron_falls_in_a_field" 2 3 play_with :an_electron_falls_in_a_field do 4 title "An Electron Falls in a Field" 5 end