// Numbas version: exam_results_page_options {"name": "Christian's copy of Heating/phase change", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [{"variables": ["switcharoo_comment", "switcharoo_type", "phase_temp", "phase_latentheat"], "name": "switcharoo (phase type) values"}, {"variables": ["mass_string"], "name": "kg or g"}, {"variables": ["mat_string", "phase1_temp", "phase2_temp", "gas_heatcap", "phase1_latentheat", "liquid_heatcap", "phase2_latentheat", "solid_heatcap"], "name": "Material values"}, {"variables": ["solidheat", "fusionheat", "liquidheat", "vapourheat", "gasheat", "totalheat", "totalheat_m"], "name": "Energy"}, {"variables": ["st_string", "et_string"], "name": "K or C"}, {"variables": ["material_list", "solid_hc_list", "liquid_hc_list", "gas_hc_list", "fusion_lh_list", "vapour_lh_list", "fusion_temp_list", "vapour_temp_list"], "name": "Lists of values"}, {"variables": ["switcharoo", "wat_mat", "start_temp", "end_temp", "k_c_switch", "mass"], "name": "Random variables"}], "functions": {"twostep": {"parameters": [], "type": "html", "language": "javascript", "definition": "// Takes variables\n\n// showing K or C?\nk_c = Numbas.jme.unwrapValue(scope.variables.k_c_switch);\n\nif (k_c = 0) {\n var k_c_corr =0;\n var k_c_str=\"K\";\n} else {\n var k_c_corr =-273;\n var k_c_str=\"\u00b0C\";\n}\n\n//Set values\nst = Numbas.jme.unwrapValue(scope.variables.start_temp)+k_c_corr;\net = Numbas.jme.unwrapValue(scope.variables.end_temp)+k_c_corr;\npt1 = Numbas.jme.unwrapValue(scope.variables.phase1_temp)+k_c_corr;\npt2 = Numbas.jme.unwrapValue(scope.variables.phase2_temp)+k_c_corr;\n\n\n// The function provided by the JSXGraph extension wraps the board up in\n// a div tag so that it's easier to embed in the page.\nvar div = Numbas.extensions.jsxgraph.makeBoard('500px','300px',\n {boundingBox: [-5,et+(et-st)/10.,28,st-(et-st)/10.],\n axis: false,\n showNavigation: false,\n grid: false\n });\n\n// div.board is the object created by JSXGraph, which you use to\n// manipulate elements\nvar board = div.board;\n\n\n\n// create the x-axis.\n//var xaxis = board.create('line',[[0,0],[1,0]], {strokeColor: 'black', fixed: true});\n//var xticks = board.create('ticks',[xaxis,20],{\n// drawLabels: true,\n// minorTicks: 0\n//});\n\n// create the y-axis\n\nvar yaxis = board.create('line',[[0,0],[0,1]], { strokeColor: 'black', fixed: true });\nvar yticks = board.create('ticks',[yaxis,parseInt((et-st)/50.)*10],{\ndrawZero:true,\ndrawLabels: true,\nlabel: {offset: [20, 0]},\nminorTicks: 0\n});\n\n\n// full size of the five slopes\nvar allslope=(et-st);\nvar s1sz=(8*(pt1-st)/allslope);\nvar s3sz=(8*(pt2-pt1)/allslope);\nvar s5sz=(8*(et-pt2)/allslope);\n\n\n//\n//slope 1\nvar slope1 = board.create('line',[[4,st],[s1sz+4,pt1]], {straightFirst:false, straightLast:false, strokeColor: 'black', fixed: true });\nvar slope2 = board.create('line',[[s1sz+4,pt1],[s1sz+8,pt1]], {straightFirst:false, straightLast:false, strokeColor: 'black', fixed: true });\nvar slope3 = board.create('line',[[s1sz+8,pt1],[s1sz+s3sz+8,pt2]], {straightFirst:false, straightLast:false, strokeColor: 'black', fixed: true });\nvar slope4 = board.create('line',[[s1sz+s3sz+8,pt2],[s1sz+s3sz+12,pt2]], {straightFirst:false, straightLast:false, strokeColor: 'black', fixed: true });\nvar slope5 = board.create('line',[[s1sz+s3sz+12,pt2],[s1sz+s3sz+s5sz+12,et]], {straightFirst:false, straightLast:false, strokeColor: 'black', fixed: true });\n\n//var slope6 = board.create('line',[[4,pt1],[20,pt2]], {dash:2,straightFirst:false, straightLast:false, strokeColor: 'black', fixed: true });\n\nvar dash1 = board.create('line',[[s1sz+4,st-10],[s1sz+4,et+10]], {dash:2, strokewidth:1, straightFirst:false, straightLast:false, strokeColor: 'black', fixed: true });\nvar dash2 = board.create('line',[[s1sz+8,st-10],[s1sz+8,et+10]], {dash:2, strokewidth:1, straightFirst:false, straightLast:false, strokeColor: 'black', fixed: true });\nvar dash3 = board.create('line',[[s1sz+s3sz+8,st-10],[s1sz+s3sz+8,et+10]], {dash:2, strokewidth:1, straightFirst:false, straightLast:false, strokeColor: 'black', fixed: true });\nvar dash4 = board.create('line',[[s1sz+s3sz+12,st-10],[s1sz+s3sz+12,et+10]], {dash:2, strokewidth:1, straightFirst:false, straightLast:false, strokeColor: 'black', fixed: true });\n\n\n//label the y-axis\n var label = board.create('text',[-2,(et+st)/2,k_c_str]);\n\n\n// and return the container div\nreturn div;"}, "onestep": {"parameters": [], "type": "html", "language": "javascript", "definition": "// Takes variables\n\n// showing K or C?\nk_c = Numbas.jme.unwrapValue(scope.variables.k_c_switch);\n\nif (k_c = 0) {\n var k_c_corr =0;\n var k_c_str=\"K\";\n} else {\n var k_c_corr =-273;\n var k_c_str=\"\u00b0C\";\n}\n\n//Set values\nst = Numbas.jme.unwrapValue(scope.variables.start_temp)+k_c_corr;\net = Numbas.jme.unwrapValue(scope.variables.end_temp)+k_c_corr;\npt = Numbas.jme.unwrapValue(scope.variables.phase_temp)+k_c_corr;\n\n\n// The function provided by the JSXGraph extension wraps the board up in\n// a div tag so that it's easier to embed in the page.\nvar div = Numbas.extensions.jsxgraph.makeBoard('500px','300px',\n {boundingBox: [-4,et+10,20,st-10],\n axis: false,\n showNavigation: false,\n grid: false\n });\n\n// div.board is the object created by JSXGraph, which you use to\n// manipulate elements\nvar board = div.board;\n\n\n\n// create the x-axis.\n//var xaxis = board.create('line',[[0,0],[1,0]], {strokeColor: 'black', fixed: true});\n//var xticks = board.create('ticks',[xaxis,20],{\n// drawLabels: true,\n// minorTicks: 0\n//});\n\n// create the y-axis\nvar yaxis = board.create('line',[[0,0],[0,1]], { strokeColor: 'black', fixed: true });\nvar yticks = board.create('ticks',[yaxis,parseInt((et-st)/50.)*10],{\ndrawZero:true,\ndrawLabels: true,\nlabel: {offset: [20, 0]},\nminorTicks: 0\n});\n\n//\n//slope 1\nvar slope1 = board.create('line',[[4,st],[((pt-st)/((pt-st)+(et-pt))*8)+4,pt]], {straightFirst:false, straightLast:false, strokeColor: 'black', fixed: true });\nvar slope2 = board.create('line',[[((pt-st)/((pt-st)+(et-pt))*8)+4,pt],[16-((et-pt)/((pt-st)+(et-pt))*8),pt]], {straightFirst:false, straightLast:false, strokeColor: 'black', fixed: true });\nvar slope3 = board.create('line',[[16-((et-pt)/((pt-st)+(et-pt))*8),pt],[16,et]], {straightFirst:false, straightLast:false, strokeColor: 'black', fixed: true });\n\nvar dash1 = board.create('line',[[((pt-st)/((pt-st)+(et-pt))*8)+4,st-5],[((pt-st)/((pt-st)+(et-pt))*8)+4,et+5]], {dash:2, strokewidth:1, straightFirst:false, straightLast:false, strokeColor: 'black', fixed: true });\nvar dash2 = board.create('line',[[16-((et-pt)/((pt-st)+(et-pt))*8),st-5],[16-((et-pt)/((pt-st)+(et-pt))*8),et+5]], {dash:2, strokewidth:1, straightFirst:false, straightLast:false, strokeColor: 'black', fixed: true });\n\n\n//label the y-axis\n var label = board.create('text',[-2,(et+st)/2,k_c_str]);\n\n\n// and return the container div\nreturn div;"}}, "name": "Christian's copy of Heating/phase change", "preamble": {"js": "", "css": ""}, "ungrouped_variables": [], "variables": {"k_c_switch": {"definition": "random(0,1)", "templateType": "anything", "name": "k_c_switch", "group": "Random variables", "description": ""}, "gas_hc_list": {"definition": "[2000,135,350,110]", "templateType": "anything", "name": "gas_hc_list", "group": "Lists of values", "description": ""}, "phase2_latentheat": {"definition": "vapour_lh_list[wat_mat]", "templateType": "anything", "name": "phase2_latentheat", "group": "Material values", "description": ""}, "vapour_lh_list": {"definition": "[2260000,293000,4730000,1580000]", "templateType": "anything", "name": "vapour_lh_list", "group": "Lists of values", "description": ""}, "gasheat": {"definition": "siground(if(switcharoo>0,mass*gas_heatcap*(end_temp-phase2_temp),0),6)", "templateType": "anything", "name": "gasheat", "group": "Energy", "description": ""}, "solid_hc_list": {"definition": "[2100,110,390,130]", "templateType": "anything", "name": "solid_hc_list", "group": "Lists of values", "description": ""}, "material_list": {"definition": "['H2O','Mercury','Copper','Gold']", "templateType": "anything", "name": "material_list", "group": "Lists of values", "description": ""}, "liquid_heatcap": {"definition": "liquid_hc_list[wat_mat]", "templateType": "anything", "name": "liquid_heatcap", "group": "Material values", "description": ""}, "vapourheat": {"definition": "siground(if(switcharoo>0,mass*phase2_latentheat,0),6)", "templateType": "anything", "name": "vapourheat", "group": "Energy", "description": ""}, "switcharoo": {"definition": "random(0..2)", "templateType": "anything", "name": "switcharoo", "group": "Random variables", "description": ""}, "liquidheat": {"definition": "siground(switch(switcharoo=0,mass*liquid_heatcap*(end_temp-phase1_temp),switcharoo=1,mass*liquid_heatcap*(phase2_temp-phase1_temp),switcharoo=2,mass*liquid_heatcap*(phase2_temp-start_temp),0),6)", "templateType": "anything", "name": "liquidheat", "group": "Energy", "description": ""}, "gas_heatcap": {"definition": "gas_hc_list[wat_mat]", "templateType": "anything", "name": "gas_heatcap", "group": "Material values", "description": ""}, "st_string": {"definition": "if(k_c_switch,start_temp+' K',(start_temp-273)+' \u00b0C') ", "templateType": "anything", "name": "st_string", "group": "K or C", "description": ""}, "mass_string": {"definition": "if(mass<1,dpformat(mass*1000,0)+' g',dpformat(mass,2)+' kg')", "templateType": "anything", "name": "mass_string", "group": "kg or g", "description": ""}, "switcharoo_type": {"definition": "switcharoo_comment[switcharoo]", "templateType": "anything", "name": "switcharoo_type", "group": "switcharoo (phase type) values", "description": ""}, "totalheat_m": {"definition": "totalheat/10^6", "templateType": "anything", "name": "totalheat_m", "group": "Energy", "description": ""}, "phase2_temp": {"definition": "vapour_temp_list[wat_mat]", "templateType": "anything", "name": "phase2_temp", "group": "Material values", "description": ""}, "start_temp": {"definition": "if(switcharoo<2,random(100..phase1_temp-10),random(phase1_temp+10..phase2_temp-10))", "templateType": "anything", "name": "start_temp", "group": "Random variables", "description": ""}, "phase1_latentheat": {"definition": "fusion_lh_list[wat_mat]", "templateType": "anything", "name": "phase1_latentheat", "group": "Material values", "description": ""}, "liquid_hc_list": {"definition": "[4200,140,490,150]", "templateType": "anything", "name": "liquid_hc_list", "group": "Lists of values", "description": ""}, "totalheat": {"definition": "solidheat+fusionheat+liquidheat+vapourheat+gasheat", "templateType": "anything", "name": "totalheat", "group": "Energy", "description": ""}, "et_string": {"definition": "if(k_c_switch,end_temp+' K',(end_temp-273)+' \u00b0C') ", "templateType": "anything", "name": "et_string", "group": "K or C", "description": ""}, "wat_mat": {"definition": "random(0..3)", "templateType": "anything", "name": "wat_mat", "group": "Random variables", "description": ""}, "phase_temp": {"definition": "switch(switcharoo=0,phase1_temp,switcharoo=2,phase2_temp,0)", "templateType": "anything", "name": "phase_temp", "group": "switcharoo (phase type) values", "description": ""}, "phase_latentheat": {"definition": "switch(switcharoo=0,phase1_latentheat,switcharoo=2,phase2_latentheat,0)", "templateType": "anything", "name": "phase_latentheat", "group": "switcharoo (phase type) values", "description": ""}, "fusion_lh_list": {"definition": "[336000,11300,207000,63000]", "templateType": "anything", "name": "fusion_lh_list", "group": "Lists of values", "description": ""}, "end_temp": {"definition": "if(switcharoo>0,random(phase2_temp+10..phase2_temp+100),random(phase1_temp+10..phase2_temp-10))", "templateType": "anything", "name": "end_temp", "group": "Random variables", "description": ""}, "mass": {"definition": "siground(if(random(0,1)=0,random(0.01..0.99#0.01),random(1.00..10.00#0.01)),3)", "templateType": "anything", "name": "mass", "group": "Random variables", "description": ""}, "fusion_temp_list": {"definition": "[273,234,1357,1337]", "templateType": "anything", "name": "fusion_temp_list", "group": "Lists of values", "description": ""}, "phase1_temp": {"definition": "fusion_temp_list[wat_mat]", "templateType": "anything", "name": "phase1_temp", "group": "Material values", "description": ""}, "solid_heatcap": {"definition": "solid_hc_list[wat_mat]", "templateType": "anything", "name": "solid_heatcap", "group": "Material values", "description": ""}, "solidheat": {"definition": "siground(if(switcharoo<2,mass*solid_heatcap*(phase1_temp-start_temp),0),6)", "templateType": "anything", "name": "solidheat", "group": "Energy", "description": ""}, "switcharoo_comment": {"definition": "[ \"solid_to_liquid\", \"solid_to_gas\", \"liquid_to_gas\" ]", "templateType": "list of strings", "name": "switcharoo_comment", "group": "switcharoo (phase type) values", "description": ""}, "vapour_temp_list": {"definition": "[373,630,2835,3243]", "templateType": "anything", "name": "vapour_temp_list", "group": "Lists of values", "description": ""}, "fusionheat": {"definition": "siground(if(switcharoo<2,mass*phase1_latentheat,0),6)", "templateType": "anything", "name": "fusionheat", "group": "Energy", "description": ""}, "mat_string": {"definition": "material_list[wat_mat]", "templateType": "anything", "name": "mat_string", "group": "Material values", "description": ""}}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

A random heating question, that randomly picks a material, and then heats it through either one or two phase changes, provides an example graph of the heating with scaled temperature ranges (though not with scaled latent and specific heats), and a table with the suitable constants.

"}, "extensions": ["jsxgraph"], "tags": [], "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "

\\[ Q = m \\times C_S \\times \\Delta T = \\var{mass} \\times \\var{solid_heatcap} \\times (\\var{phase1_temp} - \\var{start_temp}) = \\var{solidheat} \\text{J} \\]

\n

\\[ Q = m \\times L_H = \\var{mass} \\times \\var{phase1_latentheat} = \\var{fusionheat} \\text{J} \\]

\n

{if(switcharoo=2,\" \",\"Q = m * C<sub>S</sub> * ΔT = \"+mass+\" * \"+solid_heatcap+\" * (\"+phase1_temp+\"-\"+start_temp+\") = \"+solidheat+\" J\")}

\n

{if(switcharoo=2,\" \",\"Q = m * L<sub>H</sub> = \"+mass+\" * \"+phase1_latentheat+\" = \"+fusionheat+\" J\")}

\n

switcharoo = 0: \\[ Q = m \\times C_L \\times \\Delta T = \\simplify[]{ {mass} * {liquid_heatcap} * ({end_temp} - {phase1_temp}) } = \\var{liquidheat} \\text{J} \\]

\n

switcharoo = 1: \\[ Q = m \\times C_L \\times \\Delta T = \\simplify[]{ {mass} * {liquid_heatcap} * ({phase2_temp} - {phase1_temp})} = \\var{liquidheat} \\text{J} \\]

\n

switcharoo = 2: \\[ Q = m \\times C_L \\times \\Delta T = \\simplify[]{ {mass} * {liquid_heatcap} * ({phase2_temp} - {start_temp}) } = \\var{liquidheat} \\text{J} \\]

\n

Q = m * C<sub>L</sub> * ΔT = {switch(switcharoo=0,mass+' * '+liquid_heatcap+\" * (\"+end_temp+\" - \"+phase1_temp+\")\",switcharoo=1,mass+' * '+liquid_heatcap+\" * (\"+phase2_temp+\" - \"+phase1_temp+\")\",switcharoo=2,mass+' * '+liquid_heatcap+\" * (\"+phase2_temp+\" - \"+start_temp+\")\",0)} = {liquidheat} J

\n

{if(switcharoo=0,\" \",\"Q = m * L<sub>H</sub> = \"+mass+\" * \"+phase2_latentheat+\" = \"+vapourheat+\" J\")}

\n

{if(switcharoo=0,\" \",\"Q = m * C<sub>G</sub> * ΔT = \"+mass+\" * \"+gas_heatcap+\" (\"+end_temp+\"-\"+phase2_temp+\") = \"+gasheat+\" J\")}

\n

\n

{switcharoo}

\n

Total Heat:

\n

{totalheat} J

\n

", "statement": "

{mass_string} of {Mat_string} is heated from {st_string} to {et_string}, changing in temperature and phase.

\n

\n

{if(switcharoo=1,twostep(),onestep())}

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Solid specific heatLatent Heat of fusionLiquid specific heatLatent Heat of vapourisationGaseous specific heatFusion TemperatureVaporisation Temperature
{Mat_string}{solid_heatcap} JK<sup>-1</sup>kg<sup>-1</sup>{phase1_latentheat} Jkg<sup>-1</sup>{liquid_heatcap} JK<sup>-1</sup>kg<sup>-1</sup>{phase2_latentheat} Jkg<sup>-1</sup>{gas_heatcap} JK<sup>-1</sup>kg<sup>-1</sup>{phase1_temp} K{phase2_temp} K
", "rulesets": {}, "parts": [{"scripts": {}, "distractors": ["", "", ""], "marks": 0, "type": "1_n_2", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "choices": ["

Solid, Liquid

", "

Solid, Liquid, Gas

", "

Liquid, Gas

"], "prompt": "

What phases does the {mat_string} go through?

", "shuffleChoices": false, "displayColumns": 0, "variableReplacements": [], "minMarks": 0, "showCorrectAnswer": true, "displayType": "radiogroup", "matrix": ["if(switcharoo=0,1,0)", "if(switcharoo=1,1,0)", "if(switcharoo=2,1,0)"], "maxMarks": 0}, {"scripts": {}, "distractors": ["", "", ""], "marks": 0, "type": "1_n_2", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "choices": ["

Melting

", "

Melting, Vaporisation

", "

Vaporisation

"], "prompt": "

What phase changes does the {mat_string} go through?

", "shuffleChoices": false, "displayColumns": 0, "variableReplacements": [], "minMarks": 0, "showCorrectAnswer": true, "displayType": "radiogroup", "matrix": ["if(switcharoo=0,1,0)", "if(switcharoo=1,1,0)", "if(switcharoo=2,1,0)"], "maxMarks": 0}, {"scripts": {}, "strictPrecision": true, "showPrecisionHint": true, "precisionMessage": "You have not given your answer to the correct precision.", "marks": "1", "type": "numberentry", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "allowFractions": false, "correctAnswerFraction": false, "prompt": "

Calculate the total heat absorbed by the {Mat_string} through this process in MJ.

", "precision": "3", "precisionType": "sigfig", "precisionPartialCredit": 0, "maxValue": "totalheat_m", "minValue": "totalheat_m", "variableReplacements": [], "showCorrectAnswer": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "type": "question", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}