question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :ice_to_steam do 4 kind :numerical 5 describes "Calculate the heat required to convert %{mass} of ice at %{cold} kept in a calorimeter to steam at " \ 6 "%{boiling} at atmospheric pressure. Given specific heat capacity of ice = %{ice_heat}, specific heat " \ 7 "capacity of water = %{water_heat}, latent heat of fusion of ice = %{fusion} and latent heat of steam = " \ 8 "%{steam}. %{heat}, in joules?" 9 given mass: "3 kg" 10 given cold: "-12 °C" 11 given boiling: "100 °C" 12 given ice_heat: "2100 J kg-1 K-1" 13 given water_heat: "4186 J kg-1 K-1" 14 given fusion: "3.35e5 J/kg" 15 given steam: "2.256e6 J/kg" 16 asks heat: "What is the heat required" 17 end
1 require_relative "../questions/ice_to_steam" 2 require_relative "../science/thermal_properties_of_matter/calorimetry" 3 4 solve :ice_to_steam , using: Calorimetry do 5 objects :ice , :water , :everything 6 7 take mass: ice . mass 8 take cold: ice . temperature_at_first 9 take boiling: water . temperature_after 10 take ice_heat: ice . specific_heat_capacity 11 take water_heat: water . specific_heat_capacity 12 take fusion: ice . latent_heat 13 take steam: water . latent_heat 14 15 deduce_from "convert" , water . mass => ice . mass 16 deduce_from "ice" , ice . temperature_after => "0 °C" , water . temperature_at_first => "0 °C" 17 deduce_from "heat required" , everything . heat_taken_in => ice . heat_taken_in + water . heat_taken_in 18 19 heat = everything . heat_taken_in 20 answer heat :, in: "J" , figures: 2 21 22 conclusion "The ice warms to its melting point, melts, the water warms to its boiling point, and boils; " \ 23 "boiling takes by far the most." 24 end
1 require_relative "../solutions/ice_to_steam" 2 3 play_with :ice_to_steam do 4 title "Ice to Steam" 5 end