// Numbas version: finer_feedback_settings {"name": "Chapter 4 Exercises", "metadata": {"description": "
End of chapter exercises for Engineering Statics: Open and Interactive
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "duration": 0, "percentPass": 0, "showQuestionGroupNames": true, "shuffleQuestionGroups": false, "showstudentname": true, "question_groups": [{"name": "Moments", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": ["Definition of a moment", "Verignon's Theorem", "", "Semicircle", "", ""], "variable_overrides": [[], [], [], [], [], []], "questions": [{"name": "Moment of a Force: using the definition of a moment", "extensions": ["geogebra", "quantities", "weh"], "custom_part_types": [{"source": {"pk": 24, "author": {"name": "William Haynes", "pk": 2530}, "edit_page": "/part_type/24/edit"}, "name": "Angle quantity", "short_name": "angle-quantity-from-reference", "description": "Angle as a quantity in degrees.
", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "plain_string(settings['correct_quantity'])", "hint": {"static": true, "value": ""}, "allowEmpty": {"static": true, "value": false}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nswitch( \nright and good_units and right_sign and angle_in_range, add_credit(1.0,'Correct.'),\nright and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\nright and right_sign and not good_units, add_credit(settings['C2'],'Correct angle, but missing degree symbol.'),\nright and good_units and right_sign and not angle_in_range,add_credit(settings['C1'],'Angle is out of range.'),\nclose and good_units, add_credit(settings['C1'],'Close.'),\nclose and not good_units, add_credit(settings['C3'],'Answer is close, but missing degree symbol.'),\nincorrect('Wrong answer.')\n)\n\ninterpreted_answer:\nqty(student_scalar, student_units)\n\ncorrect_scalar:\nscalar(correct_quantity)\n \n\ncorrect_quantity:\nsettings['correct_quantity']\n\ncorrect_units:\nunits(correct_quantity)\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:\njoin(\nsplit(studentAnswer[len(match_student_number[0])..len(studentAnswer)]\n,\"\u00b0\"),\" deg\")\n\n\n\ngood_units:\ntry(\nkind(quantity(1, student_units))= kind(correct_quantity),\nmsg,\nfeedback(msg);false)\n\nstudent_quantity:\nswitch(not good_units, \nstudent_scalar * correct_units, \nnot right_sign,\n-quantity(student_scalar, student_units),\nquantity(student_scalar,student_units)\n)\n\nright_sign:\nsign(student_scalar) = sign(correct_quantity)\n\nangle_in_range:\nif(settings['restrict_angle'], abs(student_scalar) <= 90, true)\n\nright:\nwithinTolerance(abs(student_scalar), abs(correct_scalar), settings['right'])\n\nclose:\nwithinTolerance(student_scalar, correct_scalar, settings['close'])", "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( \nright and good_units and right_sign and angle_in_range, add_credit(1.0,'Correct.'),\nright and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\nright and right_sign and not good_units, add_credit(settings['C2'],'Correct angle, but missing degree symbol.'),\nright and good_units and right_sign and not angle_in_range,add_credit(settings['C1'],'Angle is out of range.'),\nclose and good_units, add_credit(settings['C1'],'Close.'),\nclose and not good_units, add_credit(settings['C3'],'Answer is close, but missing degree symbol.'),\nincorrect('Wrong answer.')\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "qty(student_scalar, student_units)"}, {"name": "correct_scalar", "description": "", "definition": "scalar(correct_quantity)\n "}, {"name": "correct_quantity", "description": "", "definition": "settings['correct_quantity']"}, {"name": "correct_units", "description": "", "definition": "units(correct_quantity)"}, {"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": "", "definition": "join(\nsplit(studentAnswer[len(match_student_number[0])..len(studentAnswer)]\n,\"\u00b0\"),\" deg\")\n\n"}, {"name": "good_units", "description": "", "definition": "try(\nkind(quantity(1, student_units))= kind(correct_quantity),\nmsg,\nfeedback(msg);false)"}, {"name": "student_quantity", "description": "", "definition": "switch(not good_units, \nstudent_scalar * correct_units, \nnot right_sign,\n-quantity(student_scalar, student_units),\nquantity(student_scalar,student_units)\n)"}, {"name": "right_sign", "description": "", "definition": "sign(student_scalar) = sign(correct_quantity)"}, {"name": "angle_in_range", "description": "", "definition": "if(settings['restrict_angle'], abs(student_scalar) <= 90, true)"}, {"name": "right", "description": "Will check for correct sign elswhere.
", "definition": "withinTolerance(abs(student_scalar), abs(correct_scalar), settings['right'])"}, {"name": "close", "description": "Must have correct sign to be close.
", "definition": "withinTolerance(student_scalar, correct_scalar, settings['close'])\n"}], "settings": [{"name": "correct_quantity", "label": "Correct Angle as quantity ", "help_url": "", "hint": "", "input_type": "code", "default_value": "qty(45,'deg')", "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 amount from the correct value.", "input_type": "code", "default_value": "0.1", "evaluate": true}, {"name": "restrict_angle", "label": "Less than 90\u00b0", "help_url": "", "hint": "When checked, angle must be between -90° and +90°.", "input_type": "checkbox", "default_value": true}, {"name": "C1", "label": "Close with units.", "help_url": "", "hint": "Partial Credit for close value with appropriate units.", "input_type": "percent", "default_value": "75"}, {"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 amount from the correct value.", "input_type": "code", "default_value": "0.5", "evaluate": true}, {"name": "C2", "label": "No units or wrong sign", "help_url": "", "hint": "Partial credit for forgetting units or using wrong sign.", "input_type": "percent", "default_value": "50"}, {"name": "C3", "label": "Close, no units.", "help_url": "", "hint": "Partial Credit for close value without units.", "input_type": "percent", "default_value": "25"}], "public_availability": "restricted", "published": false, "extensions": ["quantities"]}, {"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%,Calculate the moment of a force about three points using the definition of a Moment. All forces and points are in the same plane.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "Force $\\mathbf{F}$, which has a magnitude of {F}, acts along a line passing through points $D$ and $D'$. The grid units are in [{units[0]}] and counter-clockwise moments are positive. Determine the moment of the force about points $A$, and $B$ using the definition of the moment:
\n$M = F \\cdot d_\\perp$.
\n{applet}
", "advice": "Step a) walks you through the procedure to find a moment using the definition of the moment.
\nAn alternate approach is to use Verignon's Theorem
\nVerigon's theorem says that the moment of a force is the sum of the moments of its components.
\n$ M = \\pm F_x d_y \\pm F_y d_x$
\nProcedure:
\nPoint D' on loa
", "templateType": "anything", "can_override": false}, "C": {"name": "C", "group": "Inputs", "definition": "vector(random(-8..8),random(-8..8))", "description": "point C
", "templateType": "anything", "can_override": false}, "sum": {"name": "sum", "group": "Ungrouped variables", "definition": "Mx-My", "description": "", "templateType": "anything", "can_override": false}, "Mx": {"name": "Mx", "group": "Ungrouped variables", "definition": "qty(\n siground(cross(ra,vector(force[0],0,0))[2],4),\n units[0] + ' ' + units[1])\n\n", "description": "Moment of F_x about point A
", "templateType": "anything", "can_override": false}, "dperp_c": {"name": "dperp_c", "group": "Ungrouped variables", "definition": "abs(MC/F)", "description": "", "templateType": "anything", "can_override": false}, "Fy": {"name": "Fy", "group": "Ungrouped variables", "definition": "qty(force[1],units[1])", "description": "", "templateType": "anything", "can_override": false}, "rc": {"name": "rc", "group": "Ungrouped variables", "definition": "D-C+vector(0,0,0)\n", "description": "position vector
", "templateType": "anything", "can_override": false}, "rb": {"name": "rb", "group": "Ungrouped variables", "definition": "D-B+vector(0,0,0)\n", "description": "position vector
", "templateType": "anything", "can_override": false}, "ra": {"name": "ra", "group": "Ungrouped variables", "definition": "D-A+vector(0,0,0)", "description": "position vector
", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "Inputs", "definition": "random(['in','lb'],['ft','lb'],['m','N'],['m','kN'])", "description": "", "templateType": "anything", "can_override": false}, "dperp_a": {"name": "dperp_a", "group": "Ungrouped variables", "definition": "abs(MA/F)", "description": "", "templateType": "anything", "can_override": false}, "dir_b": {"name": "dir_b", "group": "Ungrouped variables", "definition": "if(sign(MB)>=0,1,-1)", "description": "", "templateType": "anything", "can_override": false}, "Mb": {"name": "Mb", "group": "Ungrouped variables", "definition": "qty(cross(rb,force)[2], units[0] + ' ' + units[1])", "description": "", "templateType": "anything", "can_override": false}, "theta_A": {"name": "theta_A", "group": "definition method", "definition": "let( ang,degrees(arccos((dot(ra,force)/abs(ra)/abs(force)))),if(ang<90,ang,180-ang))", "description": "", "templateType": "anything", "can_override": false}, "force": {"name": "force", "group": "Ungrouped variables", "definition": "scalar(F)(D'-D)/abs(D'-D) + vector(0,0,0)\n", "description": "\nVector Force = F λ
\nλ = (D'-D)/abs(D'-D)
", "templateType": "anything", "can_override": false}, "Fx": {"name": "Fx", "group": "Ungrouped variables", "definition": "qty(force[0],units[1])", "description": "", "templateType": "anything", "can_override": false}, "test": {"name": "test", "group": "definition method", "definition": "siground(dperp,4)", "description": "", "templateType": "anything", "can_override": false}, "A": {"name": "A", "group": "Inputs", "definition": "vector(random(-8..8),random(-8..8))", "description": "point A
", "templateType": "anything", "can_override": false}, "D": {"name": "D", "group": "Inputs", "definition": "vector(random(-8..8),random(-8..8))", "description": "Point D
", "templateType": "anything", "can_override": false}, "debug": {"name": "debug", "group": "Inputs", "definition": "false", "description": "", "templateType": "anything", "can_override": false}, "dir_a": {"name": "dir_a", "group": "Ungrouped variables", "definition": "if(sign(MA)>=0,1,-1)", "description": "replacement variable for direction of moment.
", "templateType": "anything", "can_override": false}, "B": {"name": "B", "group": "Inputs", "definition": "vector(random(-8..8),random(-8..8))", "description": "point B
", "templateType": "anything", "can_override": false}, "AD": {"name": "AD", "group": "definition method", "definition": "qty(abs(A-D),units[0])", "description": "", "templateType": "anything", "can_override": false}, "F": {"name": "F", "group": "Inputs", "definition": "qty(random(1..5)random(1,2,5,10,20),units[1])", "description": "Magnitude of force F
", "templateType": "anything", "can_override": false}, "dperp": {"name": "dperp", "group": "definition method", "definition": "AD sin(radians(theta_a))", "description": "", "templateType": "anything", "can_override": false}, "applet": {"name": "applet", "group": "Ungrouped variables", "definition": "geogebra_applet('n8thnjk7',params)\n", "description": "", "templateType": "anything", "can_override": false}, "params": {"name": "params", "group": "Ungrouped variables", "definition": "[A: A, B: B, C: C, D: D, D': D', F: scalar(F)]\n\n", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "// makes sure that no point aligns vertically or horizontally with another\nnot some(map(p[0]=q[0] or p[1]=q[1],[p,q],combinations([A,B,C,D,D'],2)))\nand sign(Ma)<>sign(Mc)\nand theta_A > 15\nand all(map(scalar(d)>=1,d,[dperp_a,dperp_b,dperp_c]))", "maxRuns": 100}, "ungrouped_variables": ["ra", "rb", "rc", "force", "Mx", "My", "Ma", "Mb", "Mc", "sum", "Fx", "Fy", "dir_a", "dir_b", "dir_c", "dperp_a", "dperp_b", "dperp_c", "applet", "params"], "variable_groups": [{"name": "Inputs", "variables": ["A", "B", "C", "D", "D'", "F", "units", "debug"]}, {"name": "definition method", "variables": ["theta_A", "AD", "dperp", "MA'", "test"]}, {"name": "Unnamed group", "variables": []}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Geometry", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Find the length of the line segment from $A$ to $D$. (Or any other point on the line of action of F.)
\n$d$ = [[0]] {qty(siground(abs(A-D),4),units[0]) }
\nFind the angle (<= 90°) between segment $\\overline{AD}$ and the line of action of F.
\n$\\theta_A =$ [[1]] {qty(siground(theta_A,4),'deg') }
\nFind the perpendicular distance between point $A$ and the line of action of force F.
\n$d_\\perp =$ [[2]] {siground(dperp,4)}
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "AD", "marks": "4", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "AD", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "angle-quantity-from-reference", "useCustomName": true, "customName": "$\u03b8_A$", "marks": "4", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correct_quantity": "siground(qty(theta_A,'deg'),4)", "right": "0.2", "restrict_angle": true, "C1": "75", "close": "1.0", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "$d_\u27c2$", "marks": "4", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "dperp", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "$M_A$", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Use the definition of the moment $M_A = F \\cdot d_\\perp$ to find the moment of F about A.
\n$\\textbf{M}_A$ is a [[0]] moment with a magnitude of [[1]].
\n$M_A$= {siground(Ma,4)}
", "gaps": [{"type": "1_n_2", "useCustomName": true, "customName": "direction", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["Counterclockwise", "Clockwise"], "matrix": ["if(dir_a=1,2,0)", "if(dir_a=-1,2,0)"], "distractors": ["You chose Counterclockwise", "You chose Clockwise."]}, {"type": "engineering-answer", "useCustomName": true, "customName": "$M_A$", "marks": "4", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "abs(Ma)", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "$M_B$", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "In the same way, determine the moment of force F about point B.
\n$\\textbf{M}_B$ is a [[0]] moment with a magnitude of [[1]].
\n$M_b$= {siground(Mb,4)}
", "gaps": [{"type": "1_n_2", "useCustomName": true, "customName": "direction", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["Counterclockwise", "Clockwise"], "matrix": ["if(dir_b=1,2,0)", "if(dir_b=-1,2,0)"], "distractors": ["You chose Counterclockwise", "You chose Clockwise."]}, {"type": "engineering-answer", "useCustomName": true, "customName": "$M_B$", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "abs(Mb)", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Moment of a Force: using Verignon's Theorem", "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%,Calculate the moment of a force about three points using Verignon' theorem. All forces and points are in the same plane.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "{applet}
\nForce $\\mathbf{F}$, which has a magnitude of {F}, acts along a line passing through points $D$ and $D'$. The grid units are in [{units[0]}] and counter-clockwise moments are positive. Determine the moment of the force about points $A$ and $B$ using Verignon's Theorem
\n\n", "advice": "Verignon's Theorem: $M = \\pm F_x\\ d_y \\pm F_y\\ d_x$
\nVerigon's theorem says that the moment of a force is the sum of the moments of its components.
\nProcedure:
\nmap(sqrt(x^2+y^2),[x,y],[ [3,4], [5,12] ])
", "templateType": "anything", "can_override": false}, "dir_b": {"name": "dir_b", "group": "Ungrouped variables", "definition": "if(sign(MB)>=0,1,-1)", "description": "", "templateType": "anything", "can_override": false}, "dir_c": {"name": "dir_c", "group": "Ungrouped variables", "definition": "if(sign(MC)>=0,1,-1)", "description": "", "templateType": "anything", "can_override": false}, "Fx": {"name": "Fx", "group": "Ungrouped variables", "definition": "qty(force[0],units[1])", "description": "", "templateType": "anything", "can_override": false}, "Ma": {"name": "Ma", "group": "Ungrouped variables", "definition": "qty(cross(ra,force)[2], units[0] + ' ' + units[1])\n", "description": "", "templateType": "anything", "can_override": false}, "Mc": {"name": "Mc", "group": "Ungrouped variables", "definition": "qty(cross(rc,force)[2], units[0] + ' ' + units[1])", "description": "", "templateType": "anything", "can_override": false}, "ra": {"name": "ra", "group": "Ungrouped variables", "definition": "D-A+vector(0,0,0)", "description": "position vector
", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "Inputs", "definition": "random(['in','lb'],['ft','lb'],['m','N'],['m','kN'])", "description": "", "templateType": "anything", "can_override": false}, "D": {"name": "D", "group": "Inputs", "definition": "vector(random(-8..8),random(-8..8))", "description": "Point D
", "templateType": "anything", "can_override": false}, "B": {"name": "B", "group": "Inputs", "definition": "vector(random(-8..8),random(-8..8))", "description": "point B
", "templateType": "anything", "can_override": false}, "Mb": {"name": "Mb", "group": "Ungrouped variables", "definition": "qty(cross(rb,force)[2], units[0] + ' ' + units[1])", "description": "", "templateType": "anything", "can_override": false}, "force": {"name": "force", "group": "Ungrouped variables", "definition": "scalar(F)(D'-D)/abs(D'-D) + vector(0,0,0)\n", "description": "\nVector Force = F λ
\nλ = (D'-D)/abs(D'-D)
", "templateType": "anything", "can_override": false}, "A": {"name": "A", "group": "Inputs", "definition": "vector(random(-8..8),random(-8..8))", "description": "point A
", "templateType": "anything", "can_override": false}, "dir_a": {"name": "dir_a", "group": "Ungrouped variables", "definition": "if(sign(MA)>=0,1,-1)", "description": "replacement variable for direction of moment.
", "templateType": "anything", "can_override": false}, "rc": {"name": "rc", "group": "Ungrouped variables", "definition": "D-C+vector(0,0,0)\n", "description": "position vector
", "templateType": "anything", "can_override": false}, "sum": {"name": "sum", "group": "Ungrouped variables", "definition": "Mx-My", "description": "", "templateType": "anything", "can_override": false}, "rb": {"name": "rb", "group": "Ungrouped variables", "definition": "D-B+vector(0,0,0)\n", "description": "position vector
", "templateType": "anything", "can_override": false}, "F": {"name": "F", "group": "Inputs", "definition": "qty(random(1..5)random(1,2,5,10,20),units[1])", "description": "Magnitude of force F
", "templateType": "anything", "can_override": false}, "debug": {"name": "debug", "group": "Inputs", "definition": "false", "description": "", "templateType": "anything", "can_override": false}, "test": {"name": "test", "group": "Inputs", "definition": "align(A,B)", "description": "", "templateType": "anything", "can_override": false}, "D'": {"name": "D'", "group": "Inputs", "definition": "vector(random(-8..8),random(-8..8))", "description": "Point D' on loa
", "templateType": "anything", "can_override": false}, "C": {"name": "C", "group": "Inputs", "definition": "vector(random(-8..8),random(-8..8))", "description": "point C
", "templateType": "anything", "can_override": false}, "My": {"name": "My", "group": "Ungrouped variables", "definition": "qty(\n siground(cross(ra,vector(0,force[1],0))[2],4),\n units[0] + ' ' + units[1])\n\n", "description": "", "templateType": "anything", "can_override": false}, "Mx": {"name": "Mx", "group": "Ungrouped variables", "definition": "qty(\n siground(cross(ra,vector(force[0],0,0))[2],4),\n units[0] + ' ' + units[1])\n\n", "description": "Moment of F_x about point A
", "templateType": "anything", "can_override": false}, "applet": {"name": "applet", "group": "Ungrouped variables", "definition": "geogebra_applet('n8thnjk7', params)\n\n", "description": "", "templateType": "anything", "can_override": false}, "params": {"name": "params", "group": "Ungrouped variables", "definition": "[A: A, B: B, C: C, D: D ,D': D', F: scalar(F)]", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "// makes sure that no point aligns vertically or horizontally with another\nnot some(map(p[0]=q[0] or p[1]=q[1],[p,q],combinations([A,B,C,D,D'],2)))\nand sign(ma)<>sign(mb)\n", "maxRuns": 100}, "ungrouped_variables": ["ra", "rb", "rc", "force", "Mx", "My", "Ma", "Mb", "Mc", "sum", "Fx", "Fy", "dir_a", "dir_b", "dir_c", "applet", "params"], "variable_groups": [{"name": "Inputs", "variables": ["A", "B", "C", "D", "D'", "F", "units", "debug", "test", "test2"]}], "functions": {"Align": {"parameters": [["V1", "vector"], ["V2", "vector"]], "type": "boolean", "language": "jme", "definition": "(V1[0]=V2[0]) or (V1[1]=V2[1])"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Rectangular components", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Determine the magnitudes of the rectangular components of $\\mathbf{F}$.
\n$F_x$ = [[0]] $F_y$ = [[1]] $F_x$ = {siground(Fx,4)} $F_y$ = {siground(Fy,4)}
\nDetermine the horizontal and vertical distances from $D$ to $A$.
\n$d_x$ = [[2]] $d_y$ = [[3]] Delta = {D-A}
\n\n\n\n", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "fx", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "abs(Fx)", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "fy", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "abs(Fy)", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "dx", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "abs(qty((D-A)[0],units[0]))", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "dy", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "abs(qty((D-A)[1],units[0]))", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": " Scalar Components of $M_A$", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Determine the moments of the components. Counterclockwise moment are positive.
\nThe moment of $F_x$ about point $A$ is [[0]] = {siground(mx,4)}
\nThe moment of $F_y$ is about point $A$ is [[1]] = {siground(my,4)}
\n\n\n\n", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "M1", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "Mx", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "M2", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "My", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "$M_A$", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "
Add the moments of the components to determine the moment of force $\\mathbf{F}$ about point $A$ .
\n$\\mathbf{M}_A$ is a [[0]] moment with a magnitude of [[1]]
", "gaps": [{"type": "1_n_2", "useCustomName": true, "customName": "direction", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["Counterclockwise", "Clockwise"], "matrix": ["if(dir_a=1,5,0)", "if(dir_a=-1,5,0)"], "distractors": ["You chose Counterclockwise", "You chose Clockwise."]}, {"type": "engineering-answer", "useCustomName": true, "customName": "Mag", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "abs(Ma)", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "$M_B$", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "In the same way, determine the moment of force $\\mathbf{F}$ about point $B$ .
\n$\\mathbf{M}_B$ is a [[0]] moment with a magnitude of [[1]]
\n$M_b$= {siground(Mb,4)}.
", "gaps": [{"type": "1_n_2", "useCustomName": true, "customName": "Direction", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["Counterclockwise", "Clockwise"], "matrix": ["if(dir_b=1,5,0)", "if(dir_b=-1,5,0)"], "distractors": ["You chose Counterclockwise", "You chose Clockwise."]}, {"type": "engineering-answer", "useCustomName": true, "customName": "Mag", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "abs(Mb)", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Moment of a force about a point", "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%,Determine the moment of a force about a point by using $M= F d_\\perp$ or $M = F_\\perp d$.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "{applet}
\nA $\\var{scalar(f)}$ lb force $\\mathbf{F}$ is applied to the control rod $AB$ as shown. Knowing that the length of the rod is $\\var{d}$ and that $\\alpha$ is {alpha}°, determine the component of $\\mathbf{F}$ perpendicular to rod $AB$ and the magnitude of the moment produced.
\n\nA $\\var{scalar(f)}$ lb force $\\mathbf{F}$ is applied to the control rod $AB$ as shown. Knowing that the length of the rod is $\\var{d}$ and that $\\alpha$ is {alpha}°, determine the perpendicular distance from the line of action of force $\\mathbf{F}$ to point $B$, and the magnitude of the moment produced.
\n\nForce $\\mathbf{F}$ is applied to the $\\var{d}$ long control rod $AB$ at angle $\\alpha$ = {alpha}° as shown. Knowing that it creates a {siground(scalar(M),4)} in lb {direction} moment about point B, determine the perpendicular distance from the line of action of force $\\mathbf{F}$ to point $B$, and the magnitude of force $\\mathbf{F}$.
\n\nA {scalar(f)} lb force $\\mathbf{F}$ is applied to control rod $AB$ at angle $\\alpha$ = {alpha}° as shown. Knowing that it creates a {siground(scalar(M),4)} in lb {direction} moment about point $B$ , determine the length of the control rod, and the component of $\\mathbf{F}$ in a direction perpendicular to $AB$ .
\n\nA {scalar(f)} lb force $\\mathbf{F}$ is applied to the {scalar(d)} inch long control rod $AB$ as shown. Knowing that it creates a {siground(scalar(M),4)} in lb {direction} moment about point $B$ , determine angle $\\alpha$ and the perpendicular distance between the line of action of force $\\mathbf{F}$ and point $B$ .
\nF: {F} D:{D} $\\alpha$: {alpha} $F_\\perp$: {fperp} $d_\\perp$: {dperp} M: {M}
\n", "advice": "
{advice}
\nMethod 1
\nMethod 2
\nangle of force with respect to the bar.
", "templateType": "anything", "can_override": false}, "Fperp": {"name": "Fperp", "group": "results", "definition": "M/D", "description": "The perpendicular component of the force.
", "templateType": "anything", "can_override": false}, "version": {"name": "version", "group": "display", "definition": "random(0..4)", "description": "which question version?
", "templateType": "anything", "can_override": false}, "direction": {"name": "direction", "group": "results", "definition": "if(alpha'<180,'clockwise','counterclockwise')", "description": "", "templateType": "anything", "can_override": false}, "Dperp": {"name": "Dperp", "group": "results", "definition": "M/F", "description": "The perpendicular distance.
", "templateType": "anything", "can_override": false}, "F": {"name": "F", "group": "Inputs", "definition": "siground(qty(random(10..150)*random(0.1,0.5,1),'lb'),4)", "description": "Magnitude of the force.
", "templateType": "anything", "can_override": false}, "debug": {"name": "debug", "group": "display", "definition": "false", "description": "", "templateType": "anything", "can_override": false}, "beta": {"name": "beta", "group": "display", "definition": "if(beta'>90,180-beta',beta')", "description": "", "templateType": "anything", "can_override": false}, "alpha": {"name": "alpha", "group": "display", "definition": "if(abs(alpha')>90,(180-abs(alpha')),abs(alpha'))", "description": "Angle alpha as shown on the diagram, always less than 90°.
", "templateType": "anything", "can_override": false}, "answers": {"name": "answers", "group": "display", "definition": "[['$F_\\\\perp$', Fperp , '$M$', M],\n\n['$d_\\\\perp$', Dperp, '$M$', M ],\n\n['$d_\\\\perp$',Dperp, '$F$', F],\n\n['$\\\\ell$', D, '$F_\\\\perp$', Fperp],\n\n['$\\\\alpha$',qty(alpha,'deg'), '$d_\\\\perp$',Dperp]]\n", "description": "labels, gap answer, and units
", "templateType": "anything", "can_override": false}, "beta'": {"name": "beta'", "group": "Inputs", "definition": "random(20..160#10 except 90)", "description": "angle of bar from positive x axis
", "templateType": "anything", "can_override": false}, "M": {"name": "M", "group": "results", "definition": "siground(sin(radians(alpha)),5) * ( F * D )", "description": "The magnitude of the moment
", "templateType": "anything", "can_override": false}, "D": {"name": "D", "group": "Inputs", "definition": "qty(random(6..30#2),'in')", "description": "Length of the bar AB.
", "templateType": "anything", "can_override": false}, "applet": {"name": "applet", "group": "ggb", "definition": "geogebra_applet('tvby7hmg', params)", "description": "", "templateType": "anything", "can_override": false}, "params": {"name": "params", "group": "ggb", "definition": "['\u03b1\\'': radians(alpha'), '\u03b2\\'': radians(beta'), \nshow1: [visible: false], show2: [visible: false]]", "description": "", "templateType": "anything", "can_override": false}, "advice": {"name": "advice", "group": "ggb", "definition": "showAdvice(geogebra_applet('tvby7hmg', params))", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [{"name": "Inputs", "variables": ["beta'", "alpha'", "D", "F"]}, {"name": "results", "variables": ["M", "Fperp", "Dperp", "direction"]}, {"name": "display", "variables": ["alpha", "beta", "version", "answers", "debug"]}, {"name": "ggb", "variables": ["applet", "params", "advice"]}], "functions": {"showAdvice": {"parameters": [["app", "ggbapplet"]], "type": "anything", "language": "javascript", "definition": "// see https://wiki.geogebra.org/en/Reference:GeoGebra_Apps_API for other commands\n\napp.promise.then(function(d) {\n d.app.setVisible('show1', true);\n d.app.setVisible('show2', true);\n d.app.setValue('show1', true);\n d.app.setCaption('\u03b1', '$%v$');\n});\nreturn new Numbas.jme.types.ggbapplet(app);\n"}}, "preamble": {"js": "//question.signals.on('adviceDisplayed',function() {\n\n//try{\n// var app = question.scope.variables.applet.app; \n// app.setVisible('show1', true);\n// app.setVisible('show2', true);\n// app.setValue('show1', true);\n// app.setCaption('\u03b1', '$%v$');\n// }\n// catch(err){} \n//})\n\n\n", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Answers", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "{answers[version][0]} = [[0]] $\\qquad$ {answers[version][2]} = [[1]]
\n\n\n{answers[version][1]}
\n{answers[version][3]}
", "gaps": [{"type": "engineering-answer", "useCustomName": false, "customName": "", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "answers[version][1]", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": false, "customName": "", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "answers[version][3]", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Moment: Semicircle", "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%,Calculate the moment of a force. Must calculate perpendicular distance based on simple geometry, and recognize direction.
", "licence": "Creative Commons Attribution-ShareAlike 4.0 International"}, "statement": "{applet}
\nA {qty(F,units[0])} force is applied semi circular object with a {qty(r, units[1])} radius, as shown.
\n", "advice": "Given: $r = \\var{qty(r,units[1])}, F = \\var{qty(F,units[0])}$
\n$d_\\perp = r \\var{latex(if(alpha < 0,\"-\",\"+\"))} r \\sin ( \\var{abs(alpha)}°) = \\var{qty(siground(dperp,4),units[1])}$
\n$M = F d_\\perp = (\\var{qty(F,units[0])})(\\var{qty(siground(dperp,4),units[1])}) = \\var{M}$
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"phi": {"name": "phi", "group": "Ungrouped variables", "definition": "random([0,180])", "description": "angle force makes with horizontal
", "templateType": "anything", "can_override": false}, "alpha": {"name": "alpha", "group": "Ungrouped variables", "definition": "random(-40..40#10 except 0)", "description": "angle diameter makes with horizontal
", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "Ungrouped variables", "definition": "random(['N','cm', 'N*cm'],['lb','in','in*lb'], ['N','mm', 'N*mm'])", "description": "", "templateType": "anything", "can_override": false}, "F": {"name": "F", "group": "Ungrouped variables", "definition": "random(10..100#5)", "description": "", "templateType": "anything", "can_override": false}, "r": {"name": "r", "group": "Ungrouped variables", "definition": "random(10..50#5)", "description": "", "templateType": "anything", "can_override": false}, "dperp": {"name": "dperp", "group": "solution", "definition": "r + r sin(radians(alpha))", "description": "", "templateType": "anything", "can_override": false}, "M": {"name": "M", "group": "solution", "definition": "siground(qty(F dperp ,units[2]),4)", "description": "", "templateType": "anything", "can_override": false}, "applet": {"name": "applet", "group": "ggb", "definition": "geogebra_applet('jwzzemtp',params)", "description": "", "templateType": "anything", "can_override": false}, "params": {"name": "params", "group": "ggb", "definition": "[\nphi: [definition: radians(phi),visible: false], \nalpha:[definition: radians(alpha), visible: false],\nshow: [definition: 'false', visible: 0]\n]", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["phi", "alpha", "units", "F", "r"], "variable_groups": [{"name": "solution", "variables": ["dperp", "M"]}, {"name": "ggb", "variables": ["applet", "params"]}], "functions": {"evalCommand": {"parameters": [["app", "ggbapplet"], ["cmd", "string"]], "type": "anything", "language": "javascript", "definition": "// Take an applet, evaluate a ggb command\napp.promise.then(function(d) {\n d.app.evalCommand(cmd);\n});\nreturn new Numbas.jme.types.ggbapplet(app);"}}, "preamble": {"js": "question.signals.on('adviceDisplayed',function() {\n try{\n var app = question.scope.variables.applet.app;\n \n app.setValue(\"show\", true, false);\n \n }\n catch(err){} \n})\n\n", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Determine the moment force $F$ makes about a point at the origin.
\n$M =$ [[0]] [[1]]
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "Magnitude", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "M", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "1_n_2", "useCustomName": true, "customName": "Direction", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["CCW", "CW"], "matrix": ["if(phi=180,5,0)", "if(phi=0,5,0)"], "distractors": ["", ""]}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Opposing moments using Verignon's theorem", "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%,Find the tension in a rope necessary to prevent a bracket from rotating by applying $\\Sigma M = 0$.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "An L shaped bracket is supported by a frictionless pin at $A$ and a cable between points $B$ and $D$.
\n{applet}
\nDetermine the tension in the cable required for equilibrium when a {F} force $\\mathbf{F}$ is applied to the bracket as shown.
", "advice": "Since the object is in equilibrium $\\Sigma M_A = 0$ implies that the opposing moments must have equal magnitudes. This is the principle we use to solve the problem. At the start we know the magnitude of $\\mathbf{F}$ and the geometry of the system.
\n1. Begin by drawing a sketch, defining your symbols and determining geometric values.
\nLet $\\alpha$ be the angle force $\\mathbf{F}$ makes with the horizontal and $\\beta$ be the angle the cable makes with the horizontal.
\n$\\alpha = \\var{abs(alpha)}°$, $\\beta = \\var{siground(if(abs(beta)>90, 180-abs(beta), abs(beta)),4)}°$
\nLet $d_x$ and $d_y$ represent the horizontal and vertical distances from $A$ to $B$.
\n$d_x = \\var{d_x}$, $d_y = \\var{d_y}$
\n2. Develop expressions for the moments about point $A$ caused by the force $\\mathbf{F}$ and the cable. The moment caused by the force can be found completely, but the moment caused by the cable tension can only be expressed as a function of the unknown tension $T$.
\n\n$M_F = F_y \\cdot d_x = F \\sin \\alpha \\cdot d_x $
\n$M_T = T_x \\cdot d_y \\pm T_y \\cdot d_x = (T \\cos \\beta) \\, d_y \\pm (T \\sin \\beta) \\, d_x = T (\\var{scalar(d_y)} \\cos \\beta \\pm \\var{scalar(d_x)} \\sin \\beta) $
\nWhen calculating the moment due to the cable $M_T$, if the two component moments act in the same direction, add the terms. If they twist in opposite directions, take their difference. Either way, make the final result positive, because we're comparing magnitudes.
\n3. After substituting the known values and simplifying, equate the moments to get:
\n$M_T = M_F$
\n$ T (\\var{format(d_perp_t)}) = \\var{format(M_F)} $
\n$T = \\dfrac{\\var{format(M_F)}}{\\var{format(d_perp_t)}}= \\var{format(T)} $
\n", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"d_x": {"name": "d_x", "group": "Outputs", "definition": "qty(abs(A[0]-B[0]),units[0])", "description": "", "templateType": "anything", "can_override": false}, "T_hat": {"name": "T_hat", "group": "Outputs", "definition": "vector(run,rise,0)/abs(vector(rise,run,0))", "description": "", "templateType": "anything", "can_override": false}, "B": {"name": "B", "group": "Inputs", "definition": "vector(random(1,-1) random(5..12),random(1,-1) random(4..10))", "description": "Position of point B
", "templateType": "anything", "can_override": false}, "F_y": {"name": "F_y", "group": "Outputs", "definition": "F sin(radians(alpha))", "description": "", "templateType": "anything", "can_override": false}, "A": {"name": "A", "group": "Inputs", "definition": "vector(0,0)", "description": "Position of point A
", "templateType": "anything", "can_override": false}, "d_perp_t": {"name": "d_perp_t", "group": "Outputs", "definition": "qty(abs(cross(T_hat,r_ad)[2]),units[0])", "description": "", "templateType": "anything", "can_override": false}, "T": {"name": "T", "group": "Ungrouped variables", "definition": "M_F/d_perp_t", "description": "", "templateType": "anything", "can_override": false}, "F": {"name": "F", "group": "Inputs", "definition": "qty(random(10..100#5),units[1])", "description": "Magnitude of force A
", "templateType": "anything", "can_override": false}, "F_hat": {"name": "F_hat", "group": "Outputs", "definition": "( vector(cos(radians(alpha)),sin(radians(alpha)),0))", "description": "force A as a vector
", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "Inputs", "definition": "random(['ft','lb'],['in','lb'],['cm','N'])", "description": "", "templateType": "anything", "can_override": false}, "beta": {"name": "beta", "group": "Outputs", "definition": "siground(degrees(atan2(rise,run)),6)", "description": "", "templateType": "anything", "can_override": false}, "run": {"name": "run", "group": "Outputs", "definition": "d[0]-b[0]", "description": "", "templateType": "anything", "can_override": false}, "d_y": {"name": "d_y", "group": "Outputs", "definition": "qty(abs(A[1]-B[1]),units[0])", "description": "", "templateType": "anything", "can_override": false}, "M_F": {"name": "M_F", "group": "Outputs", "definition": "siground(abs(F_y) d_AB,5)", "description": "", "templateType": "anything", "can_override": false}, "d_AB": {"name": "d_AB", "group": "Outputs", "definition": "qty(abs(B[0]),units[0])", "description": "", "templateType": "anything", "can_override": false}, "alpha": {"name": "alpha", "group": "Inputs", "definition": "random(-80..80#10 except 0)", "description": "direction of force A
", "templateType": "anything", "can_override": false}, "rise": {"name": "rise", "group": "Outputs", "definition": "d[1]-b[1]", "description": "", "templateType": "anything", "can_override": false}, "debug": {"name": "debug", "group": "Inputs", "definition": "false", "description": "", "templateType": "anything", "can_override": false}, "r_ad": {"name": "r_ad", "group": "Outputs", "definition": "D-A + vector(0,0,0)", "description": "", "templateType": "anything", "can_override": false}, "D": {"name": "D", "group": "Inputs", "definition": "B + vector(random(1,-1)random(2..5),random(1,-1)random(2..5))", "description": "Position of point C
", "templateType": "anything", "can_override": false}, "applet": {"name": "applet", "group": "Ungrouped variables", "definition": "geogebra_applet('phznbxbe', params)", "description": "", "templateType": "anything", "can_override": false}, "params": {"name": "params", "group": "Ungrouped variables", "definition": "[A: A, B: B, D: D, \n'\u03b1': radians(alpha), \nunit: '\"{units[0]}\"'\n]", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "B[0]<>D[0] and B[1]<>D[1] and \nA[0]<>D[0] and A[1]<>D[1] and \nabs(rise) <> abs(run)", "maxRuns": 100}, "ungrouped_variables": ["T", "applet", "params"], "variable_groups": [{"name": "Inputs", "variables": ["A", "B", "D", "alpha", "F", "units", "debug"]}, {"name": "Outputs", "variables": ["F_hat", "F_y", "d_AB", "M_F", "beta", "rise", "run", "T_hat", "r_ad", "d_perp_t", "d_x", "d_y"]}], "functions": {"format": {"parameters": [["q", "quantity"]], "type": "quantity", "language": "jme", "definition": "string(siground(q,4))"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Find Moment", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Determine the magnitude of the moment that the force $\\mathbf{F}$ produces about point $A$.
\n$M_F =$ [[0]] {M_F}
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "M_F", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "M_F", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "Find Tension", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Determine the tension required to hold the bracket in position.
\n$T$ = [[0]] {format(T)}
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "T", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "T", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Moment Balance", "extensions": ["geogebra", "quantities"], "custom_part_types": [{"source": {"pk": 12, "author": {"name": "William Haynes", "pk": 2530}, "edit_page": "/part_type/12/edit"}, "name": "Angle quantity 2020", "short_name": "angle", "description": "Adjusts all angles to 0 < $\\theta$ < 360.
\nAccepts '°' and 'deg' as units.
\nPenalizes if not close enough or no units.
\n90° = -270° = 450°
", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "plain_string(settings['expected_answer']) ", "hint": {"static": true, "value": ""}, "allowEmpty": {"static": true, "value": false}}, "can_be_gap": true, "can_be_step": true, "marking_script": "original_student_scalar:\nmatchnumber(studentAnswer,['plain','en'])[1]\n\nstudent_scalar:\nmod(original_student_scalar,360)\n\n\nstudent_unit:\nstudentAnswer[len(matchnumber(studentAnswer,['plain','en'])[0])..len(studentAnswer)]\n\ninterpreted_unit:\nif(trim(student_unit)='\u00b0','deg',student_unit)\n\ninterpreted_answer:\nqty(mod(student_scalar,360),'deg')\n\nclose:\nwithintolerance(student_scalar, correct_scalar,decimal(settings['close_tol']))\n\ncorrect_scalar:\nmod(scalar(settings['expected_answer']),360)\n\nright:\nwithintolerance(student_scalar, correct_scalar, decimal(settings['right_tol']))\n\ngood_unit:\nsame(qty(1,interpreted_unit),qty(1,'deg'))\n\nmark:\nassert(close,incorrect('Incorrect.');end());\nif(right,correct('Correct angle.'), set_credit(1 - settings['close_penalty'],'Angle is close.'));\nassert(good_unit,sub_credit(settings['unit_penalty'], 'Missing or incorrect units.'))", "marking_notes": [{"name": "original_student_scalar", "description": "Retuns the scalar part of students answer (which is a quantity) as a number.
", "definition": "matchnumber(studentAnswer,['plain','en'])[1]"}, {"name": "student_scalar", "description": "Normalize angle with mod 360
", "definition": "mod(original_student_scalar,360)\n"}, {"name": "student_unit", "description": "matchnumber(studentAnswer,['plain','en'])[0] is a string \"12.34\"
", "definition": "studentAnswer[len(matchnumber(studentAnswer,['plain','en'])[0])..len(studentAnswer)]"}, {"name": "interpreted_unit", "description": "Allows student to use degree symbol or 'deg' for units.
", "definition": "if(trim(student_unit)='\u00b0','deg',student_unit)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "qty(mod(student_scalar,360),'deg')"}, {"name": "close", "description": "", "definition": "withintolerance(student_scalar, correct_scalar,decimal(settings['close_tol']))"}, {"name": "correct_scalar", "description": "Normalize expected_answer with mod 360
", "definition": "mod(scalar(settings['expected_answer']),360)"}, {"name": "right", "description": "", "definition": "withintolerance(student_scalar, correct_scalar, decimal(settings['right_tol']))"}, {"name": "good_unit", "description": "", "definition": "same(qty(1,interpreted_unit),qty(1,'deg'))"}, {"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "assert(close,incorrect('Incorrect.');end());\nif(right,correct('Correct angle.'), set_credit(1 - settings['close_penalty'],'Angle is close.'));\nassert(good_unit,sub_credit(settings['unit_penalty'], 'Missing or incorrect units.'))"}], "settings": [{"name": "expected_answer", "label": "Expected Answer", "help_url": "", "hint": "Expected angle as a quantity.", "input_type": "code", "default_value": "qty(30,'deg')", "evaluate": true}, {"name": "unit_penalty", "label": "Unit penalty", "help_url": "", "hint": "Penalty for not including degree sign or 'deg'.", "input_type": "percent", "default_value": "20"}, {"name": "close_penalty", "label": "Close Penalty", "help_url": "", "hint": "Penalty for close answer.", "input_type": "percent", "default_value": "20"}, {"name": "close_tol", "label": "Close", "help_url": "", "hint": "Angle must be $\\pm$ this many degrees to be marked close. ", "input_type": "code", "default_value": "0.5", "evaluate": false}, {"name": "right_tol", "label": "Right ", "help_url": "", "hint": "Angle must be $\\pm$ this many degrees to be marked correct. ", "input_type": "code", "default_value": "0.1", "evaluate": false}], "public_availability": "restricted", "published": false, "extensions": ["quantities"]}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "William Haynes", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2530/"}], "tags": ["eqilibrium", "Mechanics", "mechanics", "Moments", "moments", "Statics", "statics"], "metadata": {"description": "Two known forces, and a third with known magnitude act on a rigid body. Apply $\\Sigma M = 0$ about a pin restraint to determine the direction of the third force. The problem has two valid answers.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "{applet}
\nThree forces, $A = \\var{A F_units}$, $C = \\var{C F_units}$ and $D = \\var{F F_units}$, act on the rigid, bent bar which can pivot freely on a pin at $B$.
\nThe segment lengths are: $AB = \\var{ab D_units}$, $BC = \\var{bc D_units}$, and $CD= \\var{cd D_units}$.
", "advice": "From the geometry of triangle $BCD$:
\n$\\phi = \\tan^{-1}\\left( \\dfrac{BC}{CD}\\right) =\\var{precround(phi,1)}°$
$d = \\sqrt{BC^2 +CD^2} = \\var{siground(abs(r_d),4) D_units}$
From a moment balance around point $B$, the clockwise moment equals the counterclockwise moments:
\n$\\begin{align}
M_D &= M_A + M_C \\\\
&= (\\var{AB})\\ A_y + (\\var{BC})\\ C_x\\\\
&= \\simplify[!collectNumbers]{({siground(M_A[2],4)} +{siground(M_C[2],4)})}\\\\
&= \\var{siground(-M D_units F_units,4)} \\text{ clockwise}
\\end{align}$
With the required moment $M_D$ and the magnitude of force $D$ known, the perpendicular distance and the angle between segment $BD$ and force $D$ are:
\n$d_\\perp = M_D / D = \\dfrac{ \\var{siground(-M D_units F_units,4)}}{\\var{F F_units}} = \\var{siground(dperp,4) D_units}$
$\\alpha =\\sin^{-1}\\left( \\dfrac{d_\\perp}{d}\\right)=\\var{precround(alpha1,1)}°$
Since $\\sin \\alpha = \\sin (180°-\\alpha)$ another possible angle is:
\n$\\alpha' = (180° - \\var{precround(alpha1,1)}) = \\var{precround(alpha2,1)}°$
\nFinally the angle from the positive $x$ axis to force $D$ can be determined. There are two possible solutions:
\n$\\theta =180° - \\alpha - \\phi = \\var{precround(-theta1,1)}° $ or
$\\theta = 180 - \\alpha' - \\phi = \\var{precround(-theta2,1)}$
Note: You can use the red slider on the diagram to switch between the two possible solutions.
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"applet": {"name": "applet", "group": "inputs", "definition": "geogebra_applet('qavc8kmn',params)", "description": "", "templateType": "anything", "can_override": false}, "params": {"name": "params", "group": "inputs", "definition": "[ ab: ab, bc: bc, cd: cd, \n theta_A: radians(theta_A), theta_C: radians(theta_C), theta: radians(-40),\n fbd: [visible: false, definition: \"false\"],\n soln: [visible: false]\n ]", "description": "Paramiters for applet
", "templateType": "anything", "can_override": false}, "ab": {"name": "ab", "group": "inputs", "definition": "random(1..3#0.25)", "description": "Length of segment AB
", "templateType": "anything", "can_override": false}, "bc": {"name": "bc", "group": "inputs", "definition": "random(1..2#0.25)", "description": "Length of segment BC
", "templateType": "anything", "can_override": false}, "cd": {"name": "cd", "group": "inputs", "definition": "random(1..3#0.25)", "description": "Length of segment CD
", "templateType": "anything", "can_override": false}, "D_units": {"name": "D_units", "group": "inputs", "definition": "qty('ft')", "description": "", "templateType": "anything", "can_override": false}, "theta_C": {"name": "theta_C", "group": "inputs", "definition": "random(110..250#10 except 180)", "description": "Angle of force C, chosen to make a CCW moment
", "templateType": "anything", "can_override": false}, "theta_A": {"name": "theta_A", "group": "inputs", "definition": "random(195..345#15)", "description": "Angle of force A, chosen to make a CCW moment
", "templateType": "anything", "can_override": false}, "A": {"name": "A", "group": "inputs", "definition": "random(25..250#25)", "description": "Magnitude of force A
", "templateType": "anything", "can_override": false}, "C": {"name": "C", "group": "inputs", "definition": "random(25..200#25)", "description": "magnitude of force C
", "templateType": "anything", "can_override": false}, "r_a": {"name": "r_a", "group": "solution", "definition": "vector(-ab,0,0)", "description": "positon vector
", "templateType": "anything", "can_override": false}, "r_c": {"name": "r_c", "group": "solution", "definition": "vector(0,bc,0)", "description": "position vector
", "templateType": "anything", "can_override": false}, "r_d": {"name": "r_d", "group": "solution", "definition": "vector(cd,bc,0)", "description": "position vector
", "templateType": "anything", "can_override": false}, "f_a": {"name": "f_a", "group": "solution", "definition": "A vector(cos(radians(theta_a)),sin(radians(theta_a)),0)", "description": "force vector
", "templateType": "anything", "can_override": false}, "f_c": {"name": "f_c", "group": "solution", "definition": "C vector(cos(radians(theta_C)),sin(radians(theta_c)),0)", "description": "force vector
", "templateType": "anything", "can_override": false}, "M_A": {"name": "M_A", "group": "solution", "definition": "cross(r_a,f_a)", "description": "Moment vector
", "templateType": "anything", "can_override": false}, "M_C": {"name": "M_C", "group": "solution", "definition": "cross(r_C, f_C)", "description": "Moment vector
", "templateType": "anything", "can_override": false}, "M_D": {"name": "M_D", "group": "solution", "definition": "-(M_A+M_C)", "description": "Moment vector needed for equilibrium
", "templateType": "anything", "can_override": false}, "F": {"name": "F", "group": "inputs", "definition": "random(25..200#20)", "description": "Magnitude of force D
", "templateType": "anything", "can_override": false}, "F_min": {"name": "F_min", "group": "method 1", "definition": "cross(M_D,r_d)/(abs(r_d)^2)", "description": "Solve for force F, which is the minimum force required, i.e. the force perpendicuar to the moment arm.
", "templateType": "anything", "can_override": false}, "f_perp": {"name": "f_perp", "group": "method 1", "definition": "abs(F_min)", "description": "Minimum magnitude of F, also the perpendicular component of force D
", "templateType": "anything", "can_override": false}, "alpha1": {"name": "alpha1", "group": "method 1", "definition": " degrees(abs(arcsin(f_perp/F)))", "description": "", "templateType": "anything", "can_override": false}, "phi": {"name": "phi", "group": "method 1", "definition": "degrees(arctan(r_d[1]/r_d[0]))", "description": "", "templateType": "anything", "can_override": false}, "dperp": {"name": "dperp", "group": "method 1", "definition": "abs(M/F)", "description": "perpendicular distance
", "templateType": "anything", "can_override": false}, "M": {"name": "M", "group": "solution", "definition": "M_D[2]", "description": "scalar component of M_D
", "templateType": "anything", "can_override": false}, "theta1": {"name": "theta1", "group": "method 1", "definition": "-(180-phi-alpha1)", "description": "", "templateType": "anything", "can_override": false}, "f_units": {"name": "f_units", "group": "inputs", "definition": "qty(\"lb\")", "description": "", "templateType": "anything", "can_override": false}, "alpha2": {"name": "alpha2", "group": "method 1", "definition": "180-alpha1", "description": "", "templateType": "anything", "can_override": false}, "theta2": {"name": "theta2", "group": "method 1", "definition": "-(180-phi-alpha2)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "0.3 < sin(radians(alpha1)) < 0.95 and alpha1 < 180 - phi -20// for diagram to show alpha in the triangle\nand dperp < abs(r_d)", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [{"name": "solution", "variables": ["r_a", "r_c", "r_d", "f_a", "f_c", "M_A", "M_C", "M_D", "M"]}, {"name": "method 1", "variables": ["F_min", "f_perp", "dperp", "alpha1", "alpha2", "phi", "theta1", "theta2"]}, {"name": "inputs", "variables": ["applet", "params", "ab", "bc", "cd", "theta_A", "theta_C", "f_units", "D_units", "A", "C", "F"]}], "functions": {"hide_items": {"parameters": [["app", "ggbapplet"]], "type": "anything", "language": "javascript", "definition": "// See https://wiki.geogebra.org/en/Scripting_Commands and\n// https://wiki.geogebra.org/en/Reference:GeoGebra_Apps_API\nreturn;\napp.promise.then(function(d) {\n d.app.setVisible('LOA', false);\n d.app.setVisible('ref', false);\n d.app.setVisible('t1', false);\n d.app.setVisible('alpha', false);\n d.app.setVisible('phi', false);\n});\nreturn new Numbas.jme.types.ggbapplet(app);\n"}}, "preamble": {"js": "question.signals.on('adviceDisplayed',function() {\n \n try{\n //var app = question.applet.app;\n var app = Numbas.exam.currentQuestion.scope.variables.applet.app;\n var theta = - Numbas.exam.currentQuestion.scope.variables.theta1.value;\n console.log(theta);\n app.setVisible(\"fbd\",true);\n app.setValue(\"fbd\",true);\n app.setVisible(\"soln\",true);\n app.setValue(\"soln\",1);\n app.setValue(\"theta\", -theta * 3.14 /180 );\n app.setLabelVisible(\"A\",false);\n app.setLabelVisible(\"B\",false);\n app.setLabelVisible(\"C\",false);\n app.setLabelVisible(\"D\",false);\n }\n catch(err){} \n})\n", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Find an angle $\\theta$ that will make the sum of the moments about point $B=0$.
\n$\\theta = $ [[0]] (Measure $\\theta$ CW from the positive $x$ axis.)
", "gaps": [{"type": "angle", "useCustomName": true, "customName": "$\\theta$", "marks": "20", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "alternatives": [{"type": "angle", "useCustomName": true, "customName": "$\\theta'$", "marks": "20", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "alternativeFeedbackMessage": "", "useAlternativeFeedback": false, "settings": {"expected_answer": "precround(qty(-theta2,'deg'),2)", "unit_penalty": "20", "close_penalty": "20", "close_tol": "0.5", "right_tol": "0.1"}}], "settings": {"expected_answer": "precround(qty(-theta1,'deg'),2)", "unit_penalty": "20", "close_penalty": "20", "close_tol": "0.5", "right_tol": "0.1"}}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}]}, {"name": "Couples", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": ["", "Resultant couple", ""], "variable_overrides": [[], [], []], "questions": [{"name": "Moment of a couple", "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%,Find the moment of a couple formed by two equal and opposite forces.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "{applet}
\n{setAxisVisible(applet,false)}
\nDetermine the moment of the couple formed by the two {F} {units[1]} forces shown. Grid units are in [{units[0]}].
", "advice": "The moment of a couple is found by multiplying the magnitude of force by the perpendicular distance between the lines of action of the two forces. The direction is determined by inspection. You will need to determine the perpendicular distance using the known locations of the two points, the direction of the force, geometry and trigonometry as we have done before.
\n$ M = F \\cdot d_\\perp$
\n$ M = (\\var{F}\\, \\var{units[1]} ) (\\var{abs(siground(moment/F,4))}\\, \\var{units[0]} ) = \\var{siground(abs(answer),4)}$ {if(moment >0,'Counterclockwise','Clockwise')}
\nAlternately, you get the same result by finding the moment of one force about a point on the line of action of the other one.
\nSo, for example, take the moment of the force at $A$ about point $B$ using Verignon's Theorem. The signs in the equation below are determined by the direction of the component moments, using the sign convention that counterclockwise moments are positive. The sign of the resulting moment indicates its direction and it should agree with your expectations from inspection of the diagram.
\n$ M = \\pm F_x d_y \\pm F_y d_x $
\n$ M = \\pm\\, ( \\var{d(Force[0] )} \\, \\var{units[1]} ) ( \\var{d(r[1])} \\, \\var{units[0]} ) \\pm\\, ( \\var{d(Force[1] )} \\, \\var{units[1]} ) ( \\var{d(r[0])} \\, \\var{units[0]} )$
\n$M = \\var{siground(answer,4)}$
\n$M = \\var{siground(abs(answer),4)} $ {if(moment >0,'Counterclockwise','Clockwise')}
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"F": {"name": "F", "group": "inputs", "definition": "random(10..400#10)", "description": "", "templateType": "anything", "can_override": false}, "A": {"name": "A", "group": "inputs", "definition": "vector(random(-8..8),random(-6..6))", "description": "", "templateType": "anything", "can_override": false}, "theta": {"name": "theta", "group": "inputs", "definition": "random(5..355#5 except [90,-90,180])", "description": "", "templateType": "anything", "can_override": false}, "r": {"name": "r", "group": "results", "definition": "A-B + vector(0,0,0)", "description": "position vector
", "templateType": "anything", "can_override": false}, "B": {"name": "B", "group": "inputs", "definition": "vector(random(-8..8),random(-6..6))", "description": "", "templateType": "anything", "can_override": false}, "Force": {"name": "Force", "group": "results", "definition": "vector(f cos(radians(theta)),f sin(radians(theta)),0)", "description": "Force vector
", "templateType": "anything", "can_override": false}, "answer": {"name": "answer", "group": "results", "definition": "d(moment) qty(units[1])qty(units[0])", "description": "rounded value of moment as quantity
", "templateType": "anything", "can_override": false}, "moment": {"name": "moment", "group": "results", "definition": "cross(r,force)[2]", "description": "Magnitude of moment
", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "inputs", "definition": "random(['in','lb'],['m','kN'],['cm','N'])", "description": "", "templateType": "anything", "can_override": false}, "params": {"name": "params", "group": "Ungrouped variables", "definition": "[ A: A, B: B, '\u03b8': radians(theta), show: [definition: 'false', visible: false]]", "description": "", "templateType": "anything", "can_override": false}, "applet": {"name": "applet", "group": "Ungrouped variables", "definition": "geogebra_applet('whx4ybuq', params )", "description": "", "templateType": "anything", "can_override": false}, "dperp": {"name": "dperp", "group": "results", "definition": "abs(moment)/F", "description": "perpendicular distance
", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "abs(r) > 2 // nice size\nand dperp/abs(r) < 0.96 // cos angle makes angle > 15\u00b0\nand dperp/abs(r) > 0.18 // cos angle makes angle < 80\u00b0\nand A[0] <> B[0] and A[1] <> B[1] // not on same vertical or horizontal axis", "maxRuns": 100}, "ungrouped_variables": ["params", "applet"], "variable_groups": [{"name": "inputs", "variables": ["A", "B", "theta", "units", "F"]}, {"name": "results", "variables": ["r", "Force", "moment", "answer", "dperp"]}], "functions": {"d": {"parameters": [["v", "number"]], "type": "number", "language": "jme", "definition": "siground(abs(v),4)"}, "setAxisVisible": {"parameters": [["app", "ggbapplet"], ["visible", "boolean"]], "type": "anything", "language": "javascript", "definition": "app.promise.then(function(d) {\n d.app.setAxesVisible(visible,visible);});\nreturn new Numbas.jme.types.ggbapplet(app);\n\n"}}, "preamble": {"js": "question.signals.on('adviceDisplayed',function() {\n try{\n var app = question.scope.variables.applet.app; \n app.setVisible(\"show\", true,false);\n app.setValue(\"show\", 1);\n }\n catch(err){} \n})", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "$M$ = [[0]] [[1]]
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "mag", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "abs(answer)", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "1_n_2", "useCustomName": true, "customName": "dir", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": true, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["Clockwise", "Counterclockwise"], "matrix": "[if(moment<0,5,0),if(moment>0,5,0)]"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Moment of a couple: resultant couple", "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%,Find the sum of two couples in a plane.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "{applet}
\nTwo couples act on a rectangle with a base of $\\var{B}$ and a height of $\\var{H}$.
\nDetermine the magnitude and direction of the resultant moment, knowing that $F = \\var{F}$ and $G = \\var{G}$.
", "advice": "\nLet h be the height of the rectangle and $d_\\perp$ be the perpendicular distance between the lines of action of F and F'.
\nUse the geometry of the problem to determine $d_\\perp = \\var{display(abs(dperp))}$
\n$M_F = F \\cdot d_\\perp = (\\var{f}) (\\var{display(abs(dperp))}) = \\var{display(abs(M_f))}$ {if(sign(M_F)=1,'Counterclockwise','Clockwise')}
\n$M_G = G \\cdot h =$ ({g}) ({h}) = {display(abs(M_g))} Clockwise
\n$M_T = \\Sigma M = M_F + M_G = (\\var{display(M_F)}) + (\\var{display(M_G)}) = \\var{display(M_t)}$
\n$M_T = \\var{display(abs(M_T))}$ {if(sign(M_T)=1,'Counterclockwise','Clockwise')}
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"height": {"name": "height", "group": "Ungrouped variables", "definition": "random(2..10)", "description": "", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "Ungrouped variables", "definition": "random(['N','m'],['lb','ft'],['lb','in'])", "description": "", "templateType": "anything", "can_override": false}, "G": {"name": "G", "group": "Ungrouped variables", "definition": "qty(random(20..100#5),units[0])", "description": "", "templateType": "anything", "can_override": false}, "base": {"name": "base", "group": "Ungrouped variables", "definition": "random(2..10)", "description": "", "templateType": "anything", "can_override": false}, "M_t": {"name": "M_t", "group": "Ungrouped variables", "definition": "M_f + M_g", "description": "", "templateType": "anything", "can_override": false}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "qty(base,units[1])\n", "description": "", "templateType": "anything", "can_override": false}, "alpha": {"name": "alpha", "group": "Ungrouped variables", "definition": "random(10..260#10 except[90,180])", "description": "", "templateType": "anything", "can_override": false}, "M_f": {"name": "M_f", "group": "Ungrouped variables", "definition": "f dperp", "description": "", "templateType": "anything", "can_override": false}, "F": {"name": "F", "group": "Ungrouped variables", "definition": "qty(random(20..100#5),units[0])", "description": "", "templateType": "anything", "can_override": false}, "M_g": {"name": "M_g", "group": "Ungrouped variables", "definition": "-g h", "description": "", "templateType": "anything", "can_override": false}, "dperp": {"name": "dperp", "group": "Ungrouped variables", "definition": "b sin(radians(alpha)) + h cos(radians(alpha))", "description": "", "templateType": "anything", "can_override": false}, "h": {"name": "h", "group": "Ungrouped variables", "definition": "qty(height,units[1])", "description": "", "templateType": "anything", "can_override": false}, "applet": {"name": "applet", "group": "Ungrouped variables", "definition": "geogebra_applet('qfszc468',params)", "description": "", "templateType": "anything", "can_override": false}, "params": {"name": "params", "group": "Ungrouped variables", "definition": "[B: vector(base,height), '\u03b1': radians(alpha)]", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["base", "height", "alpha", "units", "G", "b", "h", "F", "dperp", "M_f", "M_g", "M_t", "applet", "params"], "variable_groups": [], "functions": {"display": {"parameters": [["q", "quantity"]], "type": "quantity", "language": "jme", "definition": "string(siground(q,4))"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "The resultant moment has a magnitude of [[0]] in the [[1]] direction. {M_t}
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "mag", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "abs(M_t)", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "1_n_2", "useCustomName": true, "customName": "dir", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["clockwise", "counterclockwise", "Neither"], "matrix": "[if(scalar(M_t)<0,5,0),if(scalar(M_t)>0,5,0),if(scalar(M_t)=0,5,0)]"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Couples in equilibrium", "extensions": ["geogebra", "quantities"], "custom_part_types": [{"source": {"pk": 24, "author": {"name": "William Haynes", "pk": 2530}, "edit_page": "/part_type/24/edit"}, "name": "Angle quantity", "short_name": "angle-quantity-from-reference", "description": "Angle as a quantity in degrees.
", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "plain_string(settings['correct_quantity'])", "hint": {"static": true, "value": ""}, "allowEmpty": {"static": true, "value": false}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nswitch( \nright and good_units and right_sign and angle_in_range, add_credit(1.0,'Correct.'),\nright and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\nright and right_sign and not good_units, add_credit(settings['C2'],'Correct angle, but missing degree symbol.'),\nright and good_units and right_sign and not angle_in_range,add_credit(settings['C1'],'Angle is out of range.'),\nclose and good_units, add_credit(settings['C1'],'Close.'),\nclose and not good_units, add_credit(settings['C3'],'Answer is close, but missing degree symbol.'),\nincorrect('Wrong answer.')\n)\n\ninterpreted_answer:\nqty(student_scalar, student_units)\n\ncorrect_scalar:\nscalar(correct_quantity)\n \n\ncorrect_quantity:\nsettings['correct_quantity']\n\ncorrect_units:\nunits(correct_quantity)\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:\njoin(\nsplit(studentAnswer[len(match_student_number[0])..len(studentAnswer)]\n,\"\u00b0\"),\" deg\")\n\n\n\ngood_units:\ntry(\nkind(quantity(1, student_units))= kind(correct_quantity),\nmsg,\nfeedback(msg);false)\n\nstudent_quantity:\nswitch(not good_units, \nstudent_scalar * correct_units, \nnot right_sign,\n-quantity(student_scalar, student_units),\nquantity(student_scalar,student_units)\n)\n\nright_sign:\nsign(student_scalar) = sign(correct_quantity)\n\nangle_in_range:\nif(settings['restrict_angle'], abs(student_scalar) <= 90, true)\n\nright:\nwithinTolerance(abs(student_scalar), abs(correct_scalar), settings['right'])\n\nclose:\nwithinTolerance(student_scalar, correct_scalar, settings['close'])", "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( \nright and good_units and right_sign and angle_in_range, add_credit(1.0,'Correct.'),\nright and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\nright and right_sign and not good_units, add_credit(settings['C2'],'Correct angle, but missing degree symbol.'),\nright and good_units and right_sign and not angle_in_range,add_credit(settings['C1'],'Angle is out of range.'),\nclose and good_units, add_credit(settings['C1'],'Close.'),\nclose and not good_units, add_credit(settings['C3'],'Answer is close, but missing degree symbol.'),\nincorrect('Wrong answer.')\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "qty(student_scalar, student_units)"}, {"name": "correct_scalar", "description": "", "definition": "scalar(correct_quantity)\n "}, {"name": "correct_quantity", "description": "", "definition": "settings['correct_quantity']"}, {"name": "correct_units", "description": "", "definition": "units(correct_quantity)"}, {"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": "", "definition": "join(\nsplit(studentAnswer[len(match_student_number[0])..len(studentAnswer)]\n,\"\u00b0\"),\" deg\")\n\n"}, {"name": "good_units", "description": "", "definition": "try(\nkind(quantity(1, student_units))= kind(correct_quantity),\nmsg,\nfeedback(msg);false)"}, {"name": "student_quantity", "description": "", "definition": "switch(not good_units, \nstudent_scalar * correct_units, \nnot right_sign,\n-quantity(student_scalar, student_units),\nquantity(student_scalar,student_units)\n)"}, {"name": "right_sign", "description": "", "definition": "sign(student_scalar) = sign(correct_quantity)"}, {"name": "angle_in_range", "description": "", "definition": "if(settings['restrict_angle'], abs(student_scalar) <= 90, true)"}, {"name": "right", "description": "Will check for correct sign elswhere.
", "definition": "withinTolerance(abs(student_scalar), abs(correct_scalar), settings['right'])"}, {"name": "close", "description": "Must have correct sign to be close.
", "definition": "withinTolerance(student_scalar, correct_scalar, settings['close'])\n"}], "settings": [{"name": "correct_quantity", "label": "Correct Angle as quantity ", "help_url": "", "hint": "", "input_type": "code", "default_value": "qty(45,'deg')", "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 amount from the correct value.", "input_type": "code", "default_value": "0.1", "evaluate": true}, {"name": "restrict_angle", "label": "Less than 90\u00b0", "help_url": "", "hint": "When checked, angle must be between -90° and +90°.", "input_type": "checkbox", "default_value": true}, {"name": "C1", "label": "Close with units.", "help_url": "", "hint": "Partial Credit for close value with appropriate units.", "input_type": "percent", "default_value": "75"}, {"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 amount from the correct value.", "input_type": "code", "default_value": "0.5", "evaluate": true}, {"name": "C2", "label": "No units or wrong sign", "help_url": "", "hint": "Partial credit for forgetting units or using wrong sign.", "input_type": "percent", "default_value": "50"}, {"name": "C3", "label": "Close, no units.", "help_url": "", "hint": "Partial Credit for close value without units.", "input_type": "percent", "default_value": "25"}], "public_availability": "restricted", "published": false, "extensions": ["quantities"]}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "William Haynes", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2530/"}], "tags": ["Couples", "couples", "Equilibrium", "equilibrium", "Mechanics", "mechanics", "Statics", "statics", "weierstrass"], "metadata": {"description": "Solve for an angle which will result in equilibrium for a triangle subjected to three couples. A trial and error solution is recommended.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "{applet}
\nDetermine angle $\\alpha$ knowing that the triangular plate is in equilbrium when subjected to the three couples shown.
\n", "advice": "The triangular plate is in equlibrium, so the three couple moments add to zero. Note that the length of side $d$ the triangle is not significant, only the angle $\\alpha$.
\n\\[\\begin{align} \\Sigma M &=0\\\\M_1 + M_2 + M_3 &= 0\\\\ \\require{cancel} (\\var{F_1} \\cancel{d} \\cos \\alpha) + (\\var {F_2} \\cancel{d} \\sin \\alpha) + (\\var{show(F_3)}\\cancel{d} )&= 0\\\\ \\simplify[all,!collectNumbers]{{F_1} cos(alpha)+ {F_2} sin(alpha)} &= \\simplify{ - {show(F_3)}} \\\\ \\alpha &= \\var{alpha}°\\end{align}\\]
\nThis equation has only one unknown, and it can be solved algebraically for $\\alpha$, although it is not simple. For the method, see this example.
\nAn easier way is simply to plot the equation: $y = \\simplify[all,!collectNumbers]{{F_1} cos(alpha)+ {F_2} sin(alpha) + {show(F_3)}} $; the first positive root is the answer. A guess-and-check solution may also be used.
\n{advice}
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"F_1": {"name": "F_1", "group": "Inputs", "definition": "random(-500..500#50 except 0)", "description": "", "templateType": "anything", "can_override": false}, "F_3": {"name": "F_3", "group": "results", "definition": "-(F_1 cos(radians(alpha)) + F_2 sin(radians(alpha)))", "description": "", "templateType": "anything", "can_override": false}, "alpha": {"name": "alpha", "group": "Inputs", "definition": "random(25..75)", "description": "", "templateType": "anything", "can_override": false}, "F_2": {"name": "F_2", "group": "Inputs", "definition": "random(-500..500#50 except 0)", "description": "", "templateType": "anything", "can_override": false}, "x_max": {"name": "x_max", "group": "results", "definition": "degrees(arctan(F_2/F_1))", "description": "this is the angle of the maximum point on the sine wave
", "templateType": "anything", "can_override": false}, "roots": {"name": "roots", "group": "results", "definition": "[x_max+abs(x_max - alpha),x_max - abs(x_max - alpha)]", "description": "roots are symmetrically to the left and right of the maximum. Variable testing eliminates cases where there are two roots < 90°
", "templateType": "anything", "can_override": false}, "applet": {"name": "applet", "group": "ggb", "definition": "geogebra_applet('vyuvgyf7',params)", "description": "{geogebra_applet('vyuvgyf7', [['α' , radians(alpha)], ['F_1', F_1], ['F_2', F_2] ] )}
", "templateType": "anything", "can_override": false}, "params": {"name": "params", "group": "ggb", "definition": "['\u03b1':radians(alpha),\nF_1: F_1,\nF_2: F_2 ]", "description": "", "templateType": "anything", "can_override": false}, "advice": {"name": "advice", "group": "ggb", "definition": "geogebra_applet('y3s8cnxe',advice_params)", "description": "{geogebra_applet('y3s8cnxe',[ ['F_1', F_1], ['F_2', F_2],['F_3', F_3] ])}
", "templateType": "anything", "can_override": false}, "advice_params": {"name": "advice_params", "group": "ggb", "definition": "[F_1: F_1, F_2: F_2, F_3: F_3]", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "not (abs(roots[0]) < 90 and abs(roots[1]) < 90)", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [{"name": "Inputs", "variables": ["alpha", "F_1", "F_2"]}, {"name": "results", "variables": ["F_3", "x_max", "roots"]}, {"name": "ggb", "variables": ["applet", "params", "advice", "advice_params"]}], "functions": {"show": {"parameters": [["f", "number"]], "type": "number", "language": "jme", "definition": "siground(f,4)"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "$\\alpha $ = [[0]]
\n\n
Note: the angle is an integer between 0° and 90°.
", "gaps": [{"type": "angle-quantity-from-reference", "useCustomName": true, "customName": "alpha", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correct_quantity": "qty(alpha,'deg')", "right": "0.2", "restrict_angle": true, "C1": "75", "close": "1.0", "C2": "50", "C3": "25"}}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}]}, {"name": "Equivalent Systems", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": ["Two parallel forces", "Equivalent force-couple system: Circle", "Equivalent Force-couple system: Bracket", ""], "variable_overrides": [[], [], [], []], "questions": [{"name": "Equivalent System: two parallel forces", "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%,Replace two parallel forces with an equivalent single force
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "{applet}
\nA {L} {units[0]} long cantilever beam is loaded with vertical forces $A = \\var{force(A)}$ and $B = \\var{force(B)},$ separated by a distance $d$ = {d L} {units[0]}, as shown.
\nReplace the two forces with a single equivalent force $R$ and determine the distance $\\bar{x}$ from the left end of the beam to the line of action of $R$.
\n", "advice": "Known:
\n$A = \\var{force(A)}, B = \\var{force(B)}, \\ell = \\var{dist(L)}, d = \\var{dist(d L)} $
\nSince both forces are vertical, the resultant force with also be vertical, with a magnitude
\n$\\begin{align} R &= A + B \\\\&= \\var{A} + \\var{B}\\\\ &= \\var{force(R)}\\end{align}$
\nThe equivalent force $R$ must produce the same moment about any point as the orignal system of forces did. Chosing the left end of the beam as the moment center, and equating moments, gives:
\n$\\begin{align} M_2 &= M_1\\\\ R\\, \\bar{x} &= A \\,(\\ell - d) + B\\ell\\\\ \\bar{x} & = \\dfrac{\\var{force(A)}\\cdot \\var{dist(L- d L)} +\\var{force(B)}\\,\\cdot \\var{dist(L)}} {\\var{force(R)}} \\\\ &= \\var{dist(xbar)} \\end{align}$
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"xbar": {"name": "xbar", "group": "Unnamed group", "definition": "(A *(L - d L) + B L)/R", "description": "", "templateType": "anything", "can_override": false}, "A": {"name": "A", "group": "Ungrouped variables", "definition": "random(10..100#5)", "description": "", "templateType": "anything", "can_override": false}, "ratio": {"name": "ratio", "group": "Ungrouped variables", "definition": "random(0.5..2#0.1)\n", "description": "ratio of magnitude of force B to magnitude of force A
", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "Ungrouped variables", "definition": "['m', 'kN']", "description": "", "templateType": "anything", "can_override": false}, "d": {"name": "d", "group": "Ungrouped variables", "definition": "random(0.3..0.8#0.05)", "description": "ratio of distance between A and B to length.
", "templateType": "anything", "can_override": false}, "R": {"name": "R", "group": "Unnamed group", "definition": "A + B", "description": "", "templateType": "anything", "can_override": false}, "L": {"name": "L", "group": "Ungrouped variables", "definition": "random(8,10,12)", "description": "", "templateType": "anything", "can_override": false}, "B": {"name": "B", "group": "Ungrouped variables", "definition": "ratio A\n", "description": "", "templateType": "anything", "can_override": false}, "params": {"name": "params", "group": "Unnamed group", "definition": "[d: d, ratio: ratio, \nshow: [visible: true, label_visible: false] ]", "description": "", "templateType": "anything", "can_override": false}, "applet": {"name": "applet", "group": "Unnamed group", "definition": "geogebra_applet('drbgytkc',params)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["L", "d", "ratio", "A", "B", "units"], "variable_groups": [{"name": "Unnamed group", "variables": ["R", "xbar", "params", "applet"]}], "functions": {"dist": {"parameters": [["d", "number"]], "type": "quantity", "language": "jme", "definition": "siground(qty(d,units[0]),4)"}, "force": {"parameters": [["F", "number"]], "type": "quantity", "language": "jme", "definition": "siground(qty(f,units[1]),4)"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "$R$ = [[0]] $\\qquad \\bar{x} = $ [[1]]
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "R", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "Force(R)", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "bar", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "dist(xbar)", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Equivalent force-couple system: Circle", "extensions": ["geogebra", "quantities"], "custom_part_types": [{"source": {"pk": 12, "author": {"name": "William Haynes", "pk": 2530}, "edit_page": "/part_type/12/edit"}, "name": "Angle quantity 2020", "short_name": "angle", "description": "Adjusts all angles to 0 < $\\theta$ < 360.
\nAccepts '°' and 'deg' as units.
\nPenalizes if not close enough or no units.
\n90° = -270° = 450°
", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "plain_string(settings['expected_answer']) ", "hint": {"static": true, "value": ""}, "allowEmpty": {"static": true, "value": false}}, "can_be_gap": true, "can_be_step": true, "marking_script": "original_student_scalar:\nmatchnumber(studentAnswer,['plain','en'])[1]\n\nstudent_scalar:\nmod(original_student_scalar,360)\n\n\nstudent_unit:\nstudentAnswer[len(matchnumber(studentAnswer,['plain','en'])[0])..len(studentAnswer)]\n\ninterpreted_unit:\nif(trim(student_unit)='\u00b0','deg',student_unit)\n\ninterpreted_answer:\nqty(mod(student_scalar,360),'deg')\n\nclose:\nwithintolerance(student_scalar, correct_scalar,decimal(settings['close_tol']))\n\ncorrect_scalar:\nmod(scalar(settings['expected_answer']),360)\n\nright:\nwithintolerance(student_scalar, correct_scalar, decimal(settings['right_tol']))\n\ngood_unit:\nsame(qty(1,interpreted_unit),qty(1,'deg'))\n\nmark:\nassert(close,incorrect('Incorrect.');end());\nif(right,correct('Correct angle.'), set_credit(1 - settings['close_penalty'],'Angle is close.'));\nassert(good_unit,sub_credit(settings['unit_penalty'], 'Missing or incorrect units.'))", "marking_notes": [{"name": "original_student_scalar", "description": "Retuns the scalar part of students answer (which is a quantity) as a number.
", "definition": "matchnumber(studentAnswer,['plain','en'])[1]"}, {"name": "student_scalar", "description": "Normalize angle with mod 360
", "definition": "mod(original_student_scalar,360)\n"}, {"name": "student_unit", "description": "matchnumber(studentAnswer,['plain','en'])[0] is a string \"12.34\"
", "definition": "studentAnswer[len(matchnumber(studentAnswer,['plain','en'])[0])..len(studentAnswer)]"}, {"name": "interpreted_unit", "description": "Allows student to use degree symbol or 'deg' for units.
", "definition": "if(trim(student_unit)='\u00b0','deg',student_unit)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "qty(mod(student_scalar,360),'deg')"}, {"name": "close", "description": "", "definition": "withintolerance(student_scalar, correct_scalar,decimal(settings['close_tol']))"}, {"name": "correct_scalar", "description": "Normalize expected_answer with mod 360
", "definition": "mod(scalar(settings['expected_answer']),360)"}, {"name": "right", "description": "", "definition": "withintolerance(student_scalar, correct_scalar, decimal(settings['right_tol']))"}, {"name": "good_unit", "description": "", "definition": "same(qty(1,interpreted_unit),qty(1,'deg'))"}, {"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "assert(close,incorrect('Incorrect.');end());\nif(right,correct('Correct angle.'), set_credit(1 - settings['close_penalty'],'Angle is close.'));\nassert(good_unit,sub_credit(settings['unit_penalty'], 'Missing or incorrect units.'))"}], "settings": [{"name": "expected_answer", "label": "Expected Answer", "help_url": "", "hint": "Expected angle as a quantity.", "input_type": "code", "default_value": "qty(30,'deg')", "evaluate": true}, {"name": "unit_penalty", "label": "Unit penalty", "help_url": "", "hint": "Penalty for not including degree sign or 'deg'.", "input_type": "percent", "default_value": "20"}, {"name": "close_penalty", "label": "Close Penalty", "help_url": "", "hint": "Penalty for close answer.", "input_type": "percent", "default_value": "20"}, {"name": "close_tol", "label": "Close", "help_url": "", "hint": "Angle must be $\\pm$ this many degrees to be marked close. ", "input_type": "code", "default_value": "0.5", "evaluate": false}, {"name": "right_tol", "label": "Right ", "help_url": "", "hint": "Angle must be $\\pm$ this many degrees to be marked correct. ", "input_type": "code", "default_value": "0.1", "evaluate": false}], "public_availability": "restricted", "published": false, "extensions": ["quantities"]}, {"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%,Replace three tangential forces with an equivalent force-couple system acting at the center of a circle.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "{applet}
\nReplace the three forces acting tangent to a {radius} radius circle with an equivalent force-couple system acting at the center $O$.
\nforceA: {precround(forceA,3)} ThetaA: {thetaA}
\nforceB: {precround(ForceB,3)} ThetaB: {thetaB}
\nForceC: {precround(ForceC,3)} ThetaC: {thetaC}
\nmagR: {magR} DirR: {dirR} Moment: {moment}
\n$M = \\Sigma M_O = {\\color{red}{M_A}} + {\\color{blue}{M_B}} + {\\color{green}{M_C}} = \\simplify[!collectnumbers]{{scalar(FA)}r +{scalar(FB)}(r) +{scalar(FC)}(r) } = \\var{display(moment)}$
\n$R_x = \\Sigma F_x = {\\color{red}{A_x}} + {\\color{blue}{B_x}} + {\\color{green}{C_x}} =\\simplify[!collectnumbers] { {precround(forceA[0],2)} + {precround(forceB[0],2)} + {precround(forceC[0],2)}} = \\var{displayV(forceR[0])}$
\n$R_y = \\Sigma F_y = {\\color{red}{A_y}} + {\\color{blue}{B_y}} + {\\color{green}{C_y}} =\\simplify[!collectnumbers] { {precround(forceA[1],2)} + {precround(forceB[1],2)} + {precround(forceC[1],2)}} = \\var{displayV(forceR[1])}$
\n$R = \\sqrt{R_x^2 + R_y^2} = \\var{display(magR)}$
\n$\\theta = \\tan^{-1} \\left(\\dfrac{R_y}{R_x}\\right) =\\var{dirR}°$ from the positive x-axis.
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"Moment": {"name": "Moment", "group": "Ungrouped variables", "definition": "(FA+FB+FC)radius", "description": "", "templateType": "anything", "can_override": false}, "forceR": {"name": "forceR", "group": "Ungrouped variables", "definition": "forceA+forceB+forceC", "description": "", "templateType": "anything", "can_override": false}, "absMoment": {"name": "absMoment", "group": "Ungrouped variables", "definition": "(abs(moment))", "description": "", "templateType": "anything", "can_override": false}, "dirR": {"name": "dirR", "group": "Ungrouped variables", "definition": "precround(degrees(atan2(forceR[1],forceR[0])),4)", "description": "", "templateType": "anything", "can_override": false}, "theta": {"name": "theta", "group": "Inputs", "definition": "random(0..360#5 except [0,90,180,270,360])", "description": "", "templateType": "anything", "can_override": false}, "FC": {"name": "FC", "group": "Inputs", "definition": "random(1,-1)random(random(0..1#0.1)+random(1..5))FA", "description": "", "templateType": "anything", "can_override": false}, "forceA": {"name": "forceA", "group": "Ungrouped variables", "definition": "vector(cos(radians(theta+90)),sin(radians(theta+90))) scalar(FA)", "description": "", "templateType": "anything", "can_override": false}, "thetaA": {"name": "thetaA", "group": "Ungrouped variables", "definition": "theta + 90", "description": "", "templateType": "anything", "can_override": false}, "thetaB": {"name": "thetaB", "group": "Ungrouped variables", "definition": "If(theta < 60, 90, If(theta < 150, 180, If(theta < 240, 0, 90)))+90", "description": "", "templateType": "anything", "can_override": false}, "magR": {"name": "magR", "group": "Ungrouped variables", "definition": "quantity(precround(abs(forceR),4),units[1])", "description": "", "templateType": "anything", "can_override": false}, "thetaC": {"name": "thetaC", "group": "Ungrouped variables", "definition": "thetaB+90", "description": "", "templateType": "anything", "can_override": false}, "radius": {"name": "radius", "group": "Inputs", "definition": "round(quantity(random(4..24),'in') in units[0],quantity(1,units[0]))", "description": "", "templateType": "anything", "can_override": false}, "forceC": {"name": "forceC", "group": "Ungrouped variables", "definition": "vector(cos(radians(thetaC)),sin(radians(thetaC))) scalar(FC)", "description": "", "templateType": "anything", "can_override": false}, "forceB": {"name": "forceB", "group": "Ungrouped variables", "definition": "vector(cos(radians(thetaB)),sin(radians(thetaB))) scalar(FB)", "description": "", "templateType": "anything", "can_override": false}, "FB": {"name": "FB", "group": "Inputs", "definition": "random(1,-1)random(random(0..1#0.1)+random(1..5))FA", "description": "", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "Inputs", "definition": "random(['ft','lb'],['mm','N'],['in','lb'],['cm','N'])", "description": "", "templateType": "anything", "can_override": false}, "FA": {"name": "FA", "group": "Inputs", "definition": "quantity(random(1,-1)random(2,3,4,5)random(2,5,10,20),units[1])", "description": "", "templateType": "anything", "can_override": false}, "params": {"name": "params", "group": "ggb", "definition": "['\u03b8_A': radians(theta), \nFA: scalar(FA), FB: scalar(FB), FC: scalar(FC), \nunits: '\"{units[1]}\"']\n", "description": "{geogebra_applet('ukcfn9fm',[['θ_A',theta+'°'],['FA',scalar(FA)],['FB',scalar(FB)],['FC',scalar(FC)],['units','\"'+plain_units_string(FA) +'\"']])}
", "templateType": "anything", "can_override": false}, "applet": {"name": "applet", "group": "ggb", "definition": "geogebra_applet('ukcfn9fm',params)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "abs(sign(scalar(FA))+sign(scalar(FB))+sign(scalar(FC)))<>3", "maxRuns": 100}, "ungrouped_variables": ["thetaA", "thetaB", "thetaC", "Moment", "forceA", "forceC", "forceB", "forceR", "magR", "dirR", "absMoment"], "variable_groups": [{"name": "Inputs", "variables": ["theta", "FA", "FB", "FC", "units", "radius"]}, {"name": "ggb", "variables": ["params", "applet"]}], "functions": {"displayV": {"parameters": [["n", "number"]], "type": "string", "language": "jme", "definition": "display(qty(n,units[1]))"}, "display": {"parameters": [["q", "quantity"]], "type": "string", "language": "jme", "definition": "string(precround(q,3))"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Force", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "interpreted_angle: // a qty string corrected to standard angle\n student_angle[2] + student_angle[1] * student_angle[0] + student_units\n\nmagnitude:\n studentAnswer[3]\n\nstudent_angle:\n [mod(matchnumber(studentAnswer[0],['plain','en'])[1],360), // angle\n [1,-1][indices(studentAnswer[1],[true])[0]], // ccw = 1 cw = -1\n [0,90,180,-90][indices(studentAnswer[2],[true])[0]]] // reference axis\n\nstudent_units:\n studentAnswer[0][len(matchnumber(studentAnswer[0],['plain','en'])[0])..len(studentAnswer[0])]\n\ninterpreted_answers:\n [interpreted_angle, studentAnswer[1], studentAnswer[2], studentAnswer[3]]\n\ngap_feedback (Feedback on each of the gaps):\n map(\n try(\n let(\n result, submit_part(gaps[gap_number][\"path\"],answer),\n gap, gaps[gap_number],\n name, gap[\"name\"], \n noFeedbackIcon, not gap[\"settings\"][\"showFeedbackIcon\"],\n assert(name=\"\" or len(gaps)=1,feedback(translate('part.gapfill.feedback header',[\"name\": name])));\n concat_feedback(filter(x[\"op\"]<>\"warning\",x,result[\"feedback\"]), if(marks>0,result[\"marks\"]/marks,1), noFeedbackIcon);\n result\n ),\n err,\n fail(translate(\"part.gapfill.error marking gap\",[\"name\": gaps[gap_number][\"name\"], \"message\": err]))\n ),\n [gap_number,answer,index],\n zip([3,0],[studentAnswer[3], interpreted_angle],[1,2])\n )\n\n\n", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "The three forces may be replaced with a single force $\\mathbf{R}$ at $O$ where
\n$\\mathbf{R} = $ [[3]]
\nat an angle of [[0]] measured [[1]] from the [[2]].
", "gaps": [{"type": "angle", "useCustomName": true, "customName": "Dir R", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"expected_answer": "qty(dirR,'deg')", "unit_penalty": "20", "close_penalty": "20", "close_tol": "0.5", "right_tol": "0.1"}}, {"type": "1_n_2", "useCustomName": true, "customName": "sign", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": true, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["CCW", "CW"], "matrix": [0, 0], "distractors": ["", ""]}, {"type": "1_n_2", "useCustomName": true, "customName": "axis", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["+x axis", "+y axis", "-x axis", "-y axis"], "matrix": [0, 0, 0, 0], "distractors": ["", "", "", ""]}, {"type": "engineering-answer", "useCustomName": true, "customName": "R", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "MagR", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "Couple", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "And with couple-moment $M$ = [[0]].
\n(Use the standard sign convention to indicate the direction of the moment.)
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "M", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "moment", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Equivalent Force-couple system: Bracket", "extensions": ["geogebra", "quantities"], "custom_part_types": [{"source": {"pk": 12, "author": {"name": "William Haynes", "pk": 2530}, "edit_page": "/part_type/12/edit"}, "name": "Angle quantity 2020", "short_name": "angle", "description": "Adjusts all angles to 0 < $\\theta$ < 360.
\nAccepts '°' and 'deg' as units.
\nPenalizes if not close enough or no units.
\n90° = -270° = 450°
", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "plain_string(settings['expected_answer']) ", "hint": {"static": true, "value": ""}, "allowEmpty": {"static": true, "value": false}}, "can_be_gap": true, "can_be_step": true, "marking_script": "original_student_scalar:\nmatchnumber(studentAnswer,['plain','en'])[1]\n\nstudent_scalar:\nmod(original_student_scalar,360)\n\n\nstudent_unit:\nstudentAnswer[len(matchnumber(studentAnswer,['plain','en'])[0])..len(studentAnswer)]\n\ninterpreted_unit:\nif(trim(student_unit)='\u00b0','deg',student_unit)\n\ninterpreted_answer:\nqty(mod(student_scalar,360),'deg')\n\nclose:\nwithintolerance(student_scalar, correct_scalar,decimal(settings['close_tol']))\n\ncorrect_scalar:\nmod(scalar(settings['expected_answer']),360)\n\nright:\nwithintolerance(student_scalar, correct_scalar, decimal(settings['right_tol']))\n\ngood_unit:\nsame(qty(1,interpreted_unit),qty(1,'deg'))\n\nmark:\nassert(close,incorrect('Incorrect.');end());\nif(right,correct('Correct angle.'), set_credit(1 - settings['close_penalty'],'Angle is close.'));\nassert(good_unit,sub_credit(settings['unit_penalty'], 'Missing or incorrect units.'))", "marking_notes": [{"name": "original_student_scalar", "description": "Retuns the scalar part of students answer (which is a quantity) as a number.
", "definition": "matchnumber(studentAnswer,['plain','en'])[1]"}, {"name": "student_scalar", "description": "Normalize angle with mod 360
", "definition": "mod(original_student_scalar,360)\n"}, {"name": "student_unit", "description": "matchnumber(studentAnswer,['plain','en'])[0] is a string \"12.34\"
", "definition": "studentAnswer[len(matchnumber(studentAnswer,['plain','en'])[0])..len(studentAnswer)]"}, {"name": "interpreted_unit", "description": "Allows student to use degree symbol or 'deg' for units.
", "definition": "if(trim(student_unit)='\u00b0','deg',student_unit)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "qty(mod(student_scalar,360),'deg')"}, {"name": "close", "description": "", "definition": "withintolerance(student_scalar, correct_scalar,decimal(settings['close_tol']))"}, {"name": "correct_scalar", "description": "Normalize expected_answer with mod 360
", "definition": "mod(scalar(settings['expected_answer']),360)"}, {"name": "right", "description": "", "definition": "withintolerance(student_scalar, correct_scalar, decimal(settings['right_tol']))"}, {"name": "good_unit", "description": "", "definition": "same(qty(1,interpreted_unit),qty(1,'deg'))"}, {"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "assert(close,incorrect('Incorrect.');end());\nif(right,correct('Correct angle.'), set_credit(1 - settings['close_penalty'],'Angle is close.'));\nassert(good_unit,sub_credit(settings['unit_penalty'], 'Missing or incorrect units.'))"}], "settings": [{"name": "expected_answer", "label": "Expected Answer", "help_url": "", "hint": "Expected angle as a quantity.", "input_type": "code", "default_value": "qty(30,'deg')", "evaluate": true}, {"name": "unit_penalty", "label": "Unit penalty", "help_url": "", "hint": "Penalty for not including degree sign or 'deg'.", "input_type": "percent", "default_value": "20"}, {"name": "close_penalty", "label": "Close Penalty", "help_url": "", "hint": "Penalty for close answer.", "input_type": "percent", "default_value": "20"}, {"name": "close_tol", "label": "Close", "help_url": "", "hint": "Angle must be $\\pm$ this many degrees to be marked close. ", "input_type": "code", "default_value": "0.5", "evaluate": false}, {"name": "right_tol", "label": "Right ", "help_url": "", "hint": "Angle must be $\\pm$ this many degrees to be marked correct. ", "input_type": "code", "default_value": "0.1", "evaluate": false}], "public_availability": "restricted", "published": false, "extensions": ["quantities"]}, {"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%,Replace two forces with a equivalent force-couple system at a specified point.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "{applet}
", "advice": "1. Replace forces $A$ and $D$ with a single equivalent force $\\mathbf{B} = \\mathbf{A} + \\mathbf{D}$ acting at point $B$.
\nThis force will have the same translational effect as the original systems, therefore:
\n$B_x = A_x + D_x = + \\var{A} \\cos \\var{abs(theta)}° + 0 = \\var{ea(B[0])}$ {units}
\n$B_y = A_y + D_y =\\var{latex( if(theta >=0, \"+\", \"-\"))} \\var{A} \\sin \\var{abs(theta)}° - D = \\var{ea(B[1])}$ {units}
\n$B = \\sqrt{B_x^2 + B_y^2} = \\var{ea(abs(B))}$ {units}
\n$\\beta =\\tan^{-1}\\left( \\left \\vert\\frac{ \\var{ea(B[1])}} {\\var{ea(B[0])}}\\right \\vert \\right) = \\var{ea(abs(beta))}° $
\n2. Force $\\mathbf{B}$ acting at point $B$ produces no moment about that point, so a concentrated moment $\\mathbf{M}$ must be included to maintain equivalence.
\nThe magnitude and direction of this moment is equal to the moment produced by the original forces $A$ and $D$ about point $B$.
\n$\\begin{align}M &= \\pm A_x(\\var{yB}) \\pm A_y(\\var{xA}) \\pm D_x(\\var{yb}) \\pm D_y (0)
\\\\&= + (\\var{ea(vecA[0])} \\text{ lb}) ( \\var{yb}\\text{ in}) \\var{latex( if(theta >=0, \"+\", \"-\"))} (\\var{abs(ea(vecA[1]))}\\text{ lb}) (\\var{xA} \\text{ in}) + (0)(\\var{yb} \\text{ in}) + (\\var{D}\\text{ lb})( 0)
\\\\&= \\var{latex( if(M >=0, \"+\", \"-\"))} \\var{ea(abs(M))} \\text{ in-lb}
\\\\&= \\var{abs(ea(M))} \\text{ in-lb } \\var{if(M>=0,\" CCW\",\" CW\")} \\end{align}$
x coord of point A (origin at D)
", "templateType": "anything", "can_override": false}, "yb": {"name": "yb", "group": "Unnamed group", "definition": "random(4..7#0.5)", "description": "y coordinate of point B (origin at D)
", "templateType": "anything", "can_override": false}, "yc": {"name": "yc", "group": "Unnamed group", "definition": "yb - random(2..3#0.25)", "description": "y coordinate of point X (origin at D)
", "templateType": "anything", "can_override": false}, "theta": {"name": "theta", "group": "Unnamed group", "definition": "random(-70..70#10)", "description": "direction of force at A
", "templateType": "anything", "can_override": false}, "params": {"name": "params", "group": "Ungrouped variables", "definition": "[xa: xa, yb: yb, yc: yc, theta: radians(theta), magA: A, magD: D, show: 'false']", "description": "show changed to true when advice is displayed
", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "Unnamed group", "definition": "\"lb\"", "description": "force units, length unit assumed are assumed inches.
", "templateType": "anything", "can_override": false}, "A": {"name": "A", "group": "Unnamed group", "definition": "random(100..200#10)", "description": "magnitude of force at A
", "templateType": "anything", "can_override": false}, "D": {"name": "D", "group": "Unnamed group", "definition": "random(A/2..150#10)", "description": "magnitude of force a D, always straigt down.
", "templateType": "anything", "can_override": false}, "B": {"name": "B", "group": "solution", "definition": "vector(A cos(radians(theta)), A sin(radians(theta)) - D)", "description": "Resultant of A + D
", "templateType": "anything", "can_override": false}, "M": {"name": "M", "group": "solution", "definition": "cross(vector(xa, -yb, 0),vector(A cos(radians(theta)), A sin(radians(theta)), 0))[2]", "description": "moment of A about B
", "templateType": "anything", "can_override": false}, "beta": {"name": "beta", "group": "solution", "definition": "degrees(atan2(B[1],B[0]))", "description": "direction of force B, standard angle
", "templateType": "anything", "can_override": false}, "vecA": {"name": "vecA", "group": "solution", "definition": "A vector(cos(radians(theta)), sin(radians(theta)))", "description": "force A, as vector
", "templateType": "anything", "can_override": false}, "debug": {"name": "debug", "group": "Ungrouped variables", "definition": "false", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["applet", "params", "debug"], "variable_groups": [{"name": "Unnamed group", "variables": ["xa", "yb", "yc", "theta", "units", "A", "D"]}, {"name": "solution", "variables": ["B", "M", "beta", "vecA"]}], "functions": {"EA": {"parameters": [["n", "number"]], "type": "anything", "language": "jme", "definition": "if(abs(N) < 10^(-10), precround(n,2) , siground(n,3))"}}, "preamble": {"js": "question.signals.on('adviceDisplayed',function() {\n try{\n var app = question.scope.variables.applet.app; \n app.setValue(\"show\", true);\n }\n catch(err){} \n})\n", "css": ""}, "parts": [{"type": "information", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Replace the forces acting at $A$ and $D$ with an equivalent force-couple system acting at point $B$.
"}, {"type": "gapfill", "useCustomName": true, "customName": "Force", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "interpreted_angle: // a qty string corrected to standard angle\n student_angle[2] + student_angle[1] * student_angle[0] + student_units\n\nmagnitude:\n studentAnswer[3]\n\nstudent_angle:\n [mod(matchnumber(studentAnswer[0],['plain','en'])[1],360), // angle\n [1,-1][indices(studentAnswer[1],[true])[0]], // ccw = 1 cw = -1\n [0,90,180,-90][indices(studentAnswer[2],[true])[0]]] // reference axis\n\nstudent_units:\n studentAnswer[0][len(matchnumber(studentAnswer[0],['plain','en'])[0])..len(studentAnswer[0])]\n\ninterpreted_answers:\n [interpreted_angle, studentAnswer[1], studentAnswer[2], studentAnswer[3]]\n\ngap_feedback (Feedback on each of the gaps):\n map(\n try(\n let(\n result, submit_part(gaps[gap_number][\"path\"],answer),\n gap, gaps[gap_number],\n name, gap[\"name\"], \n noFeedbackIcon, not gap[\"settings\"][\"showFeedbackIcon\"],\n assert(name=\"\" or len(gaps)=1,feedback(translate('part.gapfill.feedback header',[\"name\": name])));\n concat_feedback(filter(x[\"op\"]<>\"warning\",x,result[\"feedback\"]), if(marks>0,result[\"marks\"]/marks,1), noFeedbackIcon);\n result\n ),\n err,\n fail(translate(\"part.gapfill.error marking gap\",[\"name\": gaps[gap_number][\"name\"], \"message\": err]))\n ),\n [gap_number,answer,index],\n zip([3,0],[studentAnswer[3], interpreted_angle],[1,2])\n )\n\n", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "$\\mathbf{B}$ = [[3]]acting at a [[0]] angle measured [[1]] from the [[2]].
\n{ea(abs(B))} lb, {ea(beta)}°
", "gaps": [{"type": "angle", "useCustomName": true, "customName": "angle", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"expected_answer": "qty(ea(beta),'deg')", "unit_penalty": "20", "close_penalty": "20", "close_tol": "0.5", "right_tol": "0.1"}}, {"type": "1_n_2", "useCustomName": true, "customName": "dir", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["CCW", "CW"], "matrix": [0, 0], "distractors": ["", ""]}, {"type": "1_n_2", "useCustomName": true, "customName": "ref", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["Positive x axis", "Positive y axis", "Negative x axis", "Negative y axis"], "matrix": [0, 0, 0, 0], "distractors": ["", "", "", ""]}, {"type": "engineering-answer", "useCustomName": true, "customName": "Magnitude", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "qty(abs(B), units)", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "Couple", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "$\\mathbf{M}$= [[0]]in the [[1]] direction.
\n{qty(ea(abs(M)),'in*lb')}
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "Magnitude", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "qty(ea(abs(M)),'in lb')", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "1_n_2", "useCustomName": true, "customName": "Direction", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": true, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["CW", "CCW"], "matrix": ["if(m<=0,5,0)", "if(M>=0,5,0)"], "distractors": ["", ""]}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Resultant of a force-couple system", "extensions": ["geogebra", "quantities"], "custom_part_types": [{"source": {"pk": 12, "author": {"name": "William Haynes", "pk": 2530}, "edit_page": "/part_type/12/edit"}, "name": "Angle quantity 2020", "short_name": "angle", "description": "Adjusts all angles to 0 < $\\theta$ < 360.
\nAccepts '°' and 'deg' as units.
\nPenalizes if not close enough or no units.
\n90° = -270° = 450°
", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "plain_string(settings['expected_answer']) ", "hint": {"static": true, "value": ""}, "allowEmpty": {"static": true, "value": false}}, "can_be_gap": true, "can_be_step": true, "marking_script": "original_student_scalar:\nmatchnumber(studentAnswer,['plain','en'])[1]\n\nstudent_scalar:\nmod(original_student_scalar,360)\n\n\nstudent_unit:\nstudentAnswer[len(matchnumber(studentAnswer,['plain','en'])[0])..len(studentAnswer)]\n\ninterpreted_unit:\nif(trim(student_unit)='\u00b0','deg',student_unit)\n\ninterpreted_answer:\nqty(mod(student_scalar,360),'deg')\n\nclose:\nwithintolerance(student_scalar, correct_scalar,decimal(settings['close_tol']))\n\ncorrect_scalar:\nmod(scalar(settings['expected_answer']),360)\n\nright:\nwithintolerance(student_scalar, correct_scalar, decimal(settings['right_tol']))\n\ngood_unit:\nsame(qty(1,interpreted_unit),qty(1,'deg'))\n\nmark:\nassert(close,incorrect('Incorrect.');end());\nif(right,correct('Correct angle.'), set_credit(1 - settings['close_penalty'],'Angle is close.'));\nassert(good_unit,sub_credit(settings['unit_penalty'], 'Missing or incorrect units.'))", "marking_notes": [{"name": "original_student_scalar", "description": "Retuns the scalar part of students answer (which is a quantity) as a number.
", "definition": "matchnumber(studentAnswer,['plain','en'])[1]"}, {"name": "student_scalar", "description": "Normalize angle with mod 360
", "definition": "mod(original_student_scalar,360)\n"}, {"name": "student_unit", "description": "matchnumber(studentAnswer,['plain','en'])[0] is a string \"12.34\"
", "definition": "studentAnswer[len(matchnumber(studentAnswer,['plain','en'])[0])..len(studentAnswer)]"}, {"name": "interpreted_unit", "description": "Allows student to use degree symbol or 'deg' for units.
", "definition": "if(trim(student_unit)='\u00b0','deg',student_unit)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "qty(mod(student_scalar,360),'deg')"}, {"name": "close", "description": "", "definition": "withintolerance(student_scalar, correct_scalar,decimal(settings['close_tol']))"}, {"name": "correct_scalar", "description": "Normalize expected_answer with mod 360
", "definition": "mod(scalar(settings['expected_answer']),360)"}, {"name": "right", "description": "", "definition": "withintolerance(student_scalar, correct_scalar, decimal(settings['right_tol']))"}, {"name": "good_unit", "description": "", "definition": "same(qty(1,interpreted_unit),qty(1,'deg'))"}, {"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "assert(close,incorrect('Incorrect.');end());\nif(right,correct('Correct angle.'), set_credit(1 - settings['close_penalty'],'Angle is close.'));\nassert(good_unit,sub_credit(settings['unit_penalty'], 'Missing or incorrect units.'))"}], "settings": [{"name": "expected_answer", "label": "Expected Answer", "help_url": "", "hint": "Expected angle as a quantity.", "input_type": "code", "default_value": "qty(30,'deg')", "evaluate": true}, {"name": "unit_penalty", "label": "Unit penalty", "help_url": "", "hint": "Penalty for not including degree sign or 'deg'.", "input_type": "percent", "default_value": "20"}, {"name": "close_penalty", "label": "Close Penalty", "help_url": "", "hint": "Penalty for close answer.", "input_type": "percent", "default_value": "20"}, {"name": "close_tol", "label": "Close", "help_url": "", "hint": "Angle must be $\\pm$ this many degrees to be marked close. ", "input_type": "code", "default_value": "0.5", "evaluate": false}, {"name": "right_tol", "label": "Right ", "help_url": "", "hint": "Angle must be $\\pm$ this many degrees to be marked correct. ", "input_type": "code", "default_value": "0.1", "evaluate": false}], "public_availability": "restricted", "published": false, "extensions": ["quantities"]}, {"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%,Determine the single force which is equivalent to a force and a couple.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "Replace the force-couple system acting at the origin with a single force which has the same effect. Specify the magnitude and direction of the resultant force and the coordinate $x_A$ $y_A$ of the point on the $x$-axis $y$-axis through which the line of action of this force passes.
\n{applet}
\nF: {F} Fx: {Fx} Fy: {Fy}
\nM: {M} $x_A$: {dx} $y_A$: {dy}
\nThe equivalent force has the same magnitude and direction as the original force, but its line of action must be changed in such a way as to produce the same moment about A with the same direction as the original moment M. You may move the force horizontally to $x_A$ where $F_y x_A = M$ or vertically to $y_A$ where $F_y y_A = M$.
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"dy": {"name": "dy", "group": "Ungrouped variables", "definition": "siground(-1*M/Fx,3)", "description": "", "templateType": "anything", "can_override": false}, "version": {"name": "version", "group": "Ungrouped variables", "definition": "random(0..1)", "description": "", "templateType": "anything", "can_override": false}, "dx": {"name": "dx", "group": "Ungrouped variables", "definition": "siground(M/Fy,3)", "description": "", "templateType": "anything", "can_override": false}, "F": {"name": "F", "group": "Ungrouped variables", "definition": "quantity(random(1,2,3,4,5)*random(10,20,30,50),units[0])", "description": "", "templateType": "anything", "can_override": false}, "M": {"name": "M", "group": "Ungrouped variables", "definition": "Quantity(scalar(F)random(-1,1)random(1..6#0.1),units[0]+ \" \" +units[1])", "description": "The moment. Counterclockwise is positive
", "templateType": "anything", "can_override": false}, "Fx": {"name": "Fx", "group": "Ungrouped variables", "definition": "F * cos(radians(alpha))", "description": "", "templateType": "anything", "can_override": false}, "Fy": {"name": "Fy", "group": "Ungrouped variables", "definition": "F * sin(radians(alpha))", "description": "", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "Ungrouped variables", "definition": "random(['N','m'],['lb','in'],['lb','ft'])", "description": "", "templateType": "anything", "can_override": false}, "debug": {"name": "debug", "group": "Ungrouped variables", "definition": "false", "description": "", "templateType": "anything", "can_override": false}, "alpha": {"name": "alpha", "group": "Ungrouped variables", "definition": "random(0..360#10 except[0,90,180,270,360])", "description": "the direction of the force
", "templateType": "anything", "can_override": false}, "applet": {"name": "applet", "group": "Unnamed group", "definition": "geogebra_applet('xfrg2ewr',params)", "description": "", "templateType": "anything", "can_override": false}, "params": {"name": "params", "group": "Unnamed group", "definition": "[\nF: scalar(F), M: scalar(M), \n'\u03b1': radians(alpha), \nunitsF: '\"{units[0]}\"', \nunitsD: '\"{units[1]}\"'\n]", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["F", "M", "alpha", "units", "Fx", "Fy", "dx", "dy", "version", "debug"], "variable_groups": [{"name": "Unnamed group", "variables": ["applet", "params"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Solution", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "interpreted_angle: // a qty string corrected to standard angle\n student_angle[2] + student_angle[1] * student_angle[0] + student_units\n\nmagnitude:\n studentAnswer[3]\n\nstudent_angle:\n [mod(matchnumber(studentAnswer[0],['plain','en'])[1],360), // angle\n [1,-1][indices(studentAnswer[1],[true])[0]], // ccw = 1 cw = -1\n [0,90,180,-90][indices(studentAnswer[2],[true])[0]]] // reference axis\n\nstudent_units:\n studentAnswer[0][len(matchnumber(studentAnswer[0],['plain','en'])[0])..len(studentAnswer[0])]\n\ninterpreted_answers:\n [interpreted_angle, studentAnswer[1], studentAnswer[2], studentAnswer[3]]\n\ngap_feedback (Feedback on each of the gaps):\n map(\n try(\n let(\n result, submit_part(gaps[gap_number][\"path\"],answer),\n gap, gaps[gap_number],\n name, gap[\"name\"], \n noFeedbackIcon, not gap[\"settings\"][\"showFeedbackIcon\"],\n assert(name=\"\" or len(gaps)=1,feedback(translate('part.gapfill.feedback header',[\"name\": name])));\n concat_feedback(filter(x[\"op\"]<>\"warning\",x,result[\"feedback\"]), if(marks>0,result[\"marks\"]/marks,1), noFeedbackIcon);\n result\n ),\n err,\n fail(translate(\"part.gapfill.error marking gap\",[\"name\": gaps[gap_number][\"name\"], \"message\": err]))\n ),\n [gap_number,answer,index],\n zip([3,0,4],[studentAnswer[3], interpreted_angle, studentAnswer[4]],[1,2,3])\n )", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "The force and couple above can be replace with a single force with mangntude
\n$F$ = [[3]]
\nacting at an angle of [[0]] measured [[1]] from the [[2]],
\nand passing through the $x$-axis $y$-axis at $x_A$ $y_A$ = [[4]].
", "gaps": [{"type": "angle", "useCustomName": true, "customName": "Angle", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"expected_answer": "qty(alpha,'deg')", "unit_penalty": "20", "close_penalty": "20", "close_tol": "0.5", "right_tol": "0.2"}}, {"type": "1_n_2", "useCustomName": true, "customName": "sign", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["CCW", "CW"], "matrix": [0, 0], "distractors": ["", ""]}, {"type": "1_n_2", "useCustomName": true, "customName": "ref", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["+x axis", "+y axis", "-x axis", "-y axis"], "matrix": [0, 0, 0, 0], "distractors": ["", "", "", ""]}, {"type": "engineering-answer", "useCustomName": true, "customName": "F", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "F", "right": "0.001", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "Intercept", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "if(version=0,dx,dy)", "right": "0.1", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}]}], "allowPrinting": true, "navigation": {"allowregen": true, "reverse": true, "browse": true, "allowsteps": true, "showfrontpage": false, "showresultspage": "oncompletion", "navigatemode": "menu", "onleave": {"action": "none", "message": ""}, "preventleave": true, "typeendtoleave": false, "startpassword": "", "allowAttemptDownload": false, "downloadEncryptionKey": ""}, "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": "William Haynes", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2530/"}], "extensions": ["geogebra", "quantities", "weh"], "custom_part_types": [{"source": {"pk": 24, "author": {"name": "William Haynes", "pk": 2530}, "edit_page": "/part_type/24/edit"}, "name": "Angle quantity", "short_name": "angle-quantity-from-reference", "description": "Angle as a quantity in degrees.
", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "plain_string(settings['correct_quantity'])", "hint": {"static": true, "value": ""}, "allowEmpty": {"static": true, "value": false}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nswitch( \nright and good_units and right_sign and angle_in_range, add_credit(1.0,'Correct.'),\nright and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\nright and right_sign and not good_units, add_credit(settings['C2'],'Correct angle, but missing degree symbol.'),\nright and good_units and right_sign and not angle_in_range,add_credit(settings['C1'],'Angle is out of range.'),\nclose and good_units, add_credit(settings['C1'],'Close.'),\nclose and not good_units, add_credit(settings['C3'],'Answer is close, but missing degree symbol.'),\nincorrect('Wrong answer.')\n)\n\ninterpreted_answer:\nqty(student_scalar, student_units)\n\ncorrect_scalar:\nscalar(correct_quantity)\n \n\ncorrect_quantity:\nsettings['correct_quantity']\n\ncorrect_units:\nunits(correct_quantity)\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:\njoin(\nsplit(studentAnswer[len(match_student_number[0])..len(studentAnswer)]\n,\"\u00b0\"),\" deg\")\n\n\n\ngood_units:\ntry(\nkind(quantity(1, student_units))= kind(correct_quantity),\nmsg,\nfeedback(msg);false)\n\nstudent_quantity:\nswitch(not good_units, \nstudent_scalar * correct_units, \nnot right_sign,\n-quantity(student_scalar, student_units),\nquantity(student_scalar,student_units)\n)\n\nright_sign:\nsign(student_scalar) = sign(correct_quantity)\n\nangle_in_range:\nif(settings['restrict_angle'], abs(student_scalar) <= 90, true)\n\nright:\nwithinTolerance(abs(student_scalar), abs(correct_scalar), settings['right'])\n\nclose:\nwithinTolerance(student_scalar, correct_scalar, settings['close'])", "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( \nright and good_units and right_sign and angle_in_range, add_credit(1.0,'Correct.'),\nright and good_units and not right_sign, add_credit(settings['C2'],'Wrong sign.'),\nright and right_sign and not good_units, add_credit(settings['C2'],'Correct angle, but missing degree symbol.'),\nright and good_units and right_sign and not angle_in_range,add_credit(settings['C1'],'Angle is out of range.'),\nclose and good_units, add_credit(settings['C1'],'Close.'),\nclose and not good_units, add_credit(settings['C3'],'Answer is close, but missing degree symbol.'),\nincorrect('Wrong answer.')\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "qty(student_scalar, student_units)"}, {"name": "correct_scalar", "description": "", "definition": "scalar(correct_quantity)\n "}, {"name": "correct_quantity", "description": "", "definition": "settings['correct_quantity']"}, {"name": "correct_units", "description": "", "definition": "units(correct_quantity)"}, {"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": "", "definition": "join(\nsplit(studentAnswer[len(match_student_number[0])..len(studentAnswer)]\n,\"\u00b0\"),\" deg\")\n\n"}, {"name": "good_units", "description": "", "definition": "try(\nkind(quantity(1, student_units))= kind(correct_quantity),\nmsg,\nfeedback(msg);false)"}, {"name": "student_quantity", "description": "", "definition": "switch(not good_units, \nstudent_scalar * correct_units, \nnot right_sign,\n-quantity(student_scalar, student_units),\nquantity(student_scalar,student_units)\n)"}, {"name": "right_sign", "description": "", "definition": "sign(student_scalar) = sign(correct_quantity)"}, {"name": "angle_in_range", "description": "", "definition": "if(settings['restrict_angle'], abs(student_scalar) <= 90, true)"}, {"name": "right", "description": "Will check for correct sign elswhere.
", "definition": "withinTolerance(abs(student_scalar), abs(correct_scalar), settings['right'])"}, {"name": "close", "description": "Must have correct sign to be close.
", "definition": "withinTolerance(student_scalar, correct_scalar, settings['close'])\n"}], "settings": [{"name": "correct_quantity", "label": "Correct Angle as quantity ", "help_url": "", "hint": "", "input_type": "code", "default_value": "qty(45,'deg')", "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 amount from the correct value.", "input_type": "code", "default_value": "0.1", "evaluate": true}, {"name": "restrict_angle", "label": "Less than 90\u00b0", "help_url": "", "hint": "When checked, angle must be between -90° and +90°.", "input_type": "checkbox", "default_value": true}, {"name": "C1", "label": "Close with units.", "help_url": "", "hint": "Partial Credit for close value with appropriate units.", "input_type": "percent", "default_value": "75"}, {"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 amount from the correct value.", "input_type": "code", "default_value": "0.5", "evaluate": true}, {"name": "C2", "label": "No units or wrong sign", "help_url": "", "hint": "Partial credit for forgetting units or using wrong sign.", "input_type": "percent", "default_value": "50"}, {"name": "C3", "label": "Close, no units.", "help_url": "", "hint": "Partial Credit for close value without units.", "input_type": "percent", "default_value": "25"}], "public_availability": "restricted", "published": false, "extensions": ["quantities"]}, {"source": {"pk": 12, "author": {"name": "William Haynes", "pk": 2530}, "edit_page": "/part_type/12/edit"}, "name": "Angle quantity 2020", "short_name": "angle", "description": "Adjusts all angles to 0 < $\\theta$ < 360.
\nAccepts '°' and 'deg' as units.
\nPenalizes if not close enough or no units.
\n90° = -270° = 450°
", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "plain_string(settings['expected_answer']) ", "hint": {"static": true, "value": ""}, "allowEmpty": {"static": true, "value": false}}, "can_be_gap": true, "can_be_step": true, "marking_script": "original_student_scalar:\nmatchnumber(studentAnswer,['plain','en'])[1]\n\nstudent_scalar:\nmod(original_student_scalar,360)\n\n\nstudent_unit:\nstudentAnswer[len(matchnumber(studentAnswer,['plain','en'])[0])..len(studentAnswer)]\n\ninterpreted_unit:\nif(trim(student_unit)='\u00b0','deg',student_unit)\n\ninterpreted_answer:\nqty(mod(student_scalar,360),'deg')\n\nclose:\nwithintolerance(student_scalar, correct_scalar,decimal(settings['close_tol']))\n\ncorrect_scalar:\nmod(scalar(settings['expected_answer']),360)\n\nright:\nwithintolerance(student_scalar, correct_scalar, decimal(settings['right_tol']))\n\ngood_unit:\nsame(qty(1,interpreted_unit),qty(1,'deg'))\n\nmark:\nassert(close,incorrect('Incorrect.');end());\nif(right,correct('Correct angle.'), set_credit(1 - settings['close_penalty'],'Angle is close.'));\nassert(good_unit,sub_credit(settings['unit_penalty'], 'Missing or incorrect units.'))", "marking_notes": [{"name": "original_student_scalar", "description": "Retuns the scalar part of students answer (which is a quantity) as a number.
", "definition": "matchnumber(studentAnswer,['plain','en'])[1]"}, {"name": "student_scalar", "description": "Normalize angle with mod 360
", "definition": "mod(original_student_scalar,360)\n"}, {"name": "student_unit", "description": "matchnumber(studentAnswer,['plain','en'])[0] is a string \"12.34\"
", "definition": "studentAnswer[len(matchnumber(studentAnswer,['plain','en'])[0])..len(studentAnswer)]"}, {"name": "interpreted_unit", "description": "Allows student to use degree symbol or 'deg' for units.
", "definition": "if(trim(student_unit)='\u00b0','deg',student_unit)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "qty(mod(student_scalar,360),'deg')"}, {"name": "close", "description": "", "definition": "withintolerance(student_scalar, correct_scalar,decimal(settings['close_tol']))"}, {"name": "correct_scalar", "description": "Normalize expected_answer with mod 360
", "definition": "mod(scalar(settings['expected_answer']),360)"}, {"name": "right", "description": "", "definition": "withintolerance(student_scalar, correct_scalar, decimal(settings['right_tol']))"}, {"name": "good_unit", "description": "", "definition": "same(qty(1,interpreted_unit),qty(1,'deg'))"}, {"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "assert(close,incorrect('Incorrect.');end());\nif(right,correct('Correct angle.'), set_credit(1 - settings['close_penalty'],'Angle is close.'));\nassert(good_unit,sub_credit(settings['unit_penalty'], 'Missing or incorrect units.'))"}], "settings": [{"name": "expected_answer", "label": "Expected Answer", "help_url": "", "hint": "Expected angle as a quantity.", "input_type": "code", "default_value": "qty(30,'deg')", "evaluate": true}, {"name": "unit_penalty", "label": "Unit penalty", "help_url": "", "hint": "Penalty for not including degree sign or 'deg'.", "input_type": "percent", "default_value": "20"}, {"name": "close_penalty", "label": "Close Penalty", "help_url": "", "hint": "Penalty for close answer.", "input_type": "percent", "default_value": "20"}, {"name": "close_tol", "label": "Close", "help_url": "", "hint": "Angle must be $\\pm$ this many degrees to be marked close. ", "input_type": "code", "default_value": "0.5", "evaluate": false}, {"name": "right_tol", "label": "Right ", "help_url": "", "hint": "Angle must be $\\pm$ this many degrees to be marked correct. ", "input_type": "code", "default_value": "0.1", "evaluate": false}], "public_availability": "restricted", "published": false, "extensions": ["quantities"]}, {"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%,