question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :an_electron_pulled_by_a_proton do 4 kind :numerical 5 describes "An electron and a proton are %{separation} apart. Taking the charge of an electron as %{electron} and " \ 6 "its mass as %{mass}, %{acceleration}, in m/s²?" 7 given separation: "1e-10 m" 8 given electron: "-1.6e-19 C" 9 given mass: "9.11e-31 kg" 10 asks acceleration: "what is the electron's acceleration away from the proton, due to the electrical force between them" 11 end
1 require_relative "../questions/an_electron_pulled_by_a_proton" 2 require_relative "../science/electric_charges_and_fields/coulombs_law" 3 require_relative "../science/laws_of_motion/newtons_second_law" 4 5 solve :an_electron_pulled_by_a_proton , using: [ CoulombsLaw , NewtonsSecondLaw ] do 6 objects :electron , :proton 7 electron . goes ( :pulled ) 8 9 take separation: electron . separation ( from: proton ) 10 take electron: electron . charge 11 take mass: electron . mass 12 13 deduce_from "a proton" , proton . charge => - electron . charge 14 deduce_from "due to the electrical force between them" , electron . net_force => electron . electric_force ( by: proton ) 15 16 take acceleration: electron . acceleration 17 answer find_value ( :acceleration , in: "m/s2" , figures: 2 ) 18 19 conclusion "The pull between them is tiny by everyday standards, but the electron is so light that it " \ 20 "accelerates enormously; the minus sign says the acceleration is towards the proton." 21 end
1 require_relative "../solutions/an_electron_pulled_by_a_proton" 2 3 play_with :an_electron_pulled_by_a_proton do 4 title "An Electron Pulled by a Proton" 5 end