question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :a_pan_of_hot_food do 4 kind :numerical 5 describes "A pan filled with hot food cools from %{first_from} to %{first_to} in %{first_time} when the room " \ 6 "temperature is at %{room}. %{time} to cool from %{then_from} to %{then_to}, in seconds?" 7 given first_from: "94 °C" 8 given first_to: "86 °C" 9 given first_time: "2 min" 10 given room: "20 °C" 11 given then_from: "71 °C" 12 given then_to: "69 °C" 13 asks time: "How long will it take" 14 end
1 require_relative "../questions/a_pan_of_hot_food" 2 require_relative "../science/thermal_properties_of_matter/newtons_law_of_cooling" 3 4 solve :a_pan_of_hot_food , using: NewtonsLawOfCooling do 5 objects :pan , :room 6 pan . goes ( :cooling_first , in: room ) 7 pan . goes ( :cooling_later , in: room ) 8 9 take first_from: pan . temperature ( at: cooling_first . start ) 10 take first_to: pan . temperature ( at: cooling_first . end ) 11 take first_time: cooling_first . time_taken 12 take room: room . temperature 13 take then_from: pan . temperature ( at: cooling_later . start ) 14 take then_to: pan . temperature ( at: cooling_later . end ) 15 16 time = cooling_later . time_taken 17 answer time :, in: "s" , figures: 2 18 19 conclusion "The pan loses heat at a rate set by how much hotter than the room it is; nearer the room's " \ 20 "temperature it cools more slowly, so a smaller drop still takes a while." 21 end
1 require_relative "../solutions/a_pan_of_hot_food" 2 3 play_with :a_pan_of_hot_food do 4 title "A Pan of Hot Food" 5 end