// Numbas version: finer_feedback_settings {"name": "Chapter 3 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": "Particle Equilibrium", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": ["Equilibrium equation method", "", "Four forces", "Hanging weight", "Ball in a trough", " Rope and pulley", ""], "variable_overrides": [[], [], [], [], [], [], []], "questions": [{"name": "Equilibrium of a particle - equilibrium equation method", "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 forces required to hold a particle in equilibrium when subjected to a downward load. Directions of the reactions are given.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "{geogebra_applet('uwmn9de6',[['alpha', alpha+'°'],['theta', theta+'°']])}
\nThree forces act on particle $A$ as shown. Use the equations of equilibrium to determine the magnitudes of $B$ and $C$ when load $W =$ {qty(W,unit)}.
", "advice": "Knowns:
\n$W = \\var{qty(W,unit)}$, $\\alpha = \\var{alpha}°$ and $\\theta=\\var{theta}°$.
\nApply equations of equilibrium
\n$\\begin{align}
\\Sigma F_x &= 0 & \\Sigma F_y &= 0 \\\\-B_x + C_x &= 0 & B_y + C_y -W &= 0\\\\
B \\sin\\alpha & = C \\cos\\theta & B \\cos\\alpha + C \\sin\\theta & = W \\\\
B &= C \\left(\\frac{\\cos\\theta}{\\sin\\alpha}\\right)\\\\
B &= \\var{K_1}\\, C\\\\
&&(\\var{K_1}\\, C) \\cos\\alpha + C \\sin\\theta & = W \\\\
&& \\var{K_2}\\, C&= \\var{qty(W,unit)} \\\\
&&C &= \\var{qty(siground(W/K_2,4),unit)} \\\\
B &= \\var{K_1}\\, (\\var{qty(siground(W/K_2,4),unit)})\\\\
B&=\\var{qty(siground(B,4),unit)}
\\end{align}$
$B$ = [[0]]
\n$C$ = [[1]]
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "Force B", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "qty(B,unit)", "right": "0.2", "close": "1.0", "C1": "80", "C2": "80", "C3": "60"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "Force C", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "qty(C,unit)", "right": "0.2", "close": "1.0", "C1": "80", "C2": "80", "C3": "60"}}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Particle Equilibrium: Use slopes to find components", "extensions": ["geogebra", "linear-algebra", "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%,Two dimensional particle equilibrium problem. Advice shows how to use how to use slope triangles to find sines and cosines, rather than finding the angle and using that.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "{applet1(\"G\", 300)}
\nA $\\var{qty(F,\"N\")}$ force $F$ is applied in the direction shown to a small ring, which is held in equilibrium by two inextensible ropes attached to fixed points $A$ and $B$.
", "advice": "1. Draw FBD of the Particle
\n{applet1(\"D\", 250)}
\n2. Determine slope triangles from geometry.
\nForce | \nRise | \nRun | \nHypotenuse | \n
$F$ | \n$\\var{dyF}$ | \n$\\var{dxF}$ | \n$\\sqrt{\\var{rF2}}$ | \n
$A$ | \n$\\var{dyA}$ | \n$\\var{dxA}$ | \n$\\sqrt{\\var{rA2}}$ | \n
$B$ | \n$\\var{dyB}$ | \n$\\var{dxB}$ | \n$\\sqrt{\\var{rB2}}$ | \n
3. Determine scalar components in terms of $A$, $B$, and $F$ from slopes and given $F = \\var{qty(F,'N')}$
\n$\\begin{align}
F_x &= \\left(\\frac{\\var{dxF}}{\\sqrt{\\var{rF2}}}\\right) F = \\var{precround(qty(vecF[0], 'N'),4)} & F_y &= \\left(\\frac{\\var{dyF}}{\\sqrt{\\var{rF2}}}\\right) F = \\var{precround(qty(vecF[1], 'N'),4)}\\\\
A_x &= \\left(\\frac{\\var{dxA}}{\\sqrt{\\var{rA2}}}\\right) A = \\var{precround(cos(radians(alpha)),3)} A & A_y &= \\left(\\frac{\\var{dyA}}{\\sqrt{\\var{rA2}}}\\right) A = \\var{precround(sin(radians(alpha)),3)} A\\\\
B_x &= \\left(\\frac{\\var{dxB}}{\\sqrt{\\var{rB2}}}\\right) B = \\var{precround(cos(radians(beta )),3)} B & B_y &= \\left(\\frac{\\var{dyB}}{\\sqrt{\\var{rB2}}}\\right) B = \\var{precround(sin(radians(beta )),3)} B
\\end{align}$
4. Set up two equations of equilibrium.
\n$\\begin{align}
\\Sigma F_x &= 0 & \\Sigma F_y &= 0\\\\
A_x + B_x + F_x &=0& A_y + B_y +F_y &=0\\\\
\\simplify[!noLeadingMinus]{{precround(cos(radians(alpha)),3)} A + {precround(cos(radians(beta)),3)} B} & =\\var{precround(qty(- vecF[0], 'N'),4)} &
\\simplify[!noLeadingMinus]{{precround(sin(radians(alpha)),3)} A + {precround(sin(radians(beta)),3)} B} & =\\var{precround(qty(- vecF[1], 'N'),4)}\\\\
\\end{align}$
5. Solve simultaneously to get:
\n$\\begin{align}
A &= \\var{siground(qty(abs(FA),'N'),4)} & B &= \\var{siground(qty(abs(FB),'N'),4)}
\\end{align}$
Grid top left at (0,0) bottom right at(10,-10)
", "templateType": "anything", "can_override": false}, "B": {"name": "B", "group": "Ungrouped variables", "definition": "random(vector(random(0,10), random(0..-10)), vector(random(0..10), random(0,-10)))", "description": "", "templateType": "anything", "can_override": false}, "P": {"name": "P", "group": "Ungrouped variables", "definition": "vector(random(3..7),random(-3..-7))", "description": "", "templateType": "anything", "can_override": false}, "alpha": {"name": "alpha", "group": "angles", "definition": "degrees(atan2(A[1]-P[1], A[0]-P[0]))", "description": "Direction of Force A will only point in quadrant 2 or 4
", "templateType": "anything", "can_override": false}, "beta": {"name": "beta", "group": "angles", "definition": "degrees(atan2(B[1]-P[1], B[0]-P[0]))", "description": "Direction of force B will only point in quadrant 1 or 2
", "templateType": "anything", "can_override": false}, "F": {"name": "F", "group": "Ungrouped variables", "definition": "random(50..600#25)", "description": "", "templateType": "anything", "can_override": false}, "FA": {"name": "FA", "group": "Ungrouped variables", "definition": "soln[0][2]", "description": "", "templateType": "anything", "can_override": false}, "FB": {"name": "FB", "group": "Ungrouped variables", "definition": "soln[1][2]", "description": "", "templateType": "anything", "can_override": false}, "C": {"name": "C", "group": "Ungrouped variables", "definition": "random(vector(random(0,10), random(0..-10)), vector(random(0..10), random(0,-10)))", "description": "", "templateType": "anything", "can_override": false}, "phi": {"name": "phi", "group": "angles", "definition": "degrees(atan2(C[1]-P[1], C[0]-P[0]))", "description": "Direction of force F (will only point in quadrant 3 or 4)
", "templateType": "anything", "can_override": false}, "soln": {"name": "soln", "group": "Ungrouped variables", "definition": "reduced_row_echelon_form( \nmatrix([cos(radians(alpha)),cos(radians(beta)),- F cos(radians(phi))],\n [sin(radians(alpha)),sin(radians(beta)),- F sin(radians(phi))]))", "description": "", "templateType": "anything", "can_override": false}, "vecA": {"name": "vecA", "group": "Ungrouped variables", "definition": "vector(cos(radians(alpha)),sin(radians(alpha))) FA", "description": "", "templateType": "anything", "can_override": false}, "vecB": {"name": "vecB", "group": "Ungrouped variables", "definition": "vector(cos(radians(beta)),sin(radians(beta))) FB", "description": "", "templateType": "anything", "can_override": false}, "vecF": {"name": "vecF", "group": "Ungrouped variables", "definition": "siground(vector(cos(radians(phi)),sin(radians(phi))) F,4)", "description": "", "templateType": "anything", "can_override": false}, "Check": {"name": "Check", "group": "Ungrouped variables", "definition": "vecA + vecB + vecF", "description": "", "templateType": "anything", "can_override": false}, "dxA": {"name": "dxA", "group": "angles", "definition": "(A[0]-P[0])", "description": "run for force A
", "templateType": "anything", "can_override": false}, "dyA": {"name": "dyA", "group": "angles", "definition": "(A[1]-P[1])", "description": "Rise for force A
", "templateType": "anything", "can_override": false}, "dxB": {"name": "dxB", "group": "angles", "definition": "(B[0]-P[0])", "description": "", "templateType": "anything", "can_override": false}, "dyB": {"name": "dyB", "group": "angles", "definition": "(B[1]-P[1])", "description": "", "templateType": "anything", "can_override": false}, "dxF": {"name": "dxF", "group": "angles", "definition": "(C[0]-P[0])", "description": "", "templateType": "anything", "can_override": false}, "dyF": {"name": "dyF", "group": "angles", "definition": "(C[1]-P[1])", "description": "", "templateType": "anything", "can_override": false}, "rA2": {"name": "rA2", "group": "angles", "definition": "(dxA^2+dyA^2)", "description": "", "templateType": "anything", "can_override": false}, "rB2": {"name": "rB2", "group": "angles", "definition": "(dxB^2+dyB^2)", "description": "", "templateType": "anything", "can_override": false}, "rF2": {"name": "rF2", "group": "angles", "definition": "(dxF^2+dyF^2)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "//avoid forces on same line of action\ntan(radians(alpha)) <> tan(radians(beta)) and\ntan(radians(beta)) <> tan(radians(phi)) and\ntan(radians(phi)) <> tan(radians(alpha)) and\nFA > 0 and FB > 0 and // only tension please\nFA < 50 F and FB < 50F // and not too big", "maxRuns": 100}, "ungrouped_variables": ["applet", "A", "B", "P", "C", "F", "FA", "FB", "soln", "vecA", "vecB", "vecF", "Check"], "variable_groups": [{"name": "angles", "variables": ["alpha", "beta", "phi", "dxA", "dyA", "dxB", "dyB", "dxF", "dyF", "rA2", "rB2", "rF2"]}], "functions": {"applet1": {"parameters": [["perspective", "string"], ["width", "number"]], "type": "anything", "language": "javascript", "definition": "// Create the worksheet. \n// This function returns an object with a container `element` and a `promise` resolving to a GeoGebra applet.\n\nvar params = {\n material_id: 'saaa7mqd'\n};\nvar result = Numbas.extensions.geogebra.createGeogebraApplet(params);\n\n// Once the applet has loaded, run some commands to manipulate the worksheet.\nresult.promise.then(function(d) {\n var app = d.app;\n question.applet = d;\n app.setPerspective(perspective);\n app.setWidth(width);\n app.setHeight(width);\n //app.setAxesVisible(true,false);\n //app.enableShiftDragZoom(false);\n\n function setGGBPoint(name, nname = name) {\n // moves point in GGB to Numbas value\n var x = Numbas.jme.unwrapValue(question.scope.getVariable(nname));\n app.setFixed(name, false, false); //fixed and selection allowed\n app.setCoords(name, x[0], x[1]);\n app.setFixed(name, true, false);\n }\n\n setGGBPoint('A');\n setGGBPoint('B');\n setGGBPoint('C');\n setGGBPoint('P');\n function setGGBAngle(gname, nname = gname) {\n // Sets angle in GGB to a Numbas Variable given in degrees.\n var v = Math.PI / 180 * Numbas.jme.unwrapValue(question.scope.getVariable(nname));\n app.setValue(gname, v);\n }\n\n //setGGBAngle('\u03b8','theta');\n //setGGBAngle('\u03b1','alpha');\n //app.setValue('tension',Numbas.jme.unwrapValue(question.scope.getVariable('tension')));\n\n});\n\n// This function returns the result of `createGeogebraApplet` as an object \n// with the JME data type 'ggbapplet', which can be substituted into the question's content.\nreturn new Numbas.jme.types.ggbapplet(result);\n"}}, "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": "Determine the tensions in the two ropes.
\n$A = $ [[0]]
\n$B = $ [[1]]
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "A", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "siground(qty(FA,\"N\"),3)", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "B", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "siground(qty(FB,\"N\"),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": "Equilibrium of a particle: four forces", "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%,Three random forces act on a particle. Determine the force required for equilibirum.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "{applet} {alpha} {beta} {gamma}
\nFour forces with magnitudes $A$ = {qty(maga,units)}, $B$ = {qty(magb,units)}, and $C$ = {qty(magC,units)}, act on a particle in the directions shown.
\nDetermine the magnitude and direction of force $\\mathbf{D}$ required for equilibrium.
", "advice": "Begin by drawing a free body diagram of the particle. Since the direction of force $\\mathbf{D}$ is unknown you will have to make an assumption about which way it points.
\nSet up and solve the equilibrium equations based on your assumed direction for $\\mathbf{D}$
\n$\\begin{align}
\\Sigma F_x &= 0\\\\
A_x + B_x + C_x + D_x &= 0\\\\
\\simplify[!collectNumbers]{{enground(A[0])} + {enground(B[0])} + {enground(C[0])} - D_x} &= 0 \\\\
D_x &= \\var{qty(enground(A[0] +B[0] +C[0]),units)}&(1)\\\\\\\\
\\Sigma F_y &= 0\\\\
A_y + B_y + C_y + D_y &= 0\\\\
\\simplify[!collectNumbers]{{enground(A[1])} + {enground(B[1])} + {enground(C[1])} + D_y } &= 0\\\\
D_y &= \\var{qty(- enground(A[1] +B[1] +C[1]),units)} & (2)
\\end{align}$
If your calculations result in a negative value for $D_x$ or $D_y$, then your assumed direction is opposite of the component's actual direction.
\nDraw a sketch showing $D_x$, $D_y$, and $D$ pointing in their actual directions and define angle $\\theta$.
\nResolve the components using right triangle trigonometry to find $D$ and $\\theta$.
\n$D = \\var{enground(abs(D))}$ {units},
\n$\\theta = \\var{siground(theta,4)}$° measured counterclockwise from the $x$-axis.
\nYour value of $\\theta$ will depend on the reference angle you choose. Choose one that makes $\\theta$ less than 90° to avoid sign errors.
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"A": {"name": "A", "group": "forces", "definition": "maga vector(cos(radians(alpha)),sin(radians(alpha)))\n", "description": "", "templateType": "anything", "can_override": false}, "theta": {"name": "theta", "group": "forces", "definition": "degrees(atan2(D[1],D[0]))", "description": "", "templateType": "anything", "can_override": false}, "gamma": {"name": "gamma", "group": "input", "definition": "random(180..265#5)", "description": "", "templateType": "anything", "can_override": false}, "magc": {"name": "magc", "group": "input", "definition": "random(10..100#5)", "description": "", "templateType": "anything", "can_override": false}, "C": {"name": "C", "group": "forces", "definition": "magc vector(cos(radians(gamma)),sin(radians(gamma)))", "description": "", "templateType": "anything", "can_override": false}, "beta": {"name": "beta", "group": "input", "definition": "random(270..355#5)", "description": "", "templateType": "anything", "can_override": false}, "alpha": {"name": "alpha", "group": "input", "definition": "random(0..90#5)", "description": "", "templateType": "anything", "can_override": false}, "debug": {"name": "debug", "group": "input", "definition": "false", "description": "", "templateType": "anything", "can_override": false}, "magb": {"name": "magb", "group": "input", "definition": "random(10..100#5)", "description": "", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "input", "definition": "random('kN','N','lb')", "description": "", "templateType": "anything", "can_override": false}, "B": {"name": "B", "group": "forces", "definition": "magb vector(cos(radians(beta)),sin(radians(beta)))", "description": "", "templateType": "anything", "can_override": false}, "D": {"name": "D", "group": "forces", "definition": "-(A+B+C)\n", "description": "", "templateType": "anything", "can_override": false}, "maga": {"name": "maga", "group": "input", "definition": "random(10..100#5)", "description": "", "templateType": "anything", "can_override": false}, "magd": {"name": "magd", "group": "forces", "definition": "qty(abs(D),units)\n", "description": "", "templateType": "anything", "can_override": false}, "dx": {"name": "dx", "group": "check", "definition": "-(A[0] + B[0] + C[0])", "description": "", "templateType": "anything", "can_override": false}, "dy": {"name": "dy", "group": "check", "definition": "-(A[1] + B[1] + C[1])", "description": "", "templateType": "anything", "can_override": false}, "applet": {"name": "applet", "group": "input", "definition": "geogebra_applet('xnbz73te',params)", "description": "", "templateType": "anything", "can_override": false}, "params": {"name": "params", "group": "input", "definition": "['\u03b1': radians(alpha),'\u03b2': radians(beta) ,'\u03b3': radians(gamma) , 'maga': maga , 'magb': magb,'magc':magc ]", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [{"name": "input", "variables": ["alpha", "beta", "gamma", "units", "maga", "magb", "magc", "debug", "applet", "params"]}, {"name": "forces", "variables": ["A", "B", "C", "D", "magd", "theta"]}, {"name": "check", "variables": ["dx", "dy"]}], "functions": {"enground": {"parameters": [["n", "number"]], "type": "number", "language": "jme", "definition": "if(abs(N) < 10^(-10), precround(n,3) , siground(n,4))"}, "graphics2": {"parameters": [["app", "ggbapplet"]], "type": "ggbapplet", "language": "javascript", "definition": "// Take an applet, set its perspective to the given string.\n// See https://wiki.geogebra.org/en/SetPerspective_Command for the format of the perspective string.\napp.promise.then(function(d) {\n d.app.setPerspective(\"D\");// D=graphics2\n});\nreturn new Numbas.jme.types.ggbapplet(app);"}}, "preamble": {"js": "", "css": ".part:not(.dirty) > .student-answer.answered[feedback-state='wrong'] input {\nborder-color: hsl(0, 0%, 50%);\nbackground: hsl(0, 0%, 95%);\n}\n"}, "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": "$D$ = [[3]] ({siground(magd,4)}) acting at [[0]] measured [[1]] from the [[2]]. ({siground(theta,4)}°)
", "gaps": [{"type": "angle", "useCustomName": true, "customName": "Direction", "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(round(theta*100)/100,'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": true, "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": "Reference Direction", "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": 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": "Magnitude", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "magD", "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": "Equilibrium of a particle: hanging weight", "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"]}, {"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%,The student is shown two radio choices: \"Yes\" and \"No\". One of them is correct.
", "help_url": "", "input_widget": "radios", "input_options": {"correctAnswer": "if(eval(settings[\"correct_answer_expr\"]), 0, 1)", "hint": {"static": true, "value": ""}, "choices": {"static": true, "value": ["Yes", "No"]}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nif(studentanswer=correct_answer,\n correct(),\n incorrect()\n)\n\ninterpreted_answer:\nstudentAnswer=0\n\ncorrect_answer:\nif(eval(settings[\"correct_answer_expr\"]),0,1)", "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": "if(studentanswer=correct_answer,\n correct(),\n incorrect()\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "studentAnswer=0"}, {"name": "correct_answer", "description": "", "definition": "if(eval(settings[\"correct_answer_expr\"]),0,1)"}], "settings": [{"name": "correct_answer_expr", "label": "Is the answer \"Yes\"?", "help_url": "", "hint": "An expression which evaluates totrue
or false
.", "input_type": "mathematical_expression", "default_value": "true", "subvars": false}], "public_availability": "always", "published": true, "extensions": []}], "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": ["Mechanics, statics, equilibrium, particle equilibrium, 2-d, tension"], "metadata": {"description": "Find the tensions in two ropes supporting a weight.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "Equilibrium of a particle: $\\Sigma \\mathbf{F} = 0 \\therefore \\Sigma F_x = 0 \\text{ and } \\Sigma F_y =0$
\n{geogebra_applet('GbauxKWS',params)}
\nFind the tensions in the two cables when they are supporting a {qty(W,units[0])} load.
\n$h = \\var{qty(h,units[1])}, d_1 = \\var{qty(d_1,units[1])}, \\text{ and } d_2 = \\var{qty(d_2,units[1])}$.
\n", "advice": "Draw a free body diagram of the particle. Apply the equations of equilibrium to get\\[\\Sigma F_x\\!:\\ AC_x = BC_x \\qquad \\Sigma F_y\\!: \\ AC_y + BC_y =W\\]
\nExpress the components in terms of the magnitudes $AB$ and $BC$ and directions $\\alpha$ and $\\beta$, then solve the two equations simultaneously for the unknown tensions.
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"load": {"name": "load", "group": "results", "definition": "if(units[0]='kg',W 9.81, W)", "description": "", "templateType": "anything", "can_override": false}, "debug": {"name": "debug", "group": "results", "definition": "false", "description": "", "templateType": "anything", "can_override": false}, "h": {"name": "h", "group": "Inputs", "definition": "random(3..6#0.5)", "description": "", "templateType": "anything", "can_override": false}, "d_1": {"name": "d_1", "group": "Inputs", "definition": "random(2..5#0.25)", "description": "Horizontal location of point C.
", "templateType": "anything", "can_override": false}, "Q_ac": {"name": "Q_ac", "group": "answer", "definition": "let(unit,if(units[0]='kg','N',units[0]),qty(AC,unit))", "description": "", "templateType": "anything", "can_override": false}, "d_2": {"name": "d_2", "group": "Inputs", "definition": "random(2..5#0.25)", "description": "", "templateType": "anything", "can_override": false}, "BC": {"name": "BC", "group": "results", "definition": "load cos(radians(alpha))/sin(radians(alpha+beta))", "description": "Tension in cable BC
", "templateType": "anything", "can_override": false}, "Q_bc": {"name": "Q_bc", "group": "answer", "definition": "let(unit,if(units[0]='kg','N',units[0]),qty(BC,unit))", "description": "", "templateType": "anything", "can_override": false}, "beta": {"name": "beta", "group": "results", "definition": "degrees(arctan(h/d_2))", "description": "", "templateType": "anything", "can_override": false}, "W": {"name": "W", "group": "Inputs", "definition": "random([10,20,25,40,50,75,100,120,150])", "description": "anans
", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "Inputs", "definition": "random(['lb','ft'], ['N','m'], ['kN','m'], ['kg','m'] )", "description": "", "templateType": "anything", "can_override": false}, "AC": {"name": "AC", "group": "results", "definition": "load cos(radians(beta))/sin(radians(alpha+beta))", "description": "", "templateType": "anything", "can_override": false}, "alpha": {"name": "alpha", "group": "results", "definition": "degrees(arctan(h/d_1))", "description": "", "templateType": "anything", "can_override": false}, "params": {"name": "params", "group": "Ungrouped variables", "definition": "[d_1: d_1, d_2: d_2, h: h]", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["params"], "variable_groups": [{"name": "Inputs", "variables": ["W", "d_1", "d_2", "h", "units"]}, {"name": "results", "variables": ["alpha", "beta", "load", "BC", "AC", "debug"]}, {"name": "answer", "variables": ["Q_bc", "Q_ac"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Question 1", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Pick the correct statement:
\n[[0]]
", "gaps": [{"type": "1_n_2", "useCustomName": false, "customName": "", "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": "radiogroup", "displayColumns": "1", "showCellAnswerState": true, "choices": ["The tension in $AC$ is greater than the tension in $BC$.", "The tension in $BC$ is greater than the tension in $AC$.", "Both tensions are the same and equal the weight $W$.", "Both tensions are the same and equal half the weight $W$.", "Both tensions are the same and greater than the weight $W$.", "Both tensions are the same and less than the weight $W$."], "matrix": ["award(4,alpha>beta)", "award(4,alphaDo you need to calculate the lengths of the cables to solve this problem?
", "settings": {"correct_answer_expr": "false"}}, {"type": "yes-no", "useCustomName": true, "customName": "Question 3", "marks": "3", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [{"variables": [{"name": "BC", "value": "304.0454111793"}, {"name": "d_2", "value": "4.25"}, {"name": "beta", "value": "30.4655449195"}, {"name": "correct_units", "value": "\"N\""}, {"name": "AC", "value": "354.1734692843"}, {"name": "d_1", "value": "2.75"}, {"name": "W", "value": "40"}, {"name": "h", "value": "2.5"}, {"name": "units", "value": "[ \"kg\", \"m\" ]"}, {"name": "alpha", "value": "42.2736890061"}, {"name": "load", "value": "392.4"}], "name": "student says kg is not a force", "answer": {"empty": false, "value": 1, "valid": true}, "notes": [{"name": "mark", "expected": {"value": "true", "messages": ["Your answer is correct.\n\nYou were awarded 1 mark."], "warnings": [], "error": "", "valid": true, "credit": 1}}, {"name": "correct_answer", "expected": {"value": "1", "messages": [], "warnings": [], "error": "", "valid": true, "credit": 0}}]}, {"variables": [{"name": "BC", "value": "304.0454111793"}, {"name": "d_2", "value": "4.25"}, {"name": "beta", "value": "30.4655449195"}, {"name": "correct_units", "value": "\"N\""}, {"name": "AC", "value": "354.1734692843"}, {"name": "d_1", "value": "2.75"}, {"name": "W", "value": "40"}, {"name": "h", "value": "2.5"}, {"name": "units", "value": "[ \"kg\", \"m\" ]"}, {"name": "alpha", "value": "42.2736890061"}, {"name": "load", "value": "392.4"}], "name": "student says kg is a force", "answer": {"empty": false, "value": 0, "valid": true}, "notes": [{"name": "mark", "expected": {"value": "false", "messages": ["Your answer is incorrect."], "warnings": [], "error": "", "valid": true, "credit": 0}}, {"name": "interpreted_answer", "expected": {"value": "true", "messages": [], "warnings": [], "error": "", "valid": true, "credit": 0}}]}, {"variables": [{"name": "BC", "value": "90.9068004018"}, {"name": "d_2", "value": "3.25"}, {"name": "beta", "value": "24.7751405688"}, {"name": "correct_units", "value": "\"N\""}, {"name": "AC", "value": "103.1746031746"}, {"name": "d_1", "value": "2"}, {"name": "W", "value": "100"}, {"name": "h", "value": "1.5"}, {"name": "units", "value": "[ \"N\", \"m\" ]"}, {"name": "alpha", "value": "36.8698976458"}, {"name": "load", "value": "100"}], "name": "student says N is a force", "answer": {"empty": false, "value": 0, "valid": true}, "notes": [{"name": "mark", "expected": {"value": "true", "messages": ["Your answer is correct.\n\nYou were awarded 1 mark."], "warnings": [], "error": "", "valid": true, "credit": 1}}]}, {"variables": [{"name": "BC", "value": "90.9068004018"}, {"name": "d_2", "value": "3.25"}, {"name": "beta", "value": "24.7751405688"}, {"name": "correct_units", "value": "\"N\""}, {"name": "AC", "value": "103.1746031746"}, {"name": "d_1", "value": "2"}, {"name": "W", "value": "100"}, {"name": "h", "value": "1.5"}, {"name": "units", "value": "[ \"N\", \"m\" ]"}, {"name": "alpha", "value": "36.8698976458"}, {"name": "load", "value": "100"}], "name": "student says N is not a force", "answer": {"empty": false, "value": 1, "valid": true}, "notes": [{"name": "mark", "expected": {"value": "false", "messages": ["Your answer is incorrect."], "warnings": [], "error": "", "valid": true, "credit": 0}}]}], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Is the load a force?
", "settings": {"correct_answer_expr": " not(units[0] = 'kg')"}}, {"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": "Find the necessary angles:
\n$\\alpha$ = [[0]] $\\beta$ = [[1]]
", "gaps": [{"type": "angle-quantity-from-reference", "useCustomName": true, "customName": "alpha", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correct_quantity": "qty(round(alpha*100)/100,'deg')", "right": "0.2", "restrict_angle": true, "C1": "75", "close": "1.01", "C2": "50", "C3": "25"}}, {"type": "angle-quantity-from-reference", "useCustomName": true, "customName": "beta", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correct_quantity": "qty(round(beta*100)/100 ,'deg')", "right": "0.2", "restrict_angle": true, "C1": "75", "close": "1.01", "C2": "50", "C3": "25"}}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "Magnitudes", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Substitute the known weight and angles $\\alpha$ and $\\beta$ into your equations, then solve them simultaneously to find the tensions in cables $AC$ and $BC$
\n$AC$ = [[0]] {q_ac} $BC $= [[1]] {q_bc}
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "AC", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "q_ac", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "BC", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "q_bc", "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": "Equilibrium of a particle: ball in a trough", "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 reactions for a particle in equilibrium
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "{geogebra_applet('dsdqn4dr',[['α', alpha+'°'],['β', beta+'°']])}
\n\nA: {A} B: {B}
", "advice": "There are two ways to solve this problem
\n1. Equilibrium Equation Method
\nSet up and simplify the equlibrium equations:
\n$\\qquad\\Sigma F_x = 0$ and $\\Sigma F_y = 0$
\n2. Force Triangle Method
\nAnswers
\n$A$ = {siground(A,4)} $B$={siground(B,4)}
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"W": {"name": "W", "group": "Ungrouped variables", "definition": "quantity(random(1..20),random('N','pound'))", "description": "", "templateType": "anything", "can_override": false}, "B": {"name": "B", "group": "Ungrouped variables", "definition": "W / (sin(radians(beta)) cos(radians(alpha))/ sin(radians(alpha)) + cos(radians(beta)))", "description": "W / (sin(b) cos(a) / sin(a) + cos(b))
", "templateType": "anything", "can_override": false}, "alpha": {"name": "alpha", "group": "Ungrouped variables", "definition": "random(20..70#5)", "description": "", "templateType": "anything", "can_override": false}, "beta": {"name": "beta", "group": "Ungrouped variables", "definition": "random(20..70#5)", "description": "", "templateType": "anything", "can_override": false}, "A": {"name": "A", "group": "Ungrouped variables", "definition": "B sin(radians(beta))/sin(radians(alpha))", "description": "FB sin(b) / sin(a)
", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["alpha", "beta", "A", "W", "B"], "variable_groups": [], "functions": {}, "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": "A {w} cylinder rests in the trough shown. Assume that the contact surfaces are smooth (frictionless).
\nDetermine the reactions at $A$ and $B$.
\n\n$A$ = [[0]] $B$ = [[1]]
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%,Pulley supported by a cable, so the tension in the rope is constant. Advice is a youtube video showing how to solve the problem.
", "licence": "Creative Commons Attribution-ShareAlike 4.0 International"}, "statement": "{geogebra_applet('qbvd5vx9',['L': length, 'W': width, 'd': offset, 'units': '\"' + units[0] + '\"'])}
\nCable $ABC$ has a length of {qty(length, units[0])}. Determine the position $x$ and the tension in $ABC$ required for equilibrium when the cable supports a $P = \\var{load}$ load riding on a frictionless pulley of negligable radius.
", "advice": "See this video
\n\n$\\alpha = \\var{siground(alpha,2)}° $
\n$x = \\var{x}$
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"Width": {"name": "Width", "group": "Ungrouped variables", "definition": "random(5..10#0.5)", "description": "", "templateType": "anything", "can_override": false}, "Length": {"name": "Length", "group": "Ungrouped variables", "definition": "Width + random(1..3#0.5)", "description": "", "templateType": "anything", "can_override": false}, "offset": {"name": "offset", "group": "Ungrouped variables", "definition": "random(1.5..3.5#0.25)", "description": "", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "Ungrouped variables", "definition": "random([['ft','lb'],['m','kg']])", "description": "", "templateType": "anything", "can_override": false}, "load": {"name": "load", "group": "Ungrouped variables", "definition": "qty(random(25..250#25),units[1])", "description": "", "templateType": "anything", "can_override": false}, "P": {"name": "P", "group": "solution", "definition": "if(units[1]='kg',qty(scalar(load) * 9.81, 'N'),load)", "description": "", "templateType": "anything", "can_override": false}, "alpha": {"name": "alpha", "group": "solution", "definition": "degrees(arccos(width/length))", "description": "angle ropes make with horzontal
", "templateType": "anything", "can_override": false}, "T": {"name": "T", "group": "solution", "definition": "siground(P/ (2 sin(radians(alpha))),4) ", "description": "", "templateType": "anything", "can_override": false}, "x": {"name": "x", "group": "Ungrouped variables", "definition": "siground(qty(y/tan(radians(alpha)),units[0]),4)", "description": "", "templateType": "anything", "can_override": false}, "y": {"name": "y", "group": "Ungrouped variables", "definition": "height - offset", "description": "", "templateType": "anything", "can_override": false}, "height": {"name": "height", "group": "Ungrouped variables", "definition": "width tan(radians(alpha))", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "scalar(x) > width/5", "maxRuns": 100}, "ungrouped_variables": ["Width", "Length", "offset", "units", "load", "height", "x", "y"], "variable_groups": [{"name": "solution", "variables": ["P", "alpha", "T"]}], "functions": {}, "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": "$x$ = [[1]] $\\qquad T$ = [[0]]
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "Tension", "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"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "x", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "x", "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": "3D Equilibrium: Hanging Plate", "extensions": ["geogebra", "linear-algebra", "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%,3D equilibrium of a particle problem. Rectangular steel plate supported by three cables, dimensions and density given.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "{applet} | \nYou can rotate the diagram and move the labels with the mouse, zoom with the mouse wheel, and shift-drag to pan. | \n
A $\\var{qty(L,mm)} \\times \\var{qty(W,mm)}$ steel plate $\\var{qty(t,mm)}$ thick is suspended from point $P$ located $\\var{qty(H,mm)}$ above the center of the plate.
\nKnowing that $DE = \\var{qty(DE,mm)}$ and that the density of the steel is $\\rho = \\var{qty(rho, \"kg/m^3\")}$, determine the tensions in the three cables.
\n", "advice": "To find the tensions in the cables, consider equilibrium of particle $P$, and note that force $\\mathbf{P}$ acts vertically up with a magnitude equal to the weight of the plate.
\nFind the weight of the plate, and the upward force $\\mathbf{P}$.
\n$\\begin{align} W &= m g = \\rho\\ (L\\times W \\times t)\\ g \\\\
& = \\var{qty(rho, \"kg/m^3\")} \\times \\left(\\var{qty(L,\"mm\")} \\times \\var{qty(W,\"mm\")} \\times \\var{qty(t,\"mm\")} \\right) \\times \\left(\\frac{\\var{qty(1, \"m\")}}{\\var{qty(1000,\"mm\")}}\\right)^3 \\times \\var{g}\\\\
& = \\var{siground(weight,4)}\\\\ \\mathbf{P} &= \\langle 0,0, \\var{siground(scalar(weight),4)} \\rangle \\text{ N}\\\\ \\end{align}$
Find position vectors and corresponding unit vectors from point $P$ to points $A$, $B$, and $D$.
\n$\\begin{align}
r_A &= \\var{ brackets(r_A)} \\text{ mm} & u_A &= \\frac{r_A}{|r_A|} = \\var{brackets(U_A)} \\\\
r_B &= \\var{ brackets(r_B)} \\text{ mm} & u_B &= \\frac{r_B}{|r_B|} = \\var{brackets(U_B)} \\\\
r_D &= \\var{ brackets(r_D)} \\text{ mm} & u_D &= \\frac{r_D}{|r_D|} = \\var{brackets(U_D)} \\\\
\\end{align}$
Express the forces in the cables in terms of unknown tensions and the unit vectors.
\n$\\begin{align}
\\mathbf{T_A} & = T_A u_A = T_A \\var{brackets(u_A)}\\\\
\\mathbf{T_B} & = T_B u_B = T_B \\var{brackets(u_B)}\\\\
\\mathbf{T_D} & = T_D u_A = T_D \\var{brackets(u_D)}\\\\
\\end{align}$
Set up three scalar equilibrium equations corresponding to $\\mathbf{T_A} + \\mathbf{T_B} + \\mathbf{T_D} + \\mathbf{P} = 0$.
\n\\begin{align}
\\Sigma F_x&=0: &\\simplify[!zeroTerm]{+{precround(U_A[0],3)} T_A + {precround(U_B[0],3)} T_B + { precround(U_D[0],3)} T_D + 0 = 0 }\\\\
\\Sigma F_y&=0: &\\simplify[!zeroTerm]{+{precround(U_A[1],3) } T_A + {precround(U_B[1],3) } T_B + { precround(U_D[1],3) } T_D + 0 =0} \\\\
\\Sigma F_z&=0: &\\simplify[!zeroTerm]{{precround(U_A[2],3) } T_A + {precround(U_B[2],3) } T_B + { precround(U_D[2],3) } T_D + {siground(scalar(weight),4)} =0}\\\\
\\end{align}
Solve the equilibrium equations simultaneously to get:
\n$\\begin{align}
T_A &= \\var{siground(qty(T_A,\"N\"),4)}\\\\
T_B &= \\var{siground(qty(T_B,\"N\"),4)}\\\\
T_D &= \\var{siground(qty(T_D,\"N\"),4)}\\\\
\\end{align}$
height of hook
", "templateType": "anything", "can_override": false}, "W": {"name": "W", "group": "inputs", "definition": "random(400..800#50)", "description": "width of plate in mm
", "templateType": "anything", "can_override": false}, "L": {"name": "L", "group": "inputs", "definition": "random(300..1000#20)", "description": "length of plate in mm
", "templateType": "anything", "can_override": false}, "frac": {"name": "frac", "group": "inputs", "definition": "random(0.2..0.8#0.1 except 0.5)", "description": "for ggb: fraction of length W to get CD
", "templateType": "anything", "can_override": false}, "params": {"name": "params", "group": "inputs", "definition": "[H: decimal(H/100), W: decimal(W/100), L: decimal(L/100), t: frac]", "description": "", "templateType": "anything", "can_override": false}, "mm": {"name": "mm", "group": "inputs", "definition": "\"mm\"", "description": "units
", "templateType": "anything", "can_override": false}, "CD": {"name": "CD", "group": "calculations", "definition": "W frac", "description": "segment CD, no closer than 150 mm to corners
", "templateType": "anything", "can_override": false}, "rho": {"name": "rho", "group": "inputs", "definition": "random(7750..8050#10)", "description": "density of steel in kg/m^3
", "templateType": "anything", "can_override": false}, "DE": {"name": "DE", "group": "calculations", "definition": "(1-frac)W", "description": "", "templateType": "anything", "can_override": false}, "t": {"name": "t", "group": "inputs", "definition": "random(20..40#5)", "description": "thickness of plate in mm
", "templateType": "anything", "can_override": false}, "weight": {"name": "weight", "group": "calculations", "definition": "qty(W,mm) * qty(L,mm) * qty(t,mm) * qty(rho, \"kg/m^3\") * g in \"N\"\n", "description": "", "templateType": "anything", "can_override": false}, "g": {"name": "g", "group": "inputs", "definition": "9.81 * quantity(\"m/s^2\")", "description": "", "templateType": "anything", "can_override": false}, "r_A": {"name": "r_A", "group": "vectors", "definition": "vector(L/2,-W/2,-H)", "description": "position vector to A from P in mm
", "templateType": "anything", "can_override": false}, "r_B": {"name": "r_B", "group": "vectors", "definition": "vector(L/2,W/2,-H)", "description": "position vector to B from P in mm
", "templateType": "anything", "can_override": false}, "r_D": {"name": "r_D", "group": "vectors", "definition": "vector(-L/2,-W/2+DE,-H)", "description": "position vector to D from P in mm
", "templateType": "anything", "can_override": false}, "u_A": {"name": "u_A", "group": "vectors", "definition": "r_A/abs(r_A)", "description": "unit vector to A
", "templateType": "anything", "can_override": false}, "u_B": {"name": "u_B", "group": "vectors", "definition": "r_B/abs(r_b)", "description": "unit vector to B
", "templateType": "anything", "can_override": false}, "u_D": {"name": "u_D", "group": "vectors", "definition": "r_D/abs(r_D)", "description": "unit vector to D
", "templateType": "anything", "can_override": false}, "MA": {"name": "MA", "group": "matrices", "definition": "transpose(matrix(u_A,u_B,u_D))", "description": "3x3 matrix of unit vectors
\n[[U_Ax U_Bx U_Dx]
\n[U_Ay U_By U_Dy]
\n[U_Az U_Bz U_Dz]]
", "templateType": "anything", "can_override": false}, "P": {"name": "P", "group": "matrices", "definition": "matrix([0],[0],[scalar(weight)])", "description": "column vector of upward force P
", "templateType": "anything", "can_override": false}, "MC": {"name": "MC", "group": "matrices", "definition": "augment(MA,-P)", "description": "3x4 augmented matrix P is negative since it needs to move across equals sign
", "templateType": "anything", "can_override": false}, "soln": {"name": "soln", "group": "matrices", "definition": "reduced_row_echelon_form(MC)", "description": "this finds solution
", "templateType": "anything", "can_override": false}, "T_A": {"name": "T_A", "group": "tensions", "definition": "soln[0][3]", "description": "", "templateType": "anything", "can_override": false}, "T_B": {"name": "T_B", "group": "tensions", "definition": "soln[1][3]", "description": "", "templateType": "anything", "can_override": false}, "T_D": {"name": "T_D", "group": "tensions", "definition": "soln[2][3]", "description": "", "templateType": "anything", "can_override": false}, "F_A": {"name": "F_A", "group": "check", "definition": "T_A u_A", "description": "Vector force A
", "templateType": "anything", "can_override": false}, "sum": {"name": "sum", "group": "check", "definition": "F_A+F_B+F_D+F_P", "description": "this should equal (0,0,0)
", "templateType": "anything", "can_override": false}, "F_B": {"name": "F_B", "group": "check", "definition": "T_B U_B", "description": "Vector force B
", "templateType": "anything", "can_override": false}, "F_D": {"name": "F_D", "group": "check", "definition": "T_D u_D", "description": "Vector force D
", "templateType": "anything", "can_override": false}, "F_P": {"name": "F_P", "group": "check", "definition": "vector(0,0,scalar(weight))", "description": "Vector force P
", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [{"name": "inputs", "variables": ["W", "L", "H", "frac", "rho", "t", "applet", "params", "g", "mm"]}, {"name": "calculations", "variables": ["DE", "CD", "weight"]}, {"name": "vectors", "variables": ["r_A", "r_B", "r_D", "u_A", "u_B", "u_D"]}, {"name": "matrices", "variables": ["MA", "P", "MC", "soln"]}, {"name": "tensions", "variables": ["T_A", "T_B", "T_D"]}, {"name": "check", "variables": ["F_A", "F_B", "F_D", "F_P", "sum"]}], "functions": {"brackets": {"parameters": [["v", "vector"]], "type": "string", "language": "jme", "definition": "latex(\"\\\\langle \" + precround(v[0],3) + \", \" + precround(v[1],3) + \", \" + precround(v[2],3) + \" \\\\rangle\" )"}}, "preamble": {"js": "", "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": "$T_A$ = [[0]] $T_B$ = [[1]] $T_D$ = [[2]]
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "$T_A$", "marks": "20", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "qty(T_A, \"N\")", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "$T_B$", "marks": "20", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "qty(T_B, \"N\")", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "$T_D$", "marks": "20", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "qty(T_D, \"N\")", "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": "Multi-particle Equilibrium", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": ["Two suspended loads", "Cylinders in a trough"], "variable_overrides": [[], []], "questions": [{"name": "Equilibrium of a particle: two suspended loads", "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 tensions is a system of cables supporting two loads.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "{geogebra_applet('vzqtfrbq',[['a1',a1+\"°\"],['a2',a2+\"°\"],['a3',a3+\"°\"]])}
\nTwo loads $W_1 = \\var{w1}$, and $W_2 = \\var{w2}$ are suspended from a system of cables as shown. Determine the tensions in the cables.
", "advice": "Begin by drawing a free body diagram of particle A, then apply the equations of equilibrium.
\n$\\begin{align}\\\\ \\Sigma F_x = 0 \\\\-{T_B}_x + {T_C}_x = 0 \\end{align} \\\\ T_B \\cos(\\var{a1}°) = T_C \\sin(\\var{90-a2}°) \\qquad(1)$
\n$\\begin{align}\\\\ \\Sigma F_y = 0 \\\\{T_B}_y + {T_C}_y - W_1 = 0 \\end{align} \\\\ T_B \\sin(\\var{a1}°) + T_C \\cos(\\var{90-a2})° = W_1 \\qquad(2)$
\nSolve (1) and (2) simultaneously for $T_B$ and $T_C$.
\n$T_B = \\var{siground(TB,4)}, \\quad T_C = \\var{siground(TC,4)}$
\nWith $T_C$ known, use a similar approach on particle $C$ to find $T_D$ and $T_E$.
\nSince cable CD is horizontal $T_D$ has no y-component, so the $\\Sigma F_y = 0$ equation only has one unknown and simultaneous equations are unnecessary in this case.
\n$T_D = \\var{siground(TD,4)}, \\quad T_E = \\var{siground(TE,4)}$
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"forceC": {"name": "forceC", "group": "check", "definition": "vector(cos(radians(a2)),sin(radians(a2))) scalar(TC)\n", "description": "", "templateType": "anything", "can_override": false}, "forceE": {"name": "forceE", "group": "check", "definition": "vector(cos(radians(a3)),sin(radians(a3))) scalar(TE)", "description": "", "templateType": "anything", "can_override": false}, "TB": {"name": "TB", "group": "magnitudes", "definition": "w1 cos(radians(a2))/sin(radians(a1+a2))", "description": "", "templateType": "anything", "can_override": false}, "forceD": {"name": "forceD", "group": "check", "definition": "vector(scalar(TD),0)", "description": "", "templateType": "anything", "can_override": false}, "a2": {"name": "a2", "group": "input", "definition": "random(10..70#5)", "description": "a2 is the angle from the horizontal to AC. Note angle shown on diagram is the complement of a2
", "templateType": "anything", "can_override": false}, "debug": {"name": "debug", "group": "input", "definition": "false", "description": "", "templateType": "anything", "can_override": false}, "TE": {"name": "TE", "group": "magnitudes", "definition": "(W2 + TC sin(radians(A2)))/sin(radians(A3))", "description": "", "templateType": "anything", "can_override": false}, "a1": {"name": "a1", "group": "input", "definition": "random(10..80#5)", "description": "angle of rope AB from horizontal, as shown on diagram.
", "templateType": "anything", "can_override": false}, "a3": {"name": "a3", "group": "input", "definition": "random(20..70#5)", "description": "angle of CE as shown on diagram.
", "templateType": "anything", "can_override": false}, "w2": {"name": "w2", "group": "input", "definition": "qty(random(10..100#5),units)", "description": "", "templateType": "anything", "can_override": false}, "TC": {"name": "TC", "group": "magnitudes", "definition": "w1 cos(radians(a1))/sin(radians(a1+a2))\n\n", "description": "", "templateType": "anything", "can_override": false}, "w1": {"name": "w1", "group": "input", "definition": "qty(random(10..100#5),units)", "description": "", "templateType": "anything", "can_override": false}, "forceB": {"name": "forceB", "group": "check", "definition": "vector(-cos(radians(A1)),sin(radians(A1))) scalar(TB)", "description": "", "templateType": "anything", "can_override": false}, "TD": {"name": "TD", "group": "magnitudes", "definition": "TC cos(radians(a2))-TE cos(radians(a3))", "description": "", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "input", "definition": "'lb'", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "a1 <> a2 and a3>a2+10 and scalar(TD) > 0", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [{"name": "input", "variables": ["a1", "a2", "a3", "w1", "w2", "units", "debug"]}, {"name": "magnitudes", "variables": ["TC", "TE", "TD", "TB"]}, {"name": "check", "variables": ["forceB", "forceC", "forceE", "forceD"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "First Particle", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Draw a free body diagram of point A and apply the equations of equilibrium to determine the tensions in cables AB and AC.
\n$T_{AB}$ = [[0]] {siground(TB,4)}
\n$T_{AC}$ = [[1]] {siground(TC,4)}
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "TB", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "TB", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "TC", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "TC", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "Second Particle", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Draw a free body diagram of point C and apply the equations of equilibrium to determine the tensions in cables CE and CD.
\n$T_{CE}$ = [[0]] {siground(TE,4)}
\n$T_{CD}$ = [[1]] {siground(TD,4)}
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "TE", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "TE", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "TD", "marks": "5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "TD", "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": "Equilibrium of two particles: Cylinders in a trough", "extensions": ["geogebra", "quantities", "weh"], "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%,Equilibrium of two interacting particles.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "<p\">{geogebra_applet('dmn6ddbb', [[\"width\", width], [\"r1\",r1], [\"r2\",r2]] )}
\nTwo cylinders are placed in a {width} {units[0]} wide container. The blue cylinder has a radius $r_1$ = {d1/2} {units[0]} and weighs {w1} {units[1]} and the yellow cylinder has a radius $r_2$ = {d2/2} {units[0] } and weighs {w2} {units[1]}.
", "advice": "Given:
\nDraw free body diagrams of the two cylinders.
\n{geogebra_applet('rchz6eew', [[\"width\", width], [\"r1\",r1], [\"r2\",r2]] )}
\nFind angle $\\theta$ from the geometry of the problem.
\n$\\theta =cos^{-1} \\left( \\dfrac{d - r_1- r_2}{r_1+r_2} \\right) = \\var{siground(theta,4)}°$
\nFind force $A$ using equilibrium of the yellow cylinder
\n$\\begin{align} \\Sigma F_y &= 0\\\\A_y - W_2 &= 0\\\\ A \\sin \\theta &= W_2\\\\ A &= W_2\\,/\\,\\sin \\theta &=\\var{show(A)}\\end{align}$
\nFind forces $B$ and $C$ using equilibrium of the blue cylinder
\n$\\begin{align} \\Sigma F_y &= 0 & \\Sigma F_x &=0\\\\ B - A_y - W_1 &= 0 & C-A_x &=0\\\\ B &= W_1 + A \\sin \\theta & C &= A \\cos\\theta \\\\&= \\var{show(B)} & &=\\var{show(C)} \\end{align}$
\n", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"B": {"name": "B", "group": "calculated", "definition": "w1 + A sin(radians(theta))", "description": "", "templateType": "anything", "can_override": false}, "theta": {"name": "theta", "group": "calculated", "definition": "degrees(arccos(base/r))", "description": "", "templateType": "anything", "can_override": false}, "r2": {"name": "r2", "group": "calculated", "definition": "d2/2", "description": "", "templateType": "anything", "can_override": false}, "base": {"name": "base", "group": "calculated", "definition": "width - (d1+d2)/2\n", "description": "", "templateType": "anything", "can_override": false}, "C": {"name": "C", "group": "calculated", "definition": "A cos(radians(theta))", "description": "", "templateType": "anything", "can_override": false}, "r": {"name": "r", "group": "calculated", "definition": "(d1+d2)/2", "description": "distance from center to center
", "templateType": "anything", "can_override": false}, "width": {"name": "width", "group": "Ungrouped variables", "definition": "random(d1..d1+d2)", "description": "", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "Ungrouped variables", "definition": "['ft','lb']", "description": "", "templateType": "anything", "can_override": false}, "d1": {"name": "d1", "group": "Ungrouped variables", "definition": "random(4..12 #2)", "description": "diameter 1
", "templateType": "anything", "can_override": false}, "r1": {"name": "r1", "group": "calculated", "definition": "d1/2", "description": "", "templateType": "anything", "can_override": false}, "w1": {"name": "w1", "group": "Ungrouped variables", "definition": "random(1000..5000#250)", "description": "", "templateType": "anything", "can_override": false}, "d2": {"name": "d2", "group": "Ungrouped variables", "definition": "random(d1/2 .. d1)", "description": "diameter 2
\n", "templateType": "anything", "can_override": false}, "A": {"name": "A", "group": "calculated", "definition": "w2/sin(radians(theta))", "description": "", "templateType": "anything", "can_override": false}, "w2": {"name": "w2", "group": "Ungrouped variables", "definition": "siground(w1 d2^2/d1^2,2)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "base < r and width > d1 and d1 <> d2", "maxRuns": 100}, "ungrouped_variables": ["width", "d1", "d2", "units", "w1", "w2"], "variable_groups": [{"name": "calculated", "variables": ["base", "r1", "r2", "r", "theta", "A", "B", "C"]}], "functions": {"show": {"parameters": [["f", "number"]], "type": "number", "language": "jme", "definition": "qty(siground(f,4),units[1])"}}, "preamble": {"js": "", "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": "Assuming smooth contact surfaces, determine the magnitudes of Force A, where the two cylinders touch, Force B where the blue cylinder touches the bottom of the trough, and Force C where it touches the left wall.
\n$A$ = [[0]] $B$ = [[1]] $C$ = [[2]]
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "A", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "qty(A,units[1])", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "B", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "qty(B,units[1])", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "engineering-answer", "useCustomName": true, "customName": "C", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "qty(C,units[1])", "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"}]}], "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", "linear-algebra", "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%,The student is shown two radio choices: \"Yes\" and \"No\". One of them is correct.
", "help_url": "", "input_widget": "radios", "input_options": {"correctAnswer": "if(eval(settings[\"correct_answer_expr\"]), 0, 1)", "hint": {"static": true, "value": ""}, "choices": {"static": true, "value": ["Yes", "No"]}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nif(studentanswer=correct_answer,\n correct(),\n incorrect()\n)\n\ninterpreted_answer:\nstudentAnswer=0\n\ncorrect_answer:\nif(eval(settings[\"correct_answer_expr\"]),0,1)", "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": "if(studentanswer=correct_answer,\n correct(),\n incorrect()\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "studentAnswer=0"}, {"name": "correct_answer", "description": "", "definition": "if(eval(settings[\"correct_answer_expr\"]),0,1)"}], "settings": [{"name": "correct_answer_expr", "label": "Is the answer \"Yes\"?", "help_url": "", "hint": "An expression which evaluates totrue
or false
.", "input_type": "mathematical_expression", "default_value": "true", "subvars": false}], "public_availability": "always", "published": true, "extensions": []}], "resources": []}