question.rb
solution.rb
playground.rb
1 require_relative "../physics" 2 3 question :two_ways_from_a_to_b do 4 kind :numerical 5 describes "In changing the state of a gas adiabatically from an equilibrium state A to another equilibrium state " \ 6 "B, an amount of work equal to %{work_on} is done on the system. If the gas is taken from state A to B " \ 7 "via a process in which the net heat absorbed by the system is %{heat}, %{work_by}, in joules?" 8 given work_on: "22.3 J" 9 given heat: "39.18 J" 10 asks work_by: "how much is the net work done by the system in the latter case" 11 end
1 require_relative "../questions/two_ways_from_a_to_b" 2 require_relative "../science/thermodynamics/first_law_of_thermodynamics" 3 4 solve :two_ways_from_a_to_b , using: FirstLawOfThermodynamics do 5 objects :gas 6 gas . goes ( :adiabatically ) 7 gas . goes ( :the_other_way ) 8 9 take heat: gas . heat_absorbed ( during: the_other_way ) 10 take work_on: gas . work_done_on_the_system ( during: adiabatically ) 11 12 deduce_from "adiabatically" , gas . heat_absorbed ( during: adiabatically ) => "0 J" 13 deduce_from "from an equilibrium state A to another equilibrium state B" , 14 gas . change_of_internal_energy ( during: the_other_way ) => gas . change_of_internal_energy ( during: adiabatically ) 15 16 work_by = gas . work_done_by_the_system ( during: the_other_way ) 17 answer work_by :, in: "J" , figures: 3 18 19 conclusion "Internal energy depends only on the state, so both paths from A to B change it by the same " \ 20 "amount; the heat the second path takes in, less that change, is the work it does." 21 end
1 require_relative "../solutions/two_ways_from_a_to_b" 2 3 play_with :two_ways_from_a_to_b do 4 title "Two Ways from A to B" 5 end