// Numbas version: exam_results_page_options {"name": "Centroid of a composite area: rectangles and triangles", "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.

Does clumsy substitution to

\n

1. replace '-' with ' '

\n

2. replace '°' with ' deg'

\n

to allow answers like 10 ft-lb and 30°

", "name": "student_units"}, {"definition": "try(\ncompatible(quantity(1, student_units),correct_units),\nmsg,\nfeedback(msg);false)\n", "description": "", "name": "good_units"}, {"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", "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.

", "name": "student_quantity"}, {"definition": "try(\nscalar(abs((correct_quantity - student_quantity)/correct_quantity))*100 \n,msg,\nif(student_quantity=correct_quantity,0,100))\n ", "description": "", "name": "percent_error"}, {"definition": "percent_error <= settings['right']\n", "description": "", "name": "right"}, {"definition": "right_sign and percent_error <= settings['close']", "description": "

Only marked close if the student actually has the right sign.

", "name": "close"}, {"definition": "sign(student_scalar) = sign(correct_quantity) ", "description": "", "name": "right_sign"}], "settings": [{"input_type": "code", "evaluate": true, "hint": "The correct answer given as a JME quantity.", "default_value": "", "label": "Correct Quantity.", "help_url": "", "name": "correctAnswer"}, {"input_type": "code", "evaluate": true, "hint": "Question will be considered correct if the scalar part of the student's answer is within this % of correct value.", "default_value": "0.2", "label": "% Accuracy for right.", "help_url": "", "name": "right"}, {"input_type": "code", "evaluate": true, "hint": "Question will be considered close if the scalar part of the student's answer is within this % of correct value.", "default_value": "1.0", "label": "% Accuracy for close.", "help_url": "", "name": "close"}, {"input_type": "percent", "hint": "Partial Credit for close value with appropriate units.  if correct answer is 100 N and close is ±1%,
99  N is accepted.", "default_value": "75", "label": "Close with units.", "help_url": "", "name": "C1"}, {"input_type": "percent", "hint": "Partial credit for forgetting units or using wrong sign.
If the correct answer is 100 N, both 100 and -100 N are accepted.", "default_value": "50", "label": "No units or wrong sign", "help_url": "", "name": "C2"}, {"input_type": "percent", "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.", "default_value": "25", "label": "Close, no units.", "help_url": "", "name": "C3"}], "public_availability": "restricted", "published": false, "extensions": ["quantities"]}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"parts": [{"variableReplacements": [], "unitTests": [], "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "prompt": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Part Rectangle Triangle 1 Triangle 2 $\\Sigma$ $A_i$ $\\bar{x}_i$ $\\bar{y}_i$ $A_i\\bar{x}_i$ $A_i\\bar{y}_i$ [[0]] [[4]] [[7]] [[10]] [[13]] [[1]] [[5]] [[8]] [[11]] [[14]] [[2]] [[6]] [[9]] [[12]] [[15]] [[3]] [[16]] \n[[17]]\n

$\\bar{x} =\\dfrac{Q_y}{A} =$ [[0]]  $\\qquad \\bar{y} =\\dfrac{Q_x}{A} =$ [[1]]

", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "sortAnswers": false, "type": "gapfill", "gaps": [{"extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "type": "engineering-answer", "unitTests": [], "variableReplacements": [], "marks": "4", "scripts": {}, "customMarkingAlgorithm": "", "showCorrectAnswer": true, "settings": {"C3": "25", "right": "0.2", "C2": "50", "correctAnswer": "xbar", "close": "1.0", "C1": "75"}, "variableReplacementStrategy": "originalfirst"}, {"extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "type": "engineering-answer", "unitTests": [], "variableReplacements": [], "marks": "4", "scripts": {}, "customMarkingAlgorithm": "", "showCorrectAnswer": true, "settings": {"C3": "25", "right": "0.2", "C2": "50", "correctAnswer": "ybar", "close": "1.0", "C1": "75"}, "variableReplacementStrategy": "originalfirst"}], "marks": 0, "customMarkingAlgorithm": "", "scripts": {}}], "variable_groups": [{"name": "geometry", "variables": ["b0", "h0", "b2", "h1", "b1", "h2", "sign1", "sign2", "A0", "A1", "A2", "AT", "C0", "C2", "C1"]}, {"name": "Unnamed group", "variables": ["xbar", "ybar"]}], "tags": ["centroids", "first moment of area", "mechanics", "statics"], "rulesets": {}, "ungrouped_variables": ["A", "B", "C", "units", "debug"], "statement": "

{geogebra_applet('ftkm8mfx',[['A',A],['B',B],['C',C]])}

\n

Determine the coordinates of the centroid of the polygon shown.  Grid units are [{units}].

\n

Consider the polygon to be made up of a ({b0} $\\times$ {h0}) rectangle {sign1} a ({b1} $\\times$ {h1}) triangle {sign2} a ({b2} $\\times$ {h2}) triangle.

", "variables": {"A": {"name": "A", "definition": "vector(0,random(2..12))", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "C2": {"name": "C2", "definition": "vector(A[0],B[1])+(vector(B[0],A[1])-vector(A[0],B[1]))/3 ", "description": "", "group": "geometry", "templateType": "anything"}, "A0": {"name": "A0", "definition": "b0 h0", "description": "", "group": "geometry", "templateType": "anything"}, "A2": {"name": "A2", "definition": "b2 h2/2 if(sign2='+',1,-1)", "description": "", "group": "geometry", "templateType": "anything"}, "b0": {"name": "b0", "definition": "qty(B[0\n ],units)", "description": "", "group": "geometry", "templateType": "anything"}, "C": {"name": "C", "definition": "vector(random(2..12),0)", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "b2": {"name": "b2", "definition": "b0", "description": "", "group": "geometry", "templateType": "anything"}, "C1": {"name": "C1", "definition": "vector(B[0],C[1])+(vector(C[0],B[1])-vector(B[0],C[1]))/3 ", "description": "", "group": "geometry", "templateType": "anything"}, "A1": {"name": "A1", "definition": "b1 h1 /2 if(sign1='+',1,-1)", "description": "", "group": "geometry", "templateType": "anything"}, "ybar": {"name": "ybar", "definition": "(a0 c0[1] + a1 c1[1] + a2 c2[1])/AT qty(1,units)", "description": "", "group": "Unnamed group", "templateType": "anything"}, "h1": {"name": "h1", "definition": "h0", "description": "", "group": "geometry", "templateType": "anything"}, "B": {"name": "B", "definition": "vector(random(2..12),random(2..12))", "description": "", "group": "Ungrouped variables", "templateType": "anything"}, "h0": {"name": "h0", "definition": "qty(B[1],units)", "description": "", "group": "geometry", "templateType": "anything"}, "sign2": {"name": "sign2", "definition": "if(b[1]A[1] and B[0]<>C[0]", "maxRuns": 100}, "metadata": {"description": "

Find the centroid of a shape made up of a rectangle and two triangles.

", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "preamble": {"js": "", "css": "table.centroid{margin-left:0;}\n\ntable.centroid td {\n width:6em; \n vertical-align:center; \n text-align:center;}\ntable.centroid *.underline {border-bottom: 2px solid black;}\n\n"}, "advice": "
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 Part $A_i$ $\\bar{x}_i$ $\\bar{y}_i$ $A_i\\bar{x}_i$ $A_i\\bar{y}_i$ Rectangle {A0} {bar(C0[0])} {bar(C0[1])} {Q(a0, c0[0])} {Q(a0, c0[1])} Triangle 1 {A1} {bar(C1[0])} {bar(C1[1])} {Q(a1, c1[0])} {Q(a1, c1[1])} Triangle 2 {A2} {bar(C2[0])} {bar(C2[1])} {Q(a2, c2[0])} {Q(a2, c2[1])} $\\Sigma$ {AT} {display(xbar AT)} {display(ybar AT)}
\n
\n
\n

$\\qquad\\bar{x} = \\dfrac{\\Sigma A_i\\bar{x}_i}{\\Sigma A_i} = \\var{display(xbar)}$

\n

$\\qquad \\bar{y} = \\dfrac{\\Sigma A_i\\bar{y}_i}{\\Sigma A_i} =\\var{display(ybar)}$

\n
", "extensions": ["geogebra", "quantities", "weh"], "type": "question", "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/"}]}