// Numbas version: exam_results_page_options {"name": "Quiz 02", "metadata": {"description": "", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "duration": 7200, "percentPass": 0, "showQuestionGroupNames": false, "showstudentname": true, "question_groups": [{"name": "Group", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questions": [{"name": "2.1", "extensions": [], "custom_part_types": [{"source": {"pk": 7, "author": {"name": "Christian Lawson-Perfect", "pk": 7}, "edit_page": "/part_type/7/edit"}, "name": "Quantity with units", "short_name": "quantity", "description": "

The student enters a quantity with units.

The scalar part of the student's quantity

", "definition": "match_student_number[1]"}, {"name": "raw_student_units", "description": "

The units of the student's quantity, before converting.

The units of the student's quantity.

\n

If the student used units incompatible with the units in the expected answer, and the \"what to do if incompatible units used\" option is set to \"mark as if correct units used\", the student's units are ignored and the expected units are used instead.

", "definition": "if(compatible(raw_student_units,correct_units) or settings[\"incompatible_units_action\"]<>\"convert\",\n raw_student_units,\n correct_units\n)"}, {"name": "student_quantity", "description": "

The student's answer, interpreted as a quantity.

\n

Marking fails if the student does not enter a valid quantity.

", "definition": "apply(student_units);\ntry(\n student_number * student_units,\n message,\n warn(\"Your answer is not a valid quantity.\");\n fail(\"Your answer is not a valid quantity.\")\n)"}, {"name": "correct_quantity", "description": "", "definition": "settings[\"correctAnswer\"]"}, {"name": "compatible", "description": "

Are the units of the student's quantity compatible with the units of the expected quantity?

", "definition": "if(compatible(raw_student_units,correct_quantity),\n true\n,\n let(message,\"Your answer does not have the correct dimensions.\",\n if(settings[\"incompatible_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n if(settings[\"incompatible_units_action\"]=\"convert\",\n incorrect(\"Your answer does not have the correct dimensions. It will be marked as if the correct dimensions were used, and then a penalty will be applied.\")\n ,\n incorrect(\"Your answer does not have the correct dimensions.\");\n end()\n )\n );\n false\n )\n)"}, {"name": "correct_units", "description": "", "definition": "units(correct_quantity)"}, {"name": "same_units", "description": "

/Are the student's quantity and the expected quantity in exactly the same units?

", "definition": "assert(raw_student_units=correct_units,\n let(\n message,if(settings[\"hint\"]=\"show units\",\"You did not give your answer in \"+units_string(correct_units)+\".\", \"Your answer is not in the expected units.\"),\n switch(\n settings[\"different_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n settings[\"different_units_action\"]=\"incorrect\",\n incorrect(message); \n warn(message);\n end()\n ,\n settings[\"different_units_action\"]=\"warn\",\n warn(message);\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n settings[\"different_units_penalty\"]<1,\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n false\n )\n );\n false\n)"}, {"name": "has_units", "description": "", "definition": "assert(not unitless(student_quantity),\n assert(settings[\"allow_unitless\"],\n warn(\"You must include the units in your answer.\");\n fail(\"You did not include units in your answer.\")\n )\n)"}, {"name": "can_compare", "description": "

Can the student's answer be compared with the correct answer? True if compatible units used, or \"mark as if correct units used\" selected.

", "definition": "compatible or settings[\"incompatible_units_action\"]=\"convert\""}, {"name": "close_enough", "description": "

Is the student's quantity within the allowed tolerance of the expected answer?

", "definition": "if(can_compare,\n student_quantity>=correct_quantity - wiggle \n and \n student_quantity<=correct_quantity + wiggle \n,\n false\n)"}, {"name": "wiggle", "description": "", "definition": "units(correct_quantity)*abs(eval(settings[\"wiggle\"]))"}, {"name": "valid_number", "description": "

Is the scalar part of the student's answer a valid number?

", "definition": "if(isNaN(student_number),\n warn(translate(\"part.numberentry.answer invalid\"));\n fail(translate(\"part.numberentry.answer invalid\"))\n,\n true\n )\n"}], "settings": [{"name": "correctAnswer", "label": "Correct answer", "help_url": "", "hint": "The expected quantity.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "hint", "label": "Input hint", "help_url": "", "hint": "", "input_type": "dropdown", "default_value": "remind units", "choices": [{"value": "none", "label": "None"}, {"value": "remind units", "label": "Remind to include units"}, {"value": "show units", "label": "Show required units"}]}, {"name": "allow_unitless", "label": "Allow unitless answer?", "help_url": "", "hint": "If not ticked, the student is prevented from submitting an answer without specifying units.", "input_type": "checkbox", "default_value": true}, {"name": "incompatible_units_action", "label": "What to do if incompatible units used", "help_url": "", "hint": "If the student's answer is given in units incompatible with the correct answer's units:
\n
\n
• \"Prevent submission\": Prevent the student from submitting until they use compatible units
• \n
• \"Mark as incorrect\": Mark the student's answer as incorrect.
• \n
• \"Mark as if correct units used\": Mark the student's answer as if they used the correct units, and apply the \"different units used\" penalty.
• \n
", "input_type": "dropdown", "default_value": "incorrect", "choices": [{"value": "incorrect", "label": "Mark as incorrect"}, {"value": "prevent", "label": "Prevent submission"}, {"value": "convert", "label": "Mark as if correct units used"}]}, {"name": "different_units_action", "label": "What to do if different units used", "help_url": "", "hint": "If the student's answer is given in different units to the expected answer:
\n
\n
• \"Convert\" - silently convert the student's answer to the units used in the correct answer.
• \n
• \"Warn and convert\" - show a warning to the student, but convert.
• \n
• \"Prevent submission\" - don't allow the student to submit, and show a warning that they must use the same units.
• \n
• \"Mark incorrect\" - the student's answer is marked as incorrect.
• \n
", "input_type": "dropdown", "default_value": "convert", "choices": [{"value": "convert", "label": "Convert"}, {"value": "warn", "label": "Warn and convert"}, {"value": "prevent", "label": "Prevent submission"}, {"value": "incorrect", "label": "Mark incorrect"}]}, {"name": "different_units_penalty", "label": "Penalty if different units used", "help_url": "", "hint": "This penalty is applied if the student gives their answer in different units to the expected answer. The selected percentage of the student's score is taken away.", "input_type": "percent", "default_value": "100"}, {"name": "wiggle", "label": "Margin of error", "help_url": "", "hint": "The student's answer is marked correct if the difference between it and the correct answer is at most this value, measured in the same units as the correct answer.", "input_type": "mathematical_expression", "default_value": "10^-12", "subvars": true}], "public_availability": "always", "published": true, "extensions": ["quantities"]}], "resources": [["question-resources/triangle1_SKnWjZx.png", "/srv/numbas/media/question-resources/triangle1_SKnWjZx.png"]], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "contributors": [{"name": "Caroline Ferguson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3283/"}], "ungrouped_variables": ["y", "y_3sf", "z", "z_3sf", "x", "x1", "x1_3sf", "z1", "z1_3sf", "y1", "x2", "x2_3sf", "y2", "y2_3sf", "z2"], "variables": {"z1_3sf": {"group": "Ungrouped variables", "templateType": "anything", "name": "z1_3sf", "description": "", "definition": "sigformat(z1,3)"}, "x2_3sf": {"group": "Ungrouped variables", "templateType": "anything", "name": "x2_3sf", "description": "", "definition": "sigformat(x2,3)"}, "y": {"group": "Ungrouped variables", "templateType": "anything", "name": "y", "description": "", "definition": "siground(random(10..40#0),3)"}, "z2": {"group": "Ungrouped variables", "templateType": "anything", "name": "z2", "description": "", "definition": "siground(y2*tan(x2*pi/180),3)"}, "y2": {"group": "Ungrouped variables", "templateType": "anything", "name": "y2", "description": "", "definition": "siground(random(15..80#0),3)"}, "x1": {"group": "Ungrouped variables", "templateType": "anything", "name": "x1", "description": "", "definition": "siground(random(20..65#0),3)\n"}, "y_3sf": {"group": "Ungrouped variables", "templateType": "anything", "name": "y_3sf", "description": "", "definition": "sigformat(y,3)"}, "z": {"group": "Ungrouped variables", "templateType": "anything", "name": "z", "description": "", "definition": "siground(random(10..40#0),3)"}, "x": {"group": "Ungrouped variables", "templateType": "anything", "name": "x", "description": "", "definition": "siground(arctan(z/y)*180/pi,3)"}, "x1_3sf": {"group": "Ungrouped variables", "templateType": "anything", "name": "x1_3sf", "description": "", "definition": "sigformat(x1,3)"}, "y1": {"group": "Ungrouped variables", "templateType": "anything", "name": "y1", "description": "", "definition": "siground(z1/tan(x1*pi/180),3)"}, "z1": {"group": "Ungrouped variables", "templateType": "anything", "name": "z1", "description": "", "definition": "siground(random(3..9#0),3)"}, "z_3sf": {"group": "Ungrouped variables", "templateType": "anything", "name": "z_3sf", "description": "", "definition": "sigformat(z,3)"}, "x2": {"group": "Ungrouped variables", "templateType": "anything", "name": "x2", "description": "", "definition": "siground(random(20..80#0),3)\n"}, "y2_3sf": {"group": "Ungrouped variables", "templateType": "anything", "name": "y2_3sf", "description": "", "definition": "sigformat(y2,3)"}}, "parts": [{"marks": 1, "prompt": "

If \$x=\\var{x2_3sf}\$o and \$y=\\var{y2_3sf}\$ \$cm\$, what does \$z\$ equal?

", "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "scripts": {}, "variableReplacementStrategy": "originalfirst", "customName": "", "showCorrectAnswer": true, "useCustomName": false, "steps": [{"displayType": "radiogroup", "maxMarks": 0, "shuffleChoices": false, "variableReplacements": [], "minMarks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "choices": ["\$sinx\$", "\$cosx\$", "\$tanx\$"], "prompt": "

Which trigonmoetric ratio should you use to solve this question?

", "showFeedbackIcon": true, "showCorrectAnswer": true, "adaptiveMarkingPenalty": 0, "distractors": ["", "", ""], "marks": 0, "customName": "", "useCustomName": false, "matrix": [0, 0, "0.2"], "type": "1_n_2", "variableReplacementStrategy": "originalfirst", "unitTests": [], "displayColumns": 0, "showCellAnswerState": true}], "showFeedbackIcon": true, "stepsPenalty": 0, "adaptiveMarkingPenalty": 0, "unitTests": [], "type": "quantity", "settings": {"different_units_penalty": "10", "different_units_action": "convert", "correctAnswer": "quantity(z2,\"cm\")", "wiggle": "0.02z2", "hint": "remind units", "allow_unitless": true}, "customMarkingAlgorithm": ""}, {"marks": 1, "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "scripts": {}, "variableReplacementStrategy": "originalfirst", "customName": "", "showCorrectAnswer": true, "useCustomName": false, "prompt": "

If \$x=\\var{x1_3sf}\$o and \$z=\\var{z1_3sf}\$ \$km\$, what does \$y\$ equal?

", "showFeedbackIcon": true, "adaptiveMarkingPenalty": 0, "unitTests": [], "type": "quantity", "settings": {"different_units_penalty": "10", "different_units_action": "convert", "correctAnswer": "quantity(y1,\"km\")", "wiggle": "y1*0.02", "hint": "remind units", "allow_unitless": true}, "customMarkingAlgorithm": ""}, {"marks": 0, "gaps": [{"showFractionHint": true, "maxValue": "1.02x", "variableReplacements": [], "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain", "adaptiveMarkingPenalty": 0, "mustBeReduced": false, "marks": 1, "correctAnswerFraction": false, "customName": "", "mustBeReducedPC": 0, "useCustomName": false, "minValue": "0.98x", "type": "numberentry", "variableReplacementStrategy": "originalfirst", "unitTests": [], "allowFractions": false, "showCorrectAnswer": true}], "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "scripts": {}, "variableReplacementStrategy": "originalfirst", "customName": "", "showCorrectAnswer": true, "useCustomName": false, "prompt": "

If \$y=\\var{y_3sf}\$ \$cm\$ and \$z=\\var{z_3sf}\$ \$cm\$, what does \$x\$ equal?

\n

\$x=\$ [[0]]°

", "showFeedbackIcon": true, "adaptiveMarkingPenalty": 0, "unitTests": [], "type": "gapfill", "customMarkingAlgorithm": "", "sortAnswers": false}], "statement": "

Use the figure below to answer the following questions.

\n

", "functions": {}, "variable_groups": [], "preamble": {"js": "", "css": ""}, "tags": [], "advice": "", "metadata": {"licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International", "description": ""}, "rulesets": {}, "variablesTest": {"condition": "", "maxRuns": 100}}, {"name": "2.2", "extensions": ["quantities"], "custom_part_types": [{"source": {"pk": 7, "author": {"name": "Christian Lawson-Perfect", "pk": 7}, "edit_page": "/part_type/7/edit"}, "name": "Quantity with units", "short_name": "quantity", "description": "

The student enters a quantity with units.

The scalar part of the student's quantity

", "definition": "match_student_number[1]"}, {"name": "raw_student_units", "description": "

The units of the student's quantity, before converting.

The units of the student's quantity.

\n

If the student used units incompatible with the units in the expected answer, and the \"what to do if incompatible units used\" option is set to \"mark as if correct units used\", the student's units are ignored and the expected units are used instead.

", "definition": "if(compatible(raw_student_units,correct_units) or settings[\"incompatible_units_action\"]<>\"convert\",\n raw_student_units,\n correct_units\n)"}, {"name": "student_quantity", "description": "

The student's answer, interpreted as a quantity.

\n

Marking fails if the student does not enter a valid quantity.

", "definition": "apply(student_units);\ntry(\n student_number * student_units,\n message,\n warn(\"Your answer is not a valid quantity.\");\n fail(\"Your answer is not a valid quantity.\")\n)"}, {"name": "correct_quantity", "description": "", "definition": "settings[\"correctAnswer\"]"}, {"name": "compatible", "description": "

Are the units of the student's quantity compatible with the units of the expected quantity?

", "definition": "if(compatible(raw_student_units,correct_quantity),\n true\n,\n let(message,\"Your answer does not have the correct dimensions.\",\n if(settings[\"incompatible_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n if(settings[\"incompatible_units_action\"]=\"convert\",\n incorrect(\"Your answer does not have the correct dimensions. It will be marked as if the correct dimensions were used, and then a penalty will be applied.\")\n ,\n incorrect(\"Your answer does not have the correct dimensions.\");\n end()\n )\n );\n false\n )\n)"}, {"name": "correct_units", "description": "", "definition": "units(correct_quantity)"}, {"name": "same_units", "description": "

/Are the student's quantity and the expected quantity in exactly the same units?

", "definition": "assert(raw_student_units=correct_units,\n let(\n message,if(settings[\"hint\"]=\"show units\",\"You did not give your answer in \"+units_string(correct_units)+\".\", \"Your answer is not in the expected units.\"),\n switch(\n settings[\"different_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n settings[\"different_units_action\"]=\"incorrect\",\n incorrect(message); \n warn(message);\n end()\n ,\n settings[\"different_units_action\"]=\"warn\",\n warn(message);\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n settings[\"different_units_penalty\"]<1,\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n false\n )\n );\n false\n)"}, {"name": "has_units", "description": "", "definition": "assert(not unitless(student_quantity),\n assert(settings[\"allow_unitless\"],\n warn(\"You must include the units in your answer.\");\n fail(\"You did not include units in your answer.\")\n )\n)"}, {"name": "can_compare", "description": "

Can the student's answer be compared with the correct answer? True if compatible units used, or \"mark as if correct units used\" selected.

", "definition": "compatible or settings[\"incompatible_units_action\"]=\"convert\""}, {"name": "close_enough", "description": "

Is the student's quantity within the allowed tolerance of the expected answer?

", "definition": "if(can_compare,\n student_quantity>=correct_quantity - wiggle \n and \n student_quantity<=correct_quantity + wiggle \n,\n false\n)"}, {"name": "wiggle", "description": "", "definition": "units(correct_quantity)*abs(eval(settings[\"wiggle\"]))"}, {"name": "valid_number", "description": "

Is the scalar part of the student's answer a valid number?

", "definition": "if(isNaN(student_number),\n warn(translate(\"part.numberentry.answer invalid\"));\n fail(translate(\"part.numberentry.answer invalid\"))\n,\n true\n )\n"}], "settings": [{"name": "correctAnswer", "label": "Correct answer", "help_url": "", "hint": "The expected quantity.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "hint", "label": "Input hint", "help_url": "", "hint": "", "input_type": "dropdown", "default_value": "remind units", "choices": [{"value": "none", "label": "None"}, {"value": "remind units", "label": "Remind to include units"}, {"value": "show units", "label": "Show required units"}]}, {"name": "allow_unitless", "label": "Allow unitless answer?", "help_url": "", "hint": "If not ticked, the student is prevented from submitting an answer without specifying units.", "input_type": "checkbox", "default_value": true}, {"name": "incompatible_units_action", "label": "What to do if incompatible units used", "help_url": "", "hint": "If the student's answer is given in units incompatible with the correct answer's units:
\n
\n
• \"Prevent submission\": Prevent the student from submitting until they use compatible units
• \n
• \"Mark as incorrect\": Mark the student's answer as incorrect.
• \n
• \"Mark as if correct units used\": Mark the student's answer as if they used the correct units, and apply the \"different units used\" penalty.
• \n
", "input_type": "dropdown", "default_value": "incorrect", "choices": [{"value": "incorrect", "label": "Mark as incorrect"}, {"value": "prevent", "label": "Prevent submission"}, {"value": "convert", "label": "Mark as if correct units used"}]}, {"name": "different_units_action", "label": "What to do if different units used", "help_url": "", "hint": "If the student's answer is given in different units to the expected answer:
\n
\n
• \"Convert\" - silently convert the student's answer to the units used in the correct answer.
• \n
• \"Warn and convert\" - show a warning to the student, but convert.
• \n
• \"Prevent submission\" - don't allow the student to submit, and show a warning that they must use the same units.
• \n
• \"Mark incorrect\" - the student's answer is marked as incorrect.
• \n
", "input_type": "dropdown", "default_value": "convert", "choices": [{"value": "convert", "label": "Convert"}, {"value": "warn", "label": "Warn and convert"}, {"value": "prevent", "label": "Prevent submission"}, {"value": "incorrect", "label": "Mark incorrect"}]}, {"name": "different_units_penalty", "label": "Penalty if different units used", "help_url": "", "hint": "This penalty is applied if the student gives their answer in different units to the expected answer. The selected percentage of the student's score is taken away.", "input_type": "percent", "default_value": "100"}, {"name": "wiggle", "label": "Margin of error", "help_url": "", "hint": "The student's answer is marked correct if the difference between it and the correct answer is at most this value, measured in the same units as the correct answer.", "input_type": "mathematical_expression", "default_value": "10^-12", "subvars": true}], "public_availability": "always", "published": true, "extensions": ["quantities"]}], "resources": [["question-resources/triangle1_SKnWjZx.png", "/srv/numbas/media/question-resources/triangle1_SKnWjZx.png"], ["question-resources/triangle2_TkEeeUJ.png", "/srv/numbas/media/question-resources/triangle2_TkEeeUJ.png"]], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "contributors": [{"name": "Caroline Ferguson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3283/"}], "ungrouped_variables": ["y1", "y1_3sf", "z1", "z1_3sf", "x1", "x", "x_3sf", "y", "y_3sf", "z"], "variables": {"z1_3sf": {"group": "Ungrouped variables", "templateType": "anything", "name": "z1_3sf", "description": "", "definition": "sigformat(z1,3)"}, "z": {"group": "Ungrouped variables", "templateType": "anything", "name": "z", "description": "", "definition": "siground(sqrt(x^2-y^2),3)"}, "y1": {"group": "Ungrouped variables", "templateType": "anything", "name": "y1", "description": "", "definition": "siground(random(10..40#0),3)"}, "y1_3sf": {"group": "Ungrouped variables", "templateType": "anything", "name": "y1_3sf", "description": "", "definition": "sigformat(y1,3)"}, "z1": {"group": "Ungrouped variables", "templateType": "anything", "name": "z1", "description": "", "definition": "siground(random(10..40#0),3)"}, "x1": {"group": "Ungrouped variables", "templateType": "anything", "name": "x1", "description": "", "definition": "siground(sqrt((y1)^2+(z1)^2),3)"}, "y_3sf": {"group": "Ungrouped variables", "templateType": "anything", "name": "y_3sf", "description": "", "definition": "sigformat(y,3)\n"}, "y": {"group": "Ungrouped variables", "templateType": "anything", "name": "y", "description": "", "definition": "siground(random(3..9#0),3)"}, "x": {"group": "Ungrouped variables", "templateType": "anything", "name": "x", "description": "", "definition": "siground(random(10..20#0),3)"}, "x_3sf": {"group": "Ungrouped variables", "templateType": "anything", "name": "x_3sf", "description": "", "definition": "sigformat(x,3)"}}, "parts": [{"marks": 1, "steps": [{"displayType": "radiogroup", "maxMarks": 0, "shuffleChoices": false, "variableReplacements": [], "minMarks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "choices": ["Trig Ratios (SOH CAH TOA)", "Inverse Trig Ratios", "Pythagorean Theorem"], "prompt": "

What method should you use to solve this question?

", "showFeedbackIcon": true, "displayColumns": 0, "adaptiveMarkingPenalty": 0, "distractors": ["Use this when you know one side and an angle and are looking for another side.", "Use this when you know two sides and are looking for an angle.", "Use this when you know two sides and are looking for the third side."], "marks": 0, "customName": "", "useCustomName": false, "matrix": [0, "0", "0.2"], "type": "1_n_2", "variableReplacementStrategy": "originalfirst", "unitTests": [], "showCellAnswerState": true, "showCorrectAnswer": true}, {"displayType": "radiogroup", "maxMarks": 0, "shuffleChoices": false, "variableReplacements": [], "minMarks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "choices": ["\$x\$", "\$y\$", "\$z\$"], "prompt": "

Which of the three sides is the hypotenuse?

", "showFeedbackIcon": true, "displayColumns": 0, "adaptiveMarkingPenalty": 0, "distractors": ["The hypotenuse is always opposite of the 90 degree angle.", "", ""], "marks": 0, "customName": "", "useCustomName": false, "matrix": ["0.2", 0, 0], "type": "1_n_2", "variableReplacementStrategy": "originalfirst", "unitTests": [], "showCellAnswerState": true, "showCorrectAnswer": true}], "showCorrectAnswer": true, "variableReplacements": [], "scripts": {}, "variableReplacementStrategy": "originalfirst", "customName": "", "extendBaseMarkingAlgorithm": true, "useCustomName": false, "prompt": "

If \$z=\\var{z1_3sf}\$ \$cm\$ and \$y=\\var{y1_3sf}\$ \$cm\$, what does \$x\$ equal?

", "showFeedbackIcon": true, "stepsPenalty": 0, "adaptiveMarkingPenalty": 0, "unitTests": [], "type": "quantity", "settings": {"different_units_penalty": "10", "different_units_action": "convert", "correctAnswer": "quantity(x1,\"cm\")", "wiggle": "x1*0.02", "hint": "remind units", "allow_unitless": true}, "customMarkingAlgorithm": ""}, {"marks": 1, "showCorrectAnswer": true, "variableReplacements": [], "scripts": {}, "variableReplacementStrategy": "originalfirst", "customName": "", "extendBaseMarkingAlgorithm": true, "useCustomName": false, "prompt": "

If \$x=\\var{x_3sf}\$ \$mm\$ and \$y=\\var{y_3sf}\$ \$mm\$, what does \$z\$ equal?

", "showFeedbackIcon": true, "adaptiveMarkingPenalty": 0, "unitTests": [], "type": "quantity", "settings": {"different_units_penalty": "10", "different_units_action": "convert", "correctAnswer": "quantity(z,\"mm\")", "wiggle": "z*0.02", "hint": "remind units", "allow_unitless": true}, "customMarkingAlgorithm": ""}], "statement": "

Use the figure below to answer the following questions.

\n

", "functions": {}, "variable_groups": [], "variablesTest": {"condition": "", "maxRuns": 100}, "preamble": {"css": "", "js": ""}, "tags": [], "advice": "", "metadata": {"licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International", "description": ""}, "rulesets": {}}, {"name": "2.3", "extensions": ["quantities"], "custom_part_types": [{"source": {"pk": 7, "author": {"name": "Christian Lawson-Perfect", "pk": 7}, "edit_page": "/part_type/7/edit"}, "name": "Quantity with units", "short_name": "quantity", "description": "

The student enters a quantity with units.

The scalar part of the student's quantity

", "definition": "match_student_number[1]"}, {"name": "raw_student_units", "description": "

The units of the student's quantity, before converting.

The units of the student's quantity.

\n

If the student used units incompatible with the units in the expected answer, and the \"what to do if incompatible units used\" option is set to \"mark as if correct units used\", the student's units are ignored and the expected units are used instead.

", "definition": "if(compatible(raw_student_units,correct_units) or settings[\"incompatible_units_action\"]<>\"convert\",\n raw_student_units,\n correct_units\n)"}, {"name": "student_quantity", "description": "

The student's answer, interpreted as a quantity.

\n

Marking fails if the student does not enter a valid quantity.

", "definition": "apply(student_units);\ntry(\n student_number * student_units,\n message,\n warn(\"Your answer is not a valid quantity.\");\n fail(\"Your answer is not a valid quantity.\")\n)"}, {"name": "correct_quantity", "description": "", "definition": "settings[\"correctAnswer\"]"}, {"name": "compatible", "description": "

Are the units of the student's quantity compatible with the units of the expected quantity?

", "definition": "if(compatible(raw_student_units,correct_quantity),\n true\n,\n let(message,\"Your answer does not have the correct dimensions.\",\n if(settings[\"incompatible_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n if(settings[\"incompatible_units_action\"]=\"convert\",\n incorrect(\"Your answer does not have the correct dimensions. It will be marked as if the correct dimensions were used, and then a penalty will be applied.\")\n ,\n incorrect(\"Your answer does not have the correct dimensions.\");\n end()\n )\n );\n false\n )\n)"}, {"name": "correct_units", "description": "", "definition": "units(correct_quantity)"}, {"name": "same_units", "description": "

/Are the student's quantity and the expected quantity in exactly the same units?

", "definition": "assert(raw_student_units=correct_units,\n let(\n message,if(settings[\"hint\"]=\"show units\",\"You did not give your answer in \"+units_string(correct_units)+\".\", \"Your answer is not in the expected units.\"),\n switch(\n settings[\"different_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n settings[\"different_units_action\"]=\"incorrect\",\n incorrect(message); \n warn(message);\n end()\n ,\n settings[\"different_units_action\"]=\"warn\",\n warn(message);\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n settings[\"different_units_penalty\"]<1,\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n false\n )\n );\n false\n)"}, {"name": "has_units", "description": "", "definition": "assert(not unitless(student_quantity),\n assert(settings[\"allow_unitless\"],\n warn(\"You must include the units in your answer.\");\n fail(\"You did not include units in your answer.\")\n )\n)"}, {"name": "can_compare", "description": "

Can the student's answer be compared with the correct answer? True if compatible units used, or \"mark as if correct units used\" selected.

", "definition": "compatible or settings[\"incompatible_units_action\"]=\"convert\""}, {"name": "close_enough", "description": "

Is the student's quantity within the allowed tolerance of the expected answer?

", "definition": "if(can_compare,\n student_quantity>=correct_quantity - wiggle \n and \n student_quantity<=correct_quantity + wiggle \n,\n false\n)"}, {"name": "wiggle", "description": "", "definition": "units(correct_quantity)*abs(eval(settings[\"wiggle\"]))"}, {"name": "valid_number", "description": "

Is the scalar part of the student's answer a valid number?

", "definition": "if(isNaN(student_number),\n warn(translate(\"part.numberentry.answer invalid\"));\n fail(translate(\"part.numberentry.answer invalid\"))\n,\n true\n )\n"}], "settings": [{"name": "correctAnswer", "label": "Correct answer", "help_url": "", "hint": "The expected quantity.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "hint", "label": "Input hint", "help_url": "", "hint": "", "input_type": "dropdown", "default_value": "remind units", "choices": [{"value": "none", "label": "None"}, {"value": "remind units", "label": "Remind to include units"}, {"value": "show units", "label": "Show required units"}]}, {"name": "allow_unitless", "label": "Allow unitless answer?", "help_url": "", "hint": "If not ticked, the student is prevented from submitting an answer without specifying units.", "input_type": "checkbox", "default_value": true}, {"name": "incompatible_units_action", "label": "What to do if incompatible units used", "help_url": "", "hint": "If the student's answer is given in units incompatible with the correct answer's units:
\n
\n
• \"Prevent submission\": Prevent the student from submitting until they use compatible units
• \n
• \"Mark as incorrect\": Mark the student's answer as incorrect.
• \n
• \"Mark as if correct units used\": Mark the student's answer as if they used the correct units, and apply the \"different units used\" penalty.
• \n
", "input_type": "dropdown", "default_value": "incorrect", "choices": [{"value": "incorrect", "label": "Mark as incorrect"}, {"value": "prevent", "label": "Prevent submission"}, {"value": "convert", "label": "Mark as if correct units used"}]}, {"name": "different_units_action", "label": "What to do if different units used", "help_url": "", "hint": "If the student's answer is given in different units to the expected answer:
\n
\n
• \"Convert\" - silently convert the student's answer to the units used in the correct answer.
• \n
• \"Warn and convert\" - show a warning to the student, but convert.
• \n
• \"Prevent submission\" - don't allow the student to submit, and show a warning that they must use the same units.
• \n
• \"Mark incorrect\" - the student's answer is marked as incorrect.
• \n
", "input_type": "dropdown", "default_value": "convert", "choices": [{"value": "convert", "label": "Convert"}, {"value": "warn", "label": "Warn and convert"}, {"value": "prevent", "label": "Prevent submission"}, {"value": "incorrect", "label": "Mark incorrect"}]}, {"name": "different_units_penalty", "label": "Penalty if different units used", "help_url": "", "hint": "This penalty is applied if the student gives their answer in different units to the expected answer. The selected percentage of the student's score is taken away.", "input_type": "percent", "default_value": "100"}, {"name": "wiggle", "label": "Margin of error", "help_url": "", "hint": "The student's answer is marked correct if the difference between it and the correct answer is at most this value, measured in the same units as the correct answer.", "input_type": "mathematical_expression", "default_value": "10^-12", "subvars": true}], "public_availability": "always", "published": true, "extensions": ["quantities"]}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "contributors": [{"name": "Caroline Ferguson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3283/"}], "variable_groups": [], "parts": [{"unitTests": [], "sortAnswers": false, "marks": 0, "showCorrectAnswer": true, "variableReplacements": [], "adaptiveMarkingPenalty": 0, "prompt": "

You walk \$\\var{a1_3sf}\$ \$m\$ north and \$\\var{b1_3sf}\$ \$m\$ east.

\n

[[0]] [N[[1]]oE].

", "extendBaseMarkingAlgorithm": true, "gaps": [{"settings": {"allow_unitless": true, "different_units_action": "convert", "correctAnswer": "quantity(m1,\"m\")", "hint": "remind units", "wiggle": "0.02*m1", "different_units_penalty": "10"}, "unitTests": [], "marks": 1, "showCorrectAnswer": true, "variableReplacements": [], "adaptiveMarkingPenalty": 0, "extendBaseMarkingAlgorithm": true, "type": "quantity", "scripts": {}, "customName": "magnitude", "useCustomName": true, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst"}, {"unitTests": [], "variableReplacements": [], "scripts": {}, "marks": 1, "correctAnswerStyle": "plain", "correctAnswerFraction": false, "adaptiveMarkingPenalty": 0, "showFractionHint": true, "mustBeReducedPC": 0, "type": "numberentry", "allowFractions": false, "customName": "direction", "useCustomName": true, "notationStyles": ["plain", "en", "si-en"], "maxValue": "0.98*d1", "showCorrectAnswer": true, "showFeedbackIcon": true, "mustBeReduced": false, "customMarkingAlgorithm": "", "minValue": "1.02*d1", "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst"}], "type": "gapfill", "scripts": {}, "customName": "", "useCustomName": false, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst"}, {"unitTests": [], "sortAnswers": false, "marks": 0, "steps": [{"settings": {"allow_unitless": true, "different_units_action": "convert", "correctAnswer": "quantity(a2x,\"km\")", "hint": "remind units", "wiggle": "0.02*a2x", "different_units_penalty": "10"}, "unitTests": [], "marks": "0.2", "showCorrectAnswer": true, "variableReplacements": [], "adaptiveMarkingPenalty": 0, "prompt": "

What is the \$x\$-component of the displacement from your house to your school? Assume east to be the positive \$x\$-direction. Note: Since this is an intermediate step (ie. not the final answer), enter an additional 2 significant figures (total of 5).

", "extendBaseMarkingAlgorithm": true, "type": "quantity", "scripts": {}, "customName": "", "useCustomName": false, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst"}, {"settings": {"allow_unitless": true, "different_units_action": "convert", "correctAnswer": "quantity(a2y,\"km\")", "hint": "remind units", "wiggle": "0.02*a2y", "different_units_penalty": "10"}, "unitTests": [], "marks": "0.2", "showCorrectAnswer": true, "variableReplacements": [], "adaptiveMarkingPenalty": 0, "prompt": "

What is the \$y\$-component of the displacement from your house to your school? Assume north to be the positive \$y\$-direction. Note: Since this is an intermediate step (ie. not the final answer), enter an additional 2 significant figures (total of 5).

", "extendBaseMarkingAlgorithm": true, "type": "quantity", "scripts": {}, "customName": "", "useCustomName": false, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst"}, {"settings": {"allow_unitless": true, "different_units_action": "convert", "correctAnswer": "quantity(b2x,\"km\")", "hint": "remind units", "wiggle": "0.02*b2x", "different_units_penalty": "10"}, "unitTests": [], "marks": "0.2", "showCorrectAnswer": true, "variableReplacements": [], "adaptiveMarkingPenalty": 0, "prompt": "

What is the \$x\$-component of the displacement from your school to the coffee shop? Assume east to be the positive \$x\$-direction. Note: Since this is an intermediate step (ie. not the final answer), enter an additional 2 significant figures (total of 5).

", "extendBaseMarkingAlgorithm": true, "type": "quantity", "scripts": {}, "customName": "", "useCustomName": false, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst"}, {"settings": {"allow_unitless": true, "different_units_action": "convert", "correctAnswer": "quantity(b2y,\"km\")", "hint": "remind units", "wiggle": "0.02*b2y", "different_units_penalty": "10"}, "unitTests": [], "marks": "0.1", "showCorrectAnswer": true, "variableReplacements": [], "adaptiveMarkingPenalty": 0, "prompt": "

What is the \$y\$-component of the displacement from your school to the coffee shop? Assume north to be the positive \$y\$-direction. Note: Since this is an intermediate step (ie. not the final answer), enter an additional 2 significant figures (total of 5).

", "extendBaseMarkingAlgorithm": true, "type": "quantity", "scripts": {}, "customName": "", "useCustomName": false, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst"}, {"settings": {"allow_unitless": true, "different_units_action": "convert", "correctAnswer": "quantity(abx,\"km\")", "hint": "remind units", "wiggle": "abx*0.02", "different_units_penalty": "10"}, "unitTests": [], "marks": "0.1", "showCorrectAnswer": true, "variableReplacements": [], "adaptiveMarkingPenalty": 0, "prompt": "

What is the sum of all the \$x\$-components of your trip? Assume east to be the positive \$x\$-direction. Note: Since this is an intermediate step (ie. not the final answer), enter an additional 2 significant figures (total of 5).

", "extendBaseMarkingAlgorithm": true, "type": "quantity", "scripts": {}, "customName": "", "useCustomName": false, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst"}, {"settings": {"allow_unitless": true, "different_units_action": "convert", "correctAnswer": "quantity(aby,\"km\")", "hint": "remind units", "wiggle": "aby*0.02", "different_units_penalty": "10"}, "unitTests": [], "marks": "0.1", "showCorrectAnswer": true, "variableReplacements": [], "adaptiveMarkingPenalty": 0, "prompt": "

What is the sum of all the \$y\$-components of your trip? Assume north to be the positive \$y\$-direction. Note: Since this is an intermediate step (ie. not the final answer), enter an additional 2 significant figures (total of 5).

", "extendBaseMarkingAlgorithm": true, "type": "quantity", "scripts": {}, "customName": "", "useCustomName": false, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst"}, {"unitTests": [], "variableReplacements": [], "marks": 0, "matrix": [0, 0, "0.1"], "minMarks": 0, "adaptiveMarkingPenalty": 0, "type": "1_n_2", "shuffleChoices": false, "distractors": ["", "", ""], "customName": "", "useCustomName": false, "showCellAnswerState": true, "showFeedbackIcon": true, "displayColumns": 0, "showCorrectAnswer": true, "displayType": "radiogroup", "prompt": "

What do you have to do to the sum of the \$x\$-components and the sum of the \$y\$-components to get the magnitude?

", "choices": ["Add the \$x\$- and \$y\$- components together using simple arithmetic.", "Subtract the \$x\$- component from the \$y\$- component using simple arithmetic.", "Add the \$x\$- and \$y\$- components as vectors using Pythagorean Theorom."], "customMarkingAlgorithm": "", "scripts": {}, "maxMarks": 0, "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst"}], "showCorrectAnswer": true, "variableReplacements": [], "adaptiveMarkingPenalty": 0, "prompt": "

You drive \$\\var{a2_3sf}\$ \$km\$ [E\$\\var{theta1_3sf}\$oS] from your house to your school, then \$\\var{b2_3sf}\$ \$km\$ [W\$\\var{theta2_3sf}\$oN] from your school to the coffee shop.

\n

\n

[[0]] [E[[1]]oS].

\n

", "extendBaseMarkingAlgorithm": true, "stepsPenalty": 0, "gaps": [{"settings": {"allow_unitless": true, "different_units_action": "convert", "correctAnswer": "quantity(magnitude,\"km\")", "hint": "remind units", "wiggle": "0.02*magnitude", "different_units_penalty": "10"}, "unitTests": [], "marks": "2", "showCorrectAnswer": true, "variableReplacements": [], "adaptiveMarkingPenalty": 0, "extendBaseMarkingAlgorithm": true, "type": "quantity", "scripts": {}, "customName": "magnitude 2", "useCustomName": true, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst"}, {"unitTests": [], "variableReplacements": [], "scripts": {}, "marks": 1, "correctAnswerStyle": "plain", "correctAnswerFraction": false, "adaptiveMarkingPenalty": 0, "showFractionHint": true, "mustBeReducedPC": 0, "type": "numberentry", "allowFractions": false, "customName": "direction 2", "useCustomName": true, "notationStyles": ["plain", "en", "si-en"], "maxValue": "0.98*direction", "showCorrectAnswer": true, "showFeedbackIcon": true, "mustBeReduced": false, "customMarkingAlgorithm": "", "minValue": "1.02*direction", "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst"}], "type": "gapfill", "scripts": {}, "customName": "", "useCustomName": false, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst"}], "tags": [], "ungrouped_variables": ["a1", "a1_3sf", "b1", "b1_3sf", "m1", "d1", "a2", "a2_3sf", "b2", "b2_3sf", "a2x", "a2y", "b2x", "b2y", "abx", "aby", "magnitude", "theta1", "theta2", "theta1_3sf", "theta2_3sf", "direction"], "statement": "

Find the magnitude and direction of the displacement (ie. add the two displacement vectors together).

", "preamble": {"js": "", "css": ""}, "metadata": {"description": "", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "variablesTest": {"maxRuns": 100, "condition": ""}, "advice": "", "functions": {}, "variables": {"theta1": {"name": "theta1", "description": "", "templateType": "anything", "definition": "siground(random(10..30#0),3)", "group": "Ungrouped variables"}, "aby": {"name": "aby", "description": "", "templateType": "anything", "definition": "siground(a2y+b2y,5)", "group": "Ungrouped variables"}, "a2_3sf": {"name": "a2_3sf", "description": "", "templateType": "anything", "definition": "sigformat(a2,3)", "group": "Ungrouped variables"}, "theta2": {"name": "theta2", "description": "", "templateType": "anything", "definition": "siground(random(10..30#0),3)", "group": "Ungrouped variables"}, "b1_3sf": {"name": "b1_3sf", "description": "", "templateType": "anything", "definition": "sigformat(b1,3)", "group": "Ungrouped variables"}, "b1": {"name": "b1", "description": "", "templateType": "anything", "definition": "siground(random(30..90#0),3)", "group": "Ungrouped variables"}, "b2": {"name": "b2", "description": "", "templateType": "anything", "definition": "siground(random(10..50#0),3)", "group": "Ungrouped variables"}, "b2_3sf": {"name": "b2_3sf", "description": "", "templateType": "anything", "definition": "sigformat(b2,3)", "group": "Ungrouped variables"}, "a1": {"name": "a1", "description": "", "templateType": "anything", "definition": "siground(random(20..60#0),3)", "group": "Ungrouped variables"}, "magnitude": {"name": "magnitude", "description": "", "templateType": "anything", "definition": "siground(sqrt(abx^2+aby^2),3)", "group": "Ungrouped variables"}, "a1_3sf": {"name": "a1_3sf", "description": "", "templateType": "anything", "definition": "sigformat(a1,3)", "group": "Ungrouped variables"}, "theta1_3sf": {"name": "theta1_3sf", "description": "", "templateType": "anything", "definition": "sigformat(theta1,3)", "group": "Ungrouped variables"}, "d1": {"name": "d1", "description": "", "templateType": "anything", "definition": "siground(arctan(b1/a1)*180/pi,3)", "group": "Ungrouped variables"}, "theta2_3sf": {"name": "theta2_3sf", "description": "", "templateType": "anything", "definition": "sigformat(theta2,3)", "group": "Ungrouped variables"}, "abx": {"name": "abx", "description": "", "templateType": "anything", "definition": "siground(a2x+b2x,5)", "group": "Ungrouped variables"}, "b2y": {"name": "b2y", "description": "", "templateType": "anything", "definition": "siground(b2*sin(theta2*pi/180),5)", "group": "Ungrouped variables"}, "direction": {"name": "direction", "description": "", "templateType": "anything", "definition": "siground(abs(arctan(aby/abx)*180/pi),3)", "group": "Ungrouped variables"}, "a2x": {"name": "a2x", "description": "", "templateType": "anything", "definition": "siground(a2*cos(theta1*pi/180),5)", "group": "Ungrouped variables"}, "b2x": {"name": "b2x", "description": "", "templateType": "anything", "definition": "siground(-b2*cos(theta2*pi/180),5)", "group": "Ungrouped variables"}, "a2": {"name": "a2", "description": "", "templateType": "anything", "definition": "siground(random(100..200#0),3)", "group": "Ungrouped variables"}, "a2y": {"name": "a2y", "description": "", "templateType": "anything", "definition": "siground(-a2*sin(theta1*pi/180),5)", "group": "Ungrouped variables"}, "m1": {"name": "m1", "description": "", "templateType": "anything", "definition": "siground(sqrt(a1^2+b1^2),3)", "group": "Ungrouped variables"}}, "rulesets": {}}]}], "navigation": {"allowregen": false, "reverse": true, "browse": true, "allowsteps": true, "showfrontpage": true, "showresultspage": "oncompletion", "onleave": {"action": "warnifunattempted", "message": ""}, "preventleave": true, "startpassword": ""}, "timing": {"allowPause": false, "timeout": {"action": "none", "message": ""}, "timedwarning": {"action": "warn", "message": "

You have 5 minutes remaining to complete this quiz.

", "feedbackmessages": []}, "contributors": [{"name": "Caroline Ferguson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3283/"}], "extensions": ["quantities"], "custom_part_types": [{"source": {"pk": 7, "author": {"name": "Christian Lawson-Perfect", "pk": 7}, "edit_page": "/part_type/7/edit"}, "name": "Quantity with units", "short_name": "quantity", "description": "

The student enters a quantity with units.

The scalar part of the student's quantity

", "definition": "match_student_number[1]"}, {"name": "raw_student_units", "description": "

The units of the student's quantity, before converting.

The units of the student's quantity.

\n

If the student used units incompatible with the units in the expected answer, and the \"what to do if incompatible units used\" option is set to \"mark as if correct units used\", the student's units are ignored and the expected units are used instead.

", "definition": "if(compatible(raw_student_units,correct_units) or settings[\"incompatible_units_action\"]<>\"convert\",\n raw_student_units,\n correct_units\n)"}, {"name": "student_quantity", "description": "

The student's answer, interpreted as a quantity.

\n

Marking fails if the student does not enter a valid quantity.

", "definition": "apply(student_units);\ntry(\n student_number * student_units,\n message,\n warn(\"Your answer is not a valid quantity.\");\n fail(\"Your answer is not a valid quantity.\")\n)"}, {"name": "correct_quantity", "description": "", "definition": "settings[\"correctAnswer\"]"}, {"name": "compatible", "description": "

Are the units of the student's quantity compatible with the units of the expected quantity?

", "definition": "if(compatible(raw_student_units,correct_quantity),\n true\n,\n let(message,\"Your answer does not have the correct dimensions.\",\n if(settings[\"incompatible_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n if(settings[\"incompatible_units_action\"]=\"convert\",\n incorrect(\"Your answer does not have the correct dimensions. It will be marked as if the correct dimensions were used, and then a penalty will be applied.\")\n ,\n incorrect(\"Your answer does not have the correct dimensions.\");\n end()\n )\n );\n false\n )\n)"}, {"name": "correct_units", "description": "", "definition": "units(correct_quantity)"}, {"name": "same_units", "description": "

/Are the student's quantity and the expected quantity in exactly the same units?

", "definition": "assert(raw_student_units=correct_units,\n let(\n message,if(settings[\"hint\"]=\"show units\",\"You did not give your answer in \"+units_string(correct_units)+\".\", \"Your answer is not in the expected units.\"),\n switch(\n settings[\"different_units_action\"]=\"prevent\",\n warn(message);\n fail(message)\n ,\n settings[\"different_units_action\"]=\"incorrect\",\n incorrect(message); \n warn(message);\n end()\n ,\n settings[\"different_units_action\"]=\"warn\",\n warn(message);\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n settings[\"different_units_penalty\"]<1,\n multiply_credit(1-settings[\"different_units_penalty\"],message)\n ,\n false\n )\n );\n false\n)"}, {"name": "has_units", "description": "", "definition": "assert(not unitless(student_quantity),\n assert(settings[\"allow_unitless\"],\n warn(\"You must include the units in your answer.\");\n fail(\"You did not include units in your answer.\")\n )\n)"}, {"name": "can_compare", "description": "

Can the student's answer be compared with the correct answer? True if compatible units used, or \"mark as if correct units used\" selected.

", "definition": "compatible or settings[\"incompatible_units_action\"]=\"convert\""}, {"name": "close_enough", "description": "

Is the student's quantity within the allowed tolerance of the expected answer?

", "definition": "if(can_compare,\n student_quantity>=correct_quantity - wiggle \n and \n student_quantity<=correct_quantity + wiggle \n,\n false\n)"}, {"name": "wiggle", "description": "", "definition": "units(correct_quantity)*abs(eval(settings[\"wiggle\"]))"}, {"name": "valid_number", "description": "

Is the scalar part of the student's answer a valid number?

", "definition": "if(isNaN(student_number),\n warn(translate(\"part.numberentry.answer invalid\"));\n fail(translate(\"part.numberentry.answer invalid\"))\n,\n true\n )\n"}], "settings": [{"name": "correctAnswer", "label": "Correct answer", "help_url": "", "hint": "The expected quantity.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "hint", "label": "Input hint", "help_url": "", "hint": "", "input_type": "dropdown", "default_value": "remind units", "choices": [{"value": "none", "label": "None"}, {"value": "remind units", "label": "Remind to include units"}, {"value": "show units", "label": "Show required units"}]}, {"name": "allow_unitless", "label": "Allow unitless answer?", "help_url": "", "hint": "If not ticked, the student is prevented from submitting an answer without specifying units.", "input_type": "checkbox", "default_value": true}, {"name": "incompatible_units_action", "label": "What to do if incompatible units used", "help_url": "", "hint": "If the student's answer is given in units incompatible with the correct answer's units:
\n
\n
• \"Prevent submission\": Prevent the student from submitting until they use compatible units
• \n
• \"Mark as incorrect\": Mark the student's answer as incorrect.
• \n
• \"Mark as if correct units used\": Mark the student's answer as if they used the correct units, and apply the \"different units used\" penalty.
• \n
", "input_type": "dropdown", "default_value": "incorrect", "choices": [{"value": "incorrect", "label": "Mark as incorrect"}, {"value": "prevent", "label": "Prevent submission"}, {"value": "convert", "label": "Mark as if correct units used"}]}, {"name": "different_units_action", "label": "What to do if different units used", "help_url": "", "hint": "If the student's answer is given in different units to the expected answer:
\n
\n
• \"Convert\" - silently convert the student's answer to the units used in the correct answer.
• \n
• \"Warn and convert\" - show a warning to the student, but convert.
• \n
• \"Prevent submission\" - don't allow the student to submit, and show a warning that they must use the same units.
• \n
• \"Mark incorrect\" - the student's answer is marked as incorrect.
• \n
", "input_type": "dropdown", "default_value": "convert", "choices": [{"value": "convert", "label": "Convert"}, {"value": "warn", "label": "Warn and convert"}, {"value": "prevent", "label": "Prevent submission"}, {"value": "incorrect", "label": "Mark incorrect"}]}, {"name": "different_units_penalty", "label": "Penalty if different units used", "help_url": "", "hint": "This penalty is applied if the student gives their answer in different units to the expected answer. The selected percentage of the student's score is taken away.", "input_type": "percent", "default_value": "100"}, {"name": "wiggle", "label": "Margin of error", "help_url": "", "hint": "The student's answer is marked correct if the difference between it and the correct answer is at most this value, measured in the same units as the correct answer.", "input_type": "mathematical_expression", "default_value": "10^-12", "subvars": true}], "public_availability": "always", "published": true, "extensions": ["quantities"]}], "resources": [["question-resources/triangle1_SKnWjZx.png", "/srv/numbas/media/question-resources/triangle1_SKnWjZx.png"], ["question-resources/triangle2_TkEeeUJ.png", "/srv/numbas/media/question-resources/triangle2_TkEeeUJ.png"]]}