question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :how_far_apart_the_spheres_are do 4 kind :numerical 5 describes "The electrostatic force on a small sphere of charge %{first} due to another small sphere of charge " \ 6 "–%{second} in air is %{force}. %{distance}, in cm?" 7 given first: "0.4 μC" 8 given second: "0.8 μC" 9 given force: "0.2 N" 10 asks distance: "What is the distance between the two spheres" 11 end
1 require_relative "../questions/how_far_apart_the_spheres_are" 2 require_relative "../science/electric_charges_and_fields/coulombs_law" 3 4 solve :how_far_apart_the_spheres_are , using: CoulombsLaw do 5 objects :first , :second 6 7 take first: first . charge 8 take second: second . charge 9 take force: first . electric_force ( by: second ) 10 11 distance = first . separation ( from: second ) 12 answer distance :, in: "cm" , figures: 2 13 14 conclusion "The force falls off as the square of the distance, so knowing the charges and the pull between " \ 15 "them fixes how far apart they must be." 16 end
1 require_relative "../solutions/how_far_apart_the_spheres_are" 2 3 play_with :how_far_apart_the_spheres_are do 4 title "How Far Apart the Spheres Are" 5 end