// Numbas version: exam_results_page_options {"name": "Friction: Block on Incline", "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

\n

1. replacing \"ohms\" with \"ohm\"  case insensitive

\n

2. replacing '-' with ' ' 

\n

3. replacing '°' with ' deg' 

\n

to 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.  

\n

If student_units are wrong  - replace with correct units

\n

If student_scalar has the wrong sign - replace with right sign

\n

If 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%,
99  N is accepted.", "input_type": "percent", "default_value": "75"}, {"name": "C2", "label": "No units or wrong sign", "help_url": "", "hint": "Partial credit for forgetting units or using wrong sign.
If the correct answer is 100 N, both 100 and -100 N are accepted.", "input_type": "percent", "default_value": "50"}, {"name": "C3", "label": "Close, no units.", "help_url": "", "hint": "Partial Credit for close value but forgotten units.
This value would be close if the expected units were provided.  If the correct answer is 100 N, and close is ±1%,
99 is accepted.", "input_type": "percent", "default_value": "25"}], "public_availability": "always", "published": true, "extensions": ["quantities"]}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Friction: Block on Incline", "tags": ["Equilibrium", "equilibrium", "friction", "Mechanics", "mechanics", "Statics", "statics"], "metadata": {"description": "

Determine frictional force acting on a block on an incline.  Coefficients of friction, weight and a horizontal force are given

", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "

{applet()}

\n

A {qty(P,units[1])} horizontal force $P$ is applied to a {qty(W,units[1])} box resting on an {theta}° incline.  The line of action of $P$ passes through the center of gravity of the box.  The box is  $\\var{qty(WIDTH,units[0])}$ wide $\\times \\ \\var{qty(HEIGHT,units[0]) }$ tall, and the coefficents of friction between the box and the surface are $\\mu_s = \\var{mu_s}$ and $\\mu_k = \\var{mu_k}$.

\n

", "advice": "

Establish a coordinate system parallel and perpendicular to the incline, and draw a free body diagram of the box.  At this point we don't know whether the box is in equilibrium or the direction of the frictional force, so we will provisionally assume that the box is in equilibrium and that the frictional force acts up the incline.  A assumed friction force acting up the incline implies that the box is sliding down the incline.

\n

Calculate the force require to hold the box in equilibrium

\n

$\\begin{align} \\sum F_x &= 0 &\\sum F_y &=0\\\\ F &= -P_x + W_x &  N &= P_y + W_y \\\\& = -P \\cos \\theta + W \\sin \\theta &  &= P \\sin \\theta + W \\cos \\theta\\\\ & = -\\var{P} \\cos \\var{theta}° + \\var{W} \\sin \\var{theta}° & &= \\var{P} \\sin \\var{theta}° + \\var{W} \\cos \\var{theta}°\\\\ &= -\\var{siground(P_x,4)}+\\var{siground(W_x,4)} &&= \\var{siground(P_y,4)} + \\var{siground(W_y,4)} \\\\F &= \\var{siground(qty(F,units[1]),4)} & N &= \\var{siground(qty(N,units[1]),4)} \\end{align}$

\n

Calculate the available frictional force

\n

$F_s = \\mu_s N = (\\var{mu_s})\\ (\\var{siground(N,4)}) = \\var{siground(qty(F_s, units[1]),4)}$

\n

$F_k = \\mu_k N = (\\var{mu_k})\\ (\\var{siground(N,4)}) = \\var{siground(qty(F_k, units[1]),4)}$

\n

Draw Conclusions

\n

Since the absolute value of the required force $F$ is less than the available static friction force $F_s$, the box is in equilibrium. The magnitude of the  actual friction force is $F = \\var{siground(qty(abs(F),units[1]),4)}$.

\n

Since the absolute value of the required force $F$ is equal to the available static friction force $F_s$, the box is in equilibrium, but on the verge of motion. The magnitude of the actual friction force is $F = F_s = \\var{siground(qty(abs(F),units[1]),4)}$.

\n

Since the absolute value of the required force $F$ is greater than the available static friction force $F_s$, the box is sliding. The magnitude of the actual friction force is $F = F_k = \\var{siground(qty(F_k,units[1]),4)}$.

\n

Since the sign on the required frictional force $F$ is negative, the assumption that friction acts up the incline is incorrect.  The actual force acts down the incline, which means that the box being pushed up the incline.

\n

Since the sign on the required frictional force $F$ is positive, the assumed friction direction is correct and the box is sliding down the incline.

\n

Check that no tipping occurs.

\n

The resultant frictional and normal forces can be considered to act at a single point. The location of this point can be found by performing a moment equilibrium about a convenient point.  We choose the center of gravity, where the lines of action of the weight and the load $P$ intersect, and use the actual value of the frictional force, which is $F$ if the box is in equilibrium, $F_k$ if the box is sliding.  If distance $d$ is greater than half the width of the box, it tips.

\n

$\\begin{align} \\sum M_C &= 0\\\\ N(d) &= F(h/2) \\\\ d &= \\frac{F h}{2 N} \\\\ &= \\frac{(\\var{siground(F_actual,4)})( \\var{height})}{(2) (\\var{siground(N,4)})} \\\\ &= \\var{siground(qty(d,units[0]),3)} \\end{align}$

\n

Since $|d| <= \\var{qty(WIDTH/2,units[0])}$, the block is not tipping.

\n

Since $|d| > \\var{qty(WIDTH/2,units[0])}$, the block is tipping.

", "rulesets": {}, "extensions": ["geogebra", "quantities"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"theta": {"name": "theta", "group": "Inputs", "definition": "random(15..35)", "description": "", "templateType": "anything", "can_override": false}, "WIDTH": {"name": "WIDTH", "group": "Inputs", "definition": "random(3..8#0.5)", "description": "", "templateType": "anything", "can_override": false}, "HEIGHT": {"name": "HEIGHT", "group": "Inputs", "definition": "random(2..5#0.5)", "description": "", "templateType": "anything", "can_override": false}, "diag": {"name": "diag", "group": "computed", "definition": "sqrt(HEIGHT^2+WIDTH^2)", "description": "

diagonal of box

", "templateType": "anything", "can_override": false}, "phi": {"name": "phi", "group": "computed", "definition": "degrees(arctan(HEIGHT/WIDTH))", "description": "", "templateType": "anything", "can_override": false}, "mu_s": {"name": "mu_s", "group": "Inputs", "definition": "random(0.1..0.7#0.05)", "description": "", "templateType": "anything", "can_override": false}, "mu_k": {"name": "mu_k", "group": "Inputs", "definition": "siground(mu_s random(0.75..0.9#0.01),2)", "description": "", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "Inputs", "definition": "random([['ft','lb'], ['m','kN']])", "description": "", "templateType": "anything", "can_override": false}, "W": {"name": "W", "group": "Inputs", "definition": "random(20..250#10)", "description": "

magnitude of weight

", "templateType": "anything", "can_override": false}, "P": {"name": "P", "group": "Inputs", "definition": "random(20..400#10)", "description": "

magnitude of horizontal force

", "templateType": "anything", "can_override": false}, "F": {"name": "F", "group": "vector solution", "definition": "dot(F_Q,u)", "description": "", "templateType": "anything", "can_override": false}, "P_x": {"name": "P_x", "group": "computed", "definition": "P cos(radians(theta))", "description": "", "templateType": "anything", "can_override": false}, "P_y": {"name": "P_y", "group": "computed", "definition": "P sin(radians(theta))", "description": "", "templateType": "anything", "can_override": false}, "W_x": {"name": "W_x", "group": "computed", "definition": "W sin(radians(theta))", "description": "", "templateType": "anything", "can_override": false}, "W_y": {"name": "W_y", "group": "computed", "definition": "W cos(radians(theta))", "description": "", "templateType": "anything", "can_override": false}, "N": {"name": "N", "group": "vector solution", "definition": "dot(F_Q,v)", "description": "", "templateType": "anything", "can_override": false}, "F_s": {"name": "F_s", "group": "computed", "definition": "N mu_s", "description": "", "templateType": "anything", "can_override": false}, "F_k": {"name": "F_k", "group": "computed", "definition": "N mu_k", "description": "", "templateType": "anything", "can_override": false}, "u": {"name": "u", "group": "vector solution", "definition": "vector(cos(radians(theta)),sin(radians(theta)))", "description": "", "templateType": "anything", "can_override": false}, "v": {"name": "v", "group": "vector solution", "definition": "vector(-sin(radians(theta)), cos(radians(theta)))", "description": "", "templateType": "anything", "can_override": false}, "ii": {"name": "ii", "group": "vector solution", "definition": "vector(1,0)", "description": "", "templateType": "anything", "can_override": false}, "jj": {"name": "jj", "group": "vector solution", "definition": "vector(0,1)", "description": "", "templateType": "anything", "can_override": false}, "F_Q": {"name": "F_Q", "group": "vector solution", "definition": "-(F_W + F_P)", "description": "

force of incline on block

", "templateType": "anything", "can_override": false}, "F_W": {"name": "F_W", "group": "vector solution", "definition": "-jj W", "description": "", "templateType": "anything", "can_override": false}, "F_P": {"name": "F_P", "group": "vector solution", "definition": "P ii", "description": "", "templateType": "anything", "can_override": false}, "Wx": {"name": "Wx", "group": "vector solution", "definition": "dot(F_W,u)", "description": "", "templateType": "anything", "can_override": false}, "Wy": {"name": "Wy", "group": "vector solution", "definition": "dot(F_W,v)", "description": "", "templateType": "anything", "can_override": false}, "Px": {"name": "Px", "group": "vector solution", "definition": "dot(F_P,u)", "description": "", "templateType": "anything", "can_override": false}, "Py": {"name": "Py", "group": "vector solution", "definition": "dot(F_P,v)", "description": "", "templateType": "anything", "can_override": false}, "d": {"name": "d", "group": "computed", "definition": "F_actual Height/ 2/N", "description": "

distance from center to point A where friction acts.

", "templateType": "anything", "can_override": false}, "F_actual": {"name": "F_actual", "group": "computed", "definition": "if(abs(F) <= F_s, F, F_k)", "description": "", "templateType": "anything", "can_override": false}, "tipping": {"name": "tipping", "group": "conclusions", "definition": "abs(d) > WIDTH/2", "description": "", "templateType": "anything", "can_override": false}, "equilibrium": {"name": "equilibrium", "group": "conclusions", "definition": "abs(F) <= F_s", "description": "", "templateType": "anything", "can_override": false}, "slipping_up": {"name": "slipping_up", "group": "conclusions", "definition": "F<0", "description": "", "templateType": "anything", "can_override": false}, "slipping_down": {"name": "slipping_down", "group": "conclusions", "definition": "F>0", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": " diag/2 sin(radians(theta + phi)) < HEIGHT cos(radians(theta)) // keep P on box\nand diag sin(radians(theta +phi)) < 7 // keep top right corner of box in diagram.\nand (theta + phi) < 80 // keep CG over bottom of box", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [{"name": "computed", "variables": ["diag", "phi", "F", "P_x", "P_y", "W_x", "W_y", "N", "F_s", "F_k", "d", "F_actual"]}, {"name": "Inputs", "variables": ["theta", "HEIGHT", "WIDTH", "mu_s", "mu_k", "units", "W", "P"]}, {"name": "vector solution", "variables": ["u", "v", "ii", "jj", "F_Q", "N", "F_W", "F_P", "F", "Wx", "Wy", "Px", "Py"]}, {"name": "conclusions", "variables": ["tipping", "equilibrium", "slipping_up", "slipping_down"]}], "functions": {"applet": {"parameters": [], "type": "ggbapplet", "language": "javascript", "definition": "//{geogebra_applet('mgahtzn8', [ 'H':[ definition: HEIGHT, visible: false], 'W':[ definition: WIDTH, visible: false],'\u03b8': [definition: radians(THETA), visible: false], 'show': [definition: \"false\" , visible: false] ])}\n\n\n// Create the worksheet. \n// This function returns an object with a container `element` and a `promise` resolving to a GeoGebra applet.\nvar params = {\n material_id: 'mgahtzn8'\n}\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 \nfunction setGGBNumber(g_name, n_name = g_name) {\n // Sets number in GGB to a Numbas Variable\n var n = scope.getVariable(n_name).value;\n app.setValue(g_name,n);\n app.setVisible(g_name,false);\n }\n \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 \n //initialize the dimensions and forces\n setGGBNumber('H','HEIGHT');\n setGGBNumber('W','WIDTH');\n setGGBAngle('\u03b8', 'THETA');\n app.setValue('show',\"false\");\n app.setVisible('H',false,false);\n app.setVisible('W',false,false);\n app.setVisible('\u03b8',false,false);\n app.setVisible('show',false,false);\n \n \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": "question.signals.on('adviceDisplayed',function() {\n try{\n var app = question.applet.app;\n \n app.setVisible('show', true);\n app.setValue('show',true);\n \n }\n catch(err){} \n})\n\n\n", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Determine the magnitude of the friction force acting on the box.

\n

$F$ = [[0]]

\n

The box is [[1]]

", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "Friction", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "qty(F_actual,units[1])", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}, {"type": "1_n_2", "useCustomName": true, "customName": "Direction", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "radiogroup", "displayColumns": 0, "showCellAnswerState": true, "choices": ["In static equilibrium", "Sliding up the incline", "Sliding down the incline.", "Tipping"], "matrix": ["if(equilibrium,10,0)", "if(slipping_up,10,0)", "if(slipping_down,10,0)", "if(tipping,10,0)"], "distractors": ["", "", "", ""]}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "William Haynes", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2530/"}]}]}], "contributors": [{"name": "William Haynes", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2530/"}]}