// Numbas version: finer_feedback_settings {"name": "Chapter 1 Exercises", "metadata": {"description": "
Example exercise for Eng Fun Textbook
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "duration": 0, "percentPass": 0, "showQuestionGroupNames": false, "shuffleQuestionGroups": false, "showstudentname": true, "question_groups": [{"name": "Force Calculations", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": [""], "variable_overrides": [[]], "questions": [{"name": "Forces in equilibrium 1", "extensions": ["geogebra", "quantities"], "custom_part_types": [{"source": {"pk": 19, "author": {"name": "William Haynes", "pk": 2530}, "edit_page": "/part_type/19/edit"}, "name": "Engineering Accuracy with units", "short_name": "engineering-answer", "description": "A value with units marked right if within an adjustable % error of the correct value. Marked close if within a wider margin of error.
", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "siground(settings['correctAnswer'],4)", "hint": {"static": true, "value": ""}, "allowEmpty": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nswitch( \n right and good_units and right_sign, add_credit(1.0,'Correct.'),\n right and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\n right and right_sign and not good_units, add_credit(settings['C2'],'Correct value, but wrong or missing units.'),\n close and good_units, add_credit(settings['C1'],'Close.'),\n close and not good_units, add_credit(settings['C3'],'Answer is close, but wrong or missing units.'),\n incorrect('Wrong answer.')\n)\n\n\ninterpreted_answer:\nqty(student_scalar, student_units)\n\n\n\ncorrect_quantity:\nsettings[\"correctAnswer\"]\n\n\n\ncorrect_units:\nunits(correct_quantity)\n\n\nallowed_notation_styles:\n[\"plain\",\"en\"]\n\nmatch_student_number:\nmatchnumber(studentAnswer,allowed_notation_styles)\n\nstudent_scalar:\nmatch_student_number[1]\n\nstudent_units:\nreplace_regex('ohms','ohm',\n replace_regex('\u00b0', ' deg',\n replace_regex('-', ' ' ,\n studentAnswer[len(match_student_number[0])..len(studentAnswer)])),\"i\")\n\ngood_units:\ntry(\ncompatible(quantity(1, student_units),correct_units),\nmsg,\nfeedback(msg);false)\n\n\nstudent_quantity:\nswitch(not good_units, \n student_scalar * correct_units, \n not right_sign,\n -quantity(student_scalar, student_units),\n quantity(student_scalar,student_units)\n)\n \n\n\npercent_error:\ntry(\nscalar(abs((correct_quantity - student_quantity)/correct_quantity))*100 \n,msg,\nif(student_quantity=correct_quantity,0,100))\n \n\nright:\npercent_error <= settings['right']\n\n\nclose:\nright_sign and percent_error <= settings['close']\n\nright_sign:\nsign(student_scalar) = sign(correct_quantity)", "marking_notes": [{"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "switch( \n right and good_units and right_sign, add_credit(1.0,'Correct.'),\n right and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\n right and right_sign and not good_units, add_credit(settings['C2'],'Correct value, but wrong or missing units.'),\n close and good_units, add_credit(settings['C1'],'Close.'),\n close and not good_units, add_credit(settings['C3'],'Answer is close, but wrong or missing units.'),\n incorrect('Wrong answer.')\n)\n"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "qty(student_scalar, student_units)\n\n"}, {"name": "correct_quantity", "description": "", "definition": "settings[\"correctAnswer\"]\n\n"}, {"name": "correct_units", "description": "", "definition": "units(correct_quantity)\n"}, {"name": "allowed_notation_styles", "description": "", "definition": "[\"plain\",\"en\"]"}, {"name": "match_student_number", "description": "", "definition": "matchnumber(studentAnswer,allowed_notation_styles)"}, {"name": "student_scalar", "description": "", "definition": "match_student_number[1]"}, {"name": "student_units", "description": "Modify the unit portion of the student's answer by
\n1. replacing \"ohms\" with \"ohm\" case insensitive
\n2. replacing '-' with ' '
\n3. replacing '°' with ' deg'
\nto allow answers like 10 ft-lb and 30°
", "definition": "replace_regex('ohms','ohm',\n replace_regex('\u00b0', ' deg',\n replace_regex('-', ' ' ,\n studentAnswer[len(match_student_number[0])..len(studentAnswer)])),\"i\")"}, {"name": "good_units", "description": "", "definition": "try(\ncompatible(quantity(1, student_units),correct_units),\nmsg,\nfeedback(msg);false)\n"}, {"name": "student_quantity", "description": "This fixes the student answer for two common errors.
\nIf student_units are wrong - replace with correct units
\nIf student_scalar has the wrong sign - replace with right sign
\nIf student makes both errors, only one gets fixed.
", "definition": "switch(not good_units, \n student_scalar * correct_units, \n not right_sign,\n -quantity(student_scalar, student_units),\n quantity(student_scalar,student_units)\n)\n \n"}, {"name": "percent_error", "description": "", "definition": "try(\nscalar(abs((correct_quantity - student_quantity)/correct_quantity))*100 \n,msg,\nif(student_quantity=correct_quantity,0,100))\n "}, {"name": "right", "description": "", "definition": "percent_error <= settings['right']\n"}, {"name": "close", "description": "Only marked close if the student actually has the right sign.
", "definition": "right_sign and percent_error <= settings['close']"}, {"name": "right_sign", "description": "", "definition": "sign(student_scalar) = sign(correct_quantity) "}], "settings": [{"name": "correctAnswer", "label": "Correct Quantity.", "help_url": "", "hint": "The correct answer given as a JME quantity.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "right", "label": "% Accuracy for right.", "help_url": "", "hint": "Question will be considered correct if the scalar part of the student's answer is within this % of correct value.", "input_type": "code", "default_value": "0.2", "evaluate": true}, {"name": "close", "label": "% Accuracy for close.", "help_url": "", "hint": "Question will be considered close if the scalar part of the student's answer is within this % of correct value.", "input_type": "code", "default_value": "1.0", "evaluate": true}, {"name": "C1", "label": "Close with units.", "help_url": "", "hint": "Partial Credit for close value with appropriate units. if correct answer is 100 N and close is ±1%,First question on forces in equilibrium.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "A load of $W=$ {W} N is suspended from a roof by two cables, A and B.
\nCable A makes an angle $\\theta_1 = $ {theta_1}° with the roof, while cable B makes an angle $\\theta_2 = $ {theta_2}° with the roof.
\n{geogebra_applet('cbqunudv',[['angle1',theta_1+'°'],['angle2',theta_2+'°'],['W',W]])}
\nCalculate the magnitude of the tension in cables A and B.
", "advice": "Given values:
\n$W = \\var{W}$ N, $\\theta_1 = \\var{theta_1}°$, and $\\theta_2 = \\var{theta_2}°$,
\n\nThe solution using a force triangle is as follows:
\n{geogebra_applet('ncuhpcre',[['angle1',theta_2+'°'],['angle2',theta_1+'°']])}
\n$\\begin{align}
\\frac{T_A}{sin\\ (90^\\circ-\\theta_2)}&=\\frac{W}{sin\\ (\\theta_1+\\theta_2)} & \\frac{T_B}{sin\\ (90^\\circ-\\theta_1)}&=\\frac{W}{sin\\ (\\theta_1+\\theta_2)}\\\\\\\\ T_A&=W\\frac{sin\\ (90^\\circ-\\theta_2)}{sin\\ (\\theta_1+\\theta_2)} & T_B&=W\\frac{sin\\ (90^\\circ-\\theta_1)}{sin\\ (\\theta_1+\\theta_2)}\\\\
T_A&=\\var{W}\\ \\frac{sin\\ (90^\\circ-\\var{theta_2}^\\circ)}{sin\\ (\\var{theta_1}^\\circ+\\var{theta_2}^\\circ)} & T_B&=\\var{W}\\ \\frac{sin\\ (90^\\circ-\\var{theta_1}^\\circ)}{sin\\ (\\var{theta_1}^\\circ+\\var{theta_2})^\\circ}\\\\
T_A&=\\var{T_A} \\ \\var{unit} & T_B&=\\var{T_B} \\ \\var{unit}
\\end{align}$
The solution using components is as follows:
\n{geogebra_applet('rzbj2sxt',[['angle1',theta_1+'°'],['angle2',theta_2+'°'],['W',W]])}
\nSince the system is in equilibrium, we can say:
\n$\\begin{align}
\\Sigma_x &=0 &&& \\Sigma_y =0 &\\\\
T_Bcos\\theta_2 -T_Acos\\theta_1&=0 & (1) && T_Asin\\theta_1 +T_Bsin\\theta_2-W=0 && (2)\\\\
\\end{align}$
Solve for $T_A$ and $T_B$ using simultaneous equations.
\nRearranging (1)
\n$\\begin{align}T_B&=\\frac{T_Acos\\theta_1}{cos\\theta_2} =T_A\\frac{cos\\theta_1}{cos\\theta_2}& (3) \\\\ \\end{align}$
\nSubstitute (3) into (2)
\n$\\begin{align}
T_Asin\\theta_1+T_A\\frac{cos\\theta_1}{cos\\theta_2}sin\\theta_2 -W &=0\\\\
T_A \\left(sin\\theta_1+\\frac{cos\\theta_1}{cos\\theta_2}sin\\theta_2\\right)-W&=0\\\\
T_A&=\\frac{W}{ \\left(sin\\theta_1+\\frac{cos\\theta_1}{cos\\theta_2}sin\\theta_2\\right)}\\\\
T_A&=\\frac{\\var{W}}{ \\left(sin\\ \\var{theta_1}^\\circ+\\frac{cos\\ \\var{theta_1}^\\circ}{cos\\ \\var{theta_2}^\\circ}sin\\ \\var{theta_2}^\\circ\\right)}\\\\
T_A&=\\var{T_A} \\ \\var{unit}
\\end{align}$
Substitute the value of $T_A$ into (3) to find $T_B$
\n$\\begin{align}
T_B&=T_A\\frac{cos\\theta_1}{cos\\theta_2}\\\\
T_B&=\\var{T_A}\\ \\frac{cos\\ \\var{theta_1}^\\circ}{cos\\ \\var{theta_2}^\\circ}\\\\
T_B&=\\var{T_B} \\ \\var{unit}
\\end{align}$
Choose the method you want to use to solve this problem
"}, {"type": "information", "useCustomName": true, "customName": "Solve using a vector diagram", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [{"label": "See the free-body diagram", "rawLabel": "", "otherPart": 3, "variableReplacements": [], "availabilityCondition": "", "penalty": "Viewing free-body diagram", "penaltyAmount": "1", "showPenaltyHint": true, "lockAfterLeaving": false}, {"label": "My solution using a force triangle", "rawLabel": "", "otherPart": 4, "variableReplacements": [], "availabilityCondition": "", "penalty": "", "penaltyAmount": 0, "showPenaltyHint": true, "lockAfterLeaving": false}], "suggestGoingBack": true, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "This is the easier method to use for this problem.
\nYou will need to draw a free-body diagram for the point where the three cables join.
\nFrom this you need to draw a vector diagram.
\nThe vector diagram will be a closed force triangle.
\nYou can then use the sine rule to calculate the tension in each of the cables.
"}, {"type": "information", "useCustomName": true, "customName": "Solve using components", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [{"label": "See the free-body diagram", "rawLabel": "", "otherPart": 3, "variableReplacements": [], "availabilityCondition": "", "penalty": "Viewing free-body diagram", "penaltyAmount": "1", "showPenaltyHint": true, "lockAfterLeaving": false}, {"label": "My solution using components", "rawLabel": "", "otherPart": 7, "variableReplacements": [], "availabilityCondition": "", "penalty": "", "penaltyAmount": 0, "showPenaltyHint": true, "lockAfterLeaving": false}], "suggestGoingBack": true, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "This is the harder method to use for this problem as you will need to use simultaneous equations.
\nYou will need to draw a free-body diagram for the point where the three cables join, establishing a coordinate system indicating the directions of the forces.
\nThe coordinate system normally has the origin at the point where the cables meet and a horizontal $x$ axis and a vertical $y$ axis
\nYou can then use the equations for the equilibrium of concurrent forces to solve the problem:
\n$\\Sigma F_x=0$ and $\\Sigma F_y=0$
"}, {"type": "information", "useCustomName": true, "customName": "See the free-body diagram", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": true, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Let $W$ be the weight of the load, $T_A$ be the tension in cable A, and $T_B$ be in the tension in cable B.
\nLet $\\theta_1$ and $\\theta_2$ be the angles cable A and cable B make to the horizonal respectively. These are the same as the angles the cables make with the roof as they are alternate angles.
\nYour free-body dagram should look like this:
\n{geogebra_applet('rzbj2sxt',[['angle1',theta_1+'°'],['angle2',theta_2+'°'],['W',W]])}
"}, {"type": "gapfill", "useCustomName": true, "customName": "My solution using a force triangle", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [{"label": "See the force triangle", "rawLabel": "", "otherPart": 6, "variableReplacements": [], "availabilityCondition": "", "penalty": "Viewing the force triangle", "penaltyAmount": "1", "showPenaltyHint": true, "lockAfterLeaving": false}, {"label": "See method for solving by force triangle", "rawLabel": "", "otherPart": 5, "variableReplacements": [], "availabilityCondition": "", "penalty": "Viewing the method", "penaltyAmount": "1", "showPenaltyHint": true, "lockAfterLeaving": false}], "suggestGoingBack": true, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "From your force triangle, use the sine rule to calculate the tension in each cable.
\nEnter your solution to 3 sf and include units.
\n$T_{A}$ = [[0]]
\n$T_{B}$ = [[1]]
\n", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "Tension in cable A", "marks": "4", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Tension in cable A", "settings": {"correctAnswer": "qty(t_a, unit)", "right": "0.5", "close": "5", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "Tension in cable B", "marks": "4", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Tension in cable B", "settings": {"correctAnswer": "qty(t_b, unit)", "right": "0.5", "close": "5", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}, {"type": "information", "useCustomName": true, "customName": "See method for solving by force triangle", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": true, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "The sine rule $\\frac{a}{sin\\ A}=\\frac{b}{sin\\ B}=\\frac{c}{sin\\ C}$ can be used twice in your force triangle to find the tension in each of the cables.
\n{geogebra_applet('dweqdfpv',[['angle1',theta_2+'°'],['angle2',theta_1+'°']])}
\n$\\begin{align}
\\frac{T_A}{sin\\ (90^\\circ-\\theta_2)}&=\\frac{W}{sin\\ (\\theta_1+\\theta_2)} & \\frac{T_B}{sin\\ (90^\\circ-\\theta_1)}&=\\frac{W}{sin\\ (\\theta_1+\\theta_2)}\\\\\\\\ T_A&=W\\frac{sin\\ (90^\\circ-\\theta_2)}{sin\\ (\\theta_1+\\theta_2)} & T_B&=W\\frac{sin\\ (90^\\circ-\\theta_1)}{sin\\ (\\theta_1+\\theta_2)}\\\\\\\\
\\end{align}$
We draw the force triangle by drawing each of the three forces in the free-body diagram in turn. The tail of each force vector should join the head of the previous vector. As the forces are in equilibrium, the final diagram will be a closed triangle.
\nYour force triangle should look like this if you have drawn the vectors in the order $W$, $T_B$, and $T_A$.
\n{geogebra_applet('ncuhpcre',[['angle1',theta_2+'°'],['angle2',theta_1+'°']])}
\nIf you need help on how to construct the force triangle click on the <- button on the diagram and then use the the >> button to step through the construction process as shown below.
\nFrom your free-body diagram, use simultaneous equations to calculate the tension in each cable.
\nEnter your solution to 3 sf and include units.
\n$T_{A}$ = [[0]]
\n$T_{B}$ = [[1]]
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "Tension in cable A", "marks": "4", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Tension in cable A", "settings": {"correctAnswer": "qty(t_a, unit)", "right": "0.5", "close": "5", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "Tension in cable B", "marks": "4", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Tension in cable B", "alternatives": [{"type": "engineering-answer", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "", "useAlternativeFeedback": false, "settings": {"correctAnswer": "qty(t_b, unit)", "right": "0.5", "close": "5", "C1": "75", "C2": "50", "C3": "25"}}], "settings": {"correctAnswer": "qty(t_b, unit)", "right": "0.5", "close": "5", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}, {"type": "information", "useCustomName": true, "customName": "See method for solving by components", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": true, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "{geogebra_applet('rzbj2sxt',[['angle1',theta_1+'°'],['angle2',theta_2+'°'],['W',W]])}
\nSince the system is in equilibrium, we can say:
\n$\\begin{align}
\\Sigma_x &=0 &&& \\Sigma_y =0 &\\\\
T_Bcos\\theta_2 -T_Acos\\theta_1&=0 & (1) && T_Asin\\theta_1 +T_Bsin\\theta_2-W=0 && (2)\\\\
\\end{align}$
Solve for $T_A$ and $T_B$ using simultaneous equations.
\nRearranging (1)
\n$\\begin{align}T_B&=\\frac{T_Acos\\theta_1}{cos\\theta_2} =T_A\\frac{cos\\theta_1}{cos\\theta_2}& (3) \\\\ \\end{align}$
\nSubstitute (3) into (2)
\n$\\begin{align}
T_Asin\\theta_1+T_A\\frac{cos\\theta_1}{cos\\theta_2}sin\\theta_2 -W &=0\\\\
T_A \\left(sin\\theta_1+\\frac{cos\\theta_1}{cos\\theta_2}sin\\theta_2\\right)-W&=0\\\\
T_A&=\\frac{W}{ \\left(sin\\theta_1+\\frac{cos\\theta_1}{cos\\theta_2}sin\\theta_2\\right)}
\\end{align}$
Substitute the value of $T_A$ into (3) to find $T_B$
\n"}], "partsMode": "explore", "maxMarks": "8", "objectives": [{"name": "Tension in cable A", "limit": "4"}, {"name": "Tension in cable B", "limit": "4"}], "penalties": [{"name": "Viewing free-body diagram", "limit": "1"}, {"name": "Viewing the force triangle", "limit": "1"}, {"name": "Viewing the method", "limit": "1"}], "objectiveVisibility": "when-active", "penaltyVisibility": "when-active", "type": "question"}]}], "allowPrinting": true, "navigation": {"allowregen": true, "reverse": true, "browse": true, "allowsteps": true, "showfrontpage": true, "showresultspage": "oncompletion", "navigatemode": "menu", "onleave": {"action": "none", "message": ""}, "preventleave": true, "startpassword": ""}, "timing": {"allowPause": true, "timeout": {"action": "none", "message": ""}, "timedwarning": {"action": "none", "message": ""}}, "feedback": {"showactualmark": true, "showtotalmark": true, "showanswerstate": true, "allowrevealanswer": true, "advicethreshold": 0, "intro": "", "end_message": "", "reviewshowscore": true, "reviewshowfeedback": true, "reviewshowexpectedanswer": true, "reviewshowadvice": true, "feedbackmessages": [], "enterreviewmodeimmediately": true, "showexpectedanswerswhen": "inreview", "showpartfeedbackmessageswhen": "always", "showactualmarkwhen": "always", "showtotalmarkwhen": "always", "showanswerstatewhen": "always", "showadvicewhen": "inreview"}, "diagnostic": {"knowledge_graph": {"topics": [], "learning_objectives": []}, "script": "diagnosys", "customScript": ""}, "type": "exam", "contributors": [{"name": "Andrew Burkert", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/19802/"}], "extensions": ["geogebra", "quantities"], "custom_part_types": [{"source": {"pk": 19, "author": {"name": "William Haynes", "pk": 2530}, "edit_page": "/part_type/19/edit"}, "name": "Engineering Accuracy with units", "short_name": "engineering-answer", "description": "A value with units marked right if within an adjustable % error of the correct value. Marked close if within a wider margin of error.
", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "siground(settings['correctAnswer'],4)", "hint": {"static": true, "value": ""}, "allowEmpty": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nswitch( \n right and good_units and right_sign, add_credit(1.0,'Correct.'),\n right and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\n right and right_sign and not good_units, add_credit(settings['C2'],'Correct value, but wrong or missing units.'),\n close and good_units, add_credit(settings['C1'],'Close.'),\n close and not good_units, add_credit(settings['C3'],'Answer is close, but wrong or missing units.'),\n incorrect('Wrong answer.')\n)\n\n\ninterpreted_answer:\nqty(student_scalar, student_units)\n\n\n\ncorrect_quantity:\nsettings[\"correctAnswer\"]\n\n\n\ncorrect_units:\nunits(correct_quantity)\n\n\nallowed_notation_styles:\n[\"plain\",\"en\"]\n\nmatch_student_number:\nmatchnumber(studentAnswer,allowed_notation_styles)\n\nstudent_scalar:\nmatch_student_number[1]\n\nstudent_units:\nreplace_regex('ohms','ohm',\n replace_regex('\u00b0', ' deg',\n replace_regex('-', ' ' ,\n studentAnswer[len(match_student_number[0])..len(studentAnswer)])),\"i\")\n\ngood_units:\ntry(\ncompatible(quantity(1, student_units),correct_units),\nmsg,\nfeedback(msg);false)\n\n\nstudent_quantity:\nswitch(not good_units, \n student_scalar * correct_units, \n not right_sign,\n -quantity(student_scalar, student_units),\n quantity(student_scalar,student_units)\n)\n \n\n\npercent_error:\ntry(\nscalar(abs((correct_quantity - student_quantity)/correct_quantity))*100 \n,msg,\nif(student_quantity=correct_quantity,0,100))\n \n\nright:\npercent_error <= settings['right']\n\n\nclose:\nright_sign and percent_error <= settings['close']\n\nright_sign:\nsign(student_scalar) = sign(correct_quantity)", "marking_notes": [{"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "switch( \n right and good_units and right_sign, add_credit(1.0,'Correct.'),\n right and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\n right and right_sign and not good_units, add_credit(settings['C2'],'Correct value, but wrong or missing units.'),\n close and good_units, add_credit(settings['C1'],'Close.'),\n close and not good_units, add_credit(settings['C3'],'Answer is close, but wrong or missing units.'),\n incorrect('Wrong answer.')\n)\n"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "qty(student_scalar, student_units)\n\n"}, {"name": "correct_quantity", "description": "", "definition": "settings[\"correctAnswer\"]\n\n"}, {"name": "correct_units", "description": "", "definition": "units(correct_quantity)\n"}, {"name": "allowed_notation_styles", "description": "", "definition": "[\"plain\",\"en\"]"}, {"name": "match_student_number", "description": "", "definition": "matchnumber(studentAnswer,allowed_notation_styles)"}, {"name": "student_scalar", "description": "", "definition": "match_student_number[1]"}, {"name": "student_units", "description": "Modify the unit portion of the student's answer by
\n1. replacing \"ohms\" with \"ohm\" case insensitive
\n2. replacing '-' with ' '
\n3. replacing '°' with ' deg'
\nto allow answers like 10 ft-lb and 30°
", "definition": "replace_regex('ohms','ohm',\n replace_regex('\u00b0', ' deg',\n replace_regex('-', ' ' ,\n studentAnswer[len(match_student_number[0])..len(studentAnswer)])),\"i\")"}, {"name": "good_units", "description": "", "definition": "try(\ncompatible(quantity(1, student_units),correct_units),\nmsg,\nfeedback(msg);false)\n"}, {"name": "student_quantity", "description": "This fixes the student answer for two common errors.
\nIf student_units are wrong - replace with correct units
\nIf student_scalar has the wrong sign - replace with right sign
\nIf student makes both errors, only one gets fixed.
", "definition": "switch(not good_units, \n student_scalar * correct_units, \n not right_sign,\n -quantity(student_scalar, student_units),\n quantity(student_scalar,student_units)\n)\n \n"}, {"name": "percent_error", "description": "", "definition": "try(\nscalar(abs((correct_quantity - student_quantity)/correct_quantity))*100 \n,msg,\nif(student_quantity=correct_quantity,0,100))\n "}, {"name": "right", "description": "", "definition": "percent_error <= settings['right']\n"}, {"name": "close", "description": "Only marked close if the student actually has the right sign.
", "definition": "right_sign and percent_error <= settings['close']"}, {"name": "right_sign", "description": "", "definition": "sign(student_scalar) = sign(correct_quantity) "}], "settings": [{"name": "correctAnswer", "label": "Correct Quantity.", "help_url": "", "hint": "The correct answer given as a JME quantity.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "right", "label": "% Accuracy for right.", "help_url": "", "hint": "Question will be considered correct if the scalar part of the student's answer is within this % of correct value.", "input_type": "code", "default_value": "0.2", "evaluate": true}, {"name": "close", "label": "% Accuracy for close.", "help_url": "", "hint": "Question will be considered close if the scalar part of the student's answer is within this % of correct value.", "input_type": "code", "default_value": "1.0", "evaluate": true}, {"name": "C1", "label": "Close with units.", "help_url": "", "hint": "Partial Credit for close value with appropriate units. if correct answer is 100 N and close is ±1%,