1require_relative "../physics"23question :galileos_odd_numbers do4 kind :scq5 describes "A body falls from rest. In successive equal intervals of time, the distances it falls are " \6 "in the ratio"78 option "1 : 3 : 5 : 7 …", as: :odd9 option "1 : 2 : 3 : 4 …", as: :counting10 option "1 : 4 : 9 : 16 …", as: :squares11 option "1 : 1 : 1 : 1 …", as: :same12end
1require_relative "../questions/galileos_odd_numbers"2require_relative "../science/motion_in_a_straight_line/uniform_acceleration"34solve :galileos_odd_numbers, using: UniformAcceleration do5 objects :body6 body.goes(:falling)78 deduce_from "from rest", body.initial_velocity => "0 m/s"9 assume body.initial_position => "0 m"10 take odd: [ 1, 3, 5, 7 ], counting: [ 1, 2, 3, 4 ], squares: [ 1, 4, 9, 16 ], same: [ 1, 1, 1, 1 ]11 rel = find_relation body.final_position, to: falling.time_taken12 fallen = ->(n) { rel.find body.final_position, when: { falling.time_taken => n.times } }13 steps = (1..4).map { |n| fallen[n] - fallen[n - 1] }14 note "so in each equal interval in turn it falls #{steps.join(" : ")}"1516 answer steps1718 conclusion "The distance fallen grows as the square of the time, so what each equal interval " \19 "adds is the difference of two squares in a row: the odd numbers. Galileo found this " \20 "before anyone could write the equation down."21end
1require_relative "../solutions/galileos_odd_numbers"23play_with :galileos_odd_numbers do4 title "Galileo's Odd Numbers"5end