// Numbas version: finer_feedback_settings {"name": "TEST UNIT 1 Intro to Matrices and Vectors", "metadata": {"description": "
Assessment of NCDCS Unit 1 material.
", "licence": "Creative Commons Attribution-NonCommercial-NoDerivs 4.0 International"}, "duration": 5400, "percentPass": "80", "showQuestionGroupNames": false, "showstudentname": true, "question_groups": [{"name": "Group", "pickingStrategy": "all-shuffled", "pickQuestions": 1, "questionNames": ["", "", "", "", "", "", "", "", ""], "questions": [{"name": "Terry's copy of Can you add these matrices?", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Terry Young", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3130/"}, {"name": "Julia Goedecke", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5121/"}], "tags": [], "metadata": {"description": "Decide if matrix sizes match so they can be added.
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "Decide if the following matrices can be added or not.
", "advice": "We can add matrices of the same size. That means they have to have the same number of rows and the same number of columns.
\nBoth matrices have size \\(\\var{m1}\\times \\var{n1}\\), so we can add them. The matrices have the same number of columns, but not the same number of rows. So we cannot add them. The matrices have the same number or rows, but not the same number of columns. So we cannot add them. The matrices have different sizes, so we cannot add them.
", "rulesets": {}, "variables": {"m1": {"name": "m1", "group": "Ungrouped variables", "definition": "random(1..5)", "description": "number of rows of first matrix
", "templateType": "anything"}, "m2": {"name": "m2", "group": "Ungrouped variables", "definition": "switch(d=1,m1,d=2,random(1..5 except m1),d=3,m1,d=4,random(1..5 except m1),m1)", "description": "number of rows of second matrix, sometimes the same sometimes different to the first matrix, depending on d
", "templateType": "anything"}, "d": {"name": "d", "group": "Ungrouped variables", "definition": "random(1..4)", "description": "determines the case
", "templateType": "anything"}, "n1": {"name": "n1", "group": "Ungrouped variables", "definition": "random(1..5)", "description": "number of columns of first matrix
", "templateType": "anything"}, "n2": {"name": "n2", "group": "Ungrouped variables", "definition": "switch(d=1,n1,d=2,n1,d=3,random(1..5 except n1),d=4,random(1..5 except n1),n1)", "description": "number of rows of second matrix, sometimes the same sometimes different to the first matrix, depending on d
", "templateType": "anything"}, "A": {"name": "A", "group": "Ungrouped variables", "definition": "matrix(repeat(repeat(random(-10..10),n1),m1))", "description": "", "templateType": "anything"}, "B": {"name": "B", "group": "Ungrouped variables", "definition": "matrix(repeat(repeat(random(-10..10),n2),m2))", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["m1", "m2", "n1", "n2", "d", "A", "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": "\\(\\var{A}+\\var{B}\\)
\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": 0, "showCellAnswerState": true, "choices": ["can add", "cannot add"], "matrix": "switch(d=1,[1,0],d<>1,[0,1],[1,0])"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Terry's copy of Matrix Arithmetics", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Marie Nicholson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1799/"}, {"name": "Terry Young", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3130/"}, {"name": "Timur Zaripov", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3272/"}], "tags": [], "metadata": {"description": "Addition, subtraction and multiplication by a scalar for 2 x 2 matrices.
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "Find the answers to the following matrix calculations, filling in your answers in the spaces provided.
", "advice": "(a)
\n$\\var{a}+\\var{b}=\\var{u}$
\nJust add corresponding elements together.
\n(b)
\n$\\var{p}\\var{c}-\\var{q}\\var{d}$
\nMultiply each element of the first matrix by $\\var{p}$...
\n$\\var{p}\\var{c}=\\var{pc}$
\n...and multiply each element of the second matrix by $\\var{q}$.
$\\var{q}\\var{d}=\\var{qd}$
\nFinally, subtract corresponding elements
\n$\\var{p}\\var{c}-\\var{q}\\var{d}=\\var{pc}-\\var{qd}=\\var{v}$
", "rulesets": {"ruleset0": []}, "variables": {"at": {"name": "at", "group": "Ungrouped variables", "definition": "transpose(a)", "description": "", "templateType": "anything"}, "a12": {"name": "a12", "group": "Ungrouped variables", "definition": "random(-10..10#1)", "description": "", "templateType": "anything"}, "ans": {"name": "ans", "group": "Ungrouped variables", "definition": "a+b", "description": "", "templateType": "anything"}, "a11": {"name": "a11", "group": "Ungrouped variables", "definition": "random(-10..10#1)", "description": "", "templateType": "anything"}, "c21": {"name": "c21", "group": "Ungrouped variables", "definition": "random(-10..10#1)", "description": "", "templateType": "anything"}, "bat": {"name": "bat", "group": "Ungrouped variables", "definition": "b*at", "description": "", "templateType": "anything"}, "b22": {"name": "b22", "group": "Ungrouped variables", "definition": "random(-10..10#1)", "description": "", "templateType": "anything"}, "p": {"name": "p", "group": "Ungrouped variables", "definition": "random(-10..10#1 except 0 except 1 except q)", "description": "", "templateType": "anything"}, "deta": {"name": "deta", "group": "Ungrouped variables", "definition": "det(a)", "description": "", "templateType": "anything"}, "v": {"name": "v", "group": "Ungrouped variables", "definition": "pc-qd", "description": "", "templateType": "anything"}, "a22": {"name": "a22", "group": "Ungrouped variables", "definition": "if(test*a11=a21*a12,test+1,test)", "description": "", "templateType": "anything"}, "a21": {"name": "a21", "group": "Ungrouped variables", "definition": "random(-10..10#1)", "description": "", "templateType": "anything"}, "u": {"name": "u", "group": "Ungrouped variables", "definition": "a+b", "description": "", "templateType": "anything"}, "d21": {"name": "d21", "group": "Ungrouped variables", "definition": "random(-10..10#1)", "description": "", "templateType": "anything"}, "test": {"name": "test", "group": "Ungrouped variables", "definition": "random(-10..10#1)", "description": "", "templateType": "anything"}, "c12": {"name": "c12", "group": "Ungrouped variables", "definition": "random(-10..10#1)", "description": "", "templateType": "anything"}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "matrix([b11,b12],[b21,b22])", "description": "", "templateType": "anything"}, "q": {"name": "q", "group": "Ungrouped variables", "definition": "random(2..10#1)", "description": "", "templateType": "anything"}, "d": {"name": "d", "group": "Ungrouped variables", "definition": "matrix([d11,d12],[d21,d22])", "description": "", "templateType": "anything"}, "det": {"name": "det", "group": "Ungrouped variables", "definition": "a11*a22-a21*a12", "description": "", "templateType": "anything"}, "b11": {"name": "b11", "group": "Ungrouped variables", "definition": "random(-10..10#1)", "description": "", "templateType": "anything"}, "qd": {"name": "qd", "group": "Ungrouped variables", "definition": "q*d", "description": "", "templateType": "anything"}, "d12": {"name": "d12", "group": "Ungrouped variables", "definition": "random(-10..10#1)", "description": "", "templateType": "anything"}, "b21": {"name": "b21", "group": "Ungrouped variables", "definition": "random(-10..10#1)", "description": "", "templateType": "anything"}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "matrix([a11,a12],[a21,a22])", "description": "", "templateType": "anything"}, "c11": {"name": "c11", "group": "Ungrouped variables", "definition": "random(-10..10#1)", "description": "", "templateType": "anything"}, "b12": {"name": "b12", "group": "Ungrouped variables", "definition": "random(-10..10#1)", "description": "", "templateType": "anything"}, "adj": {"name": "adj", "group": "Ungrouped variables", "definition": "matrix([a22,-a12],[-a21,a11])", "description": "", "templateType": "anything"}, "d11": {"name": "d11", "group": "Ungrouped variables", "definition": "random(-10..10#1)", "description": "", "templateType": "anything"}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "matrix([c11,c12],[c21,c22])", "description": "", "templateType": "anything"}, "c22": {"name": "c22", "group": "Ungrouped variables", "definition": "random(-10..10#1)", "description": "", "templateType": "anything"}, "d22": {"name": "d22", "group": "Ungrouped variables", "definition": "random(-10..10#1)", "description": "", "templateType": "anything"}, "ans2": {"name": "ans2", "group": "Ungrouped variables", "definition": "c-d", "description": "", "templateType": "anything"}, "pc": {"name": "pc", "group": "Ungrouped variables", "definition": "p*c", "description": "", "templateType": "anything"}, "ab": {"name": "ab", "group": "Ungrouped variables", "definition": "a*b", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["a21", "a22", "ab", "ans2", "b22", "b21", "at", "ans", "d11", "d12", "p", "pc", "b12", "b11", "test", "c12", "c11", "adj", "a", "a11", "a12", "c", "b", "c22", "bat", "c21", "d", "deta", "d22", "det", "q", "d21", "u", "qd", "v"], "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": "$\\var{a}+\\var{b}=$[[0]]
\n\n\n", "gaps": [{"type": "matrix", "useCustomName": true, "customName": "a+b", "marks": "4", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "correctAnswer": "{a}+{b}", "correctAnswerFractions": false, "numRows": "2", "numColumns": "2", "allowResize": false, "tolerance": 0, "markPerCell": true, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0}], "sortAnswers": false}, {"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": "$\\var{p}\\var{c}-\\var{q}\\var{d}=$[[0]]
\n", "gaps": [{"type": "matrix", "useCustomName": true, "customName": "p*c-qd", "marks": "4", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "correctAnswer": "{p}*{c}-{q}*{d}", "correctAnswerFractions": false, "numRows": "2", "numColumns": "2", "allowResize": false, "tolerance": 0, "markPerCell": false, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Terry's copy of Matrix multiplication with an indeterminate (WBQ1.35)", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Terry Young", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3130/"}, {"name": "Julia Goedecke", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5121/"}], "tags": ["indeterminate", "matrix multiplication"], "metadata": {"description": "Use matrix multiplication to get an equation for \\(k\\) which is then to be solved.
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "", "advice": "We have
\n\\(\\begin{pmatrix} k & 1 &1\\end{pmatrix}\\var{A}\\begin{pmatrix}k\\\\1\\\\1\\end{pmatrix}= \\begin{pmatrix} k & 1 &1\\end{pmatrix}\\begin{pmatrix}k+1\\\\k+2\\\\-1\\end{pmatrix}\\)
\n\\(=k(k+1)+k+2-1=k^2+2k+1=(k+1)^2\\).
\nSo this is zero when \\(k=-1\\).
", "rulesets": {}, "variables": {"A": {"name": "A", "group": "Ungrouped variables", "definition": " matrix([[1,1,0],[1,0,2],[0,2,-3]])", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["A"], "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": [{"label": "Show some steps", "rawLabel": "Show some steps", "otherPart": 1, "variableReplacements": [], "availabilityCondition": "not (answered and credit=1)", "penalty": "", "penaltyAmount": 0, "lockAfterLeaving": false}], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "For which \\(k\\) is
\n\\(\\begin{pmatrix} k & 1 &1\\end{pmatrix}\\var{A}\\begin{pmatrix}k\\\\1\\\\1\\end{pmatrix}=0\\)?
\n\\(k= \\)[[0]]
", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "3", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Everything together", "minValue": "-1", "maxValue": "-1", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "Steps", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Calculate the matrix multiplication in two steps:
\n\\(\\var{A}\\begin{pmatrix}k\\\\1\\\\1\\end{pmatrix} = \\left(\\begin{matrix}\\phantom{.}\\\\\\phantom{.}\\\\\\phantom{.}\\\\\\phantom{.}\\end{matrix}\\right.\\) | \n[[0]] | \n\\(\\left.\\begin{matrix}\\phantom{.}\\\\\\phantom{.}\\\\\\phantom{.}\\\\\\phantom{.}\\end{matrix}\\right)\\) | \n
[[1]] | \n||
[[2]] | \n
Then calculate \\(\\begin{pmatrix} k & 1 &1\\end{pmatrix} \\) times your answer, to get: [[3]]
\nNow set this expression \\(=0\\) and resolve for \\(k\\). \\(k= \\)[[4]]
", "gaps": [{"type": "jme", "useCustomName": true, "customName": "Entry 1", "marks": "0.5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Matrix multiplication", "answer": "k+1", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "valuegenerators": [{"name": "k", "value": ""}]}, {"type": "jme", "useCustomName": true, "customName": "Entry 2", "marks": "0.5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Matrix multiplication", "answer": "k+2", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "valuegenerators": [{"name": "k", "value": ""}]}, {"type": "jme", "useCustomName": true, "customName": "Entry 3", "marks": "0.5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Matrix multiplication", "answer": "-1", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "valuegenerators": []}, {"type": "jme", "useCustomName": true, "customName": "Final matrix product", "marks": "0.5", "scripts": {}, "customMarkingAlgorithm": "failMatchPattern (Does the student's answer not match the required pattern?):\n assert(settings[\"mustMatchPattern\"]=\"\",\n assert(matches(studentExpr,settings[\"mustMatchPattern\"]),\n if(compareName=\"\",\n multiply_credit(settings[\"mustMatchPC\"], settings[\"mustMatchMessage\"])\n ,\n set_credit(0,settings[\"mustMatchMessage\"])\n );\n warn(settings[\"mustMatchMessage\"]);\n fail(settings[\"mustMatchMessage\"]);\n true\n )\n )", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Matrix multiplication", "answer": "k^2+2k+1", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "mustmatchpattern": {"pattern": "k^2+2k+1`|(k+1)^2", "partialCredit": "100", "message": "Not simplified", "nameToCompare": ""}, "valuegenerators": [{"name": "k", "value": ""}]}, {"type": "numberentry", "useCustomName": true, "customName": "k", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Solve for k", "minValue": "-1", "maxValue": "-1", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "explore", "maxMarks": "3", "objectives": [{"name": "Matrix multiplication", "limit": "2", "mode": "sum"}, {"name": "Solve for k", "limit": "1", "mode": "sum"}, {"name": "Everything together", "limit": "3", "mode": "sum"}], "penalties": [], "objectiveVisibility": "when-active", "penaltyVisibility": "always", "type": "question"}, {"name": "Terry's copy of Matrix times vector (WBQ 1.27 randomized)", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Terry Young", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3130/"}, {"name": "Julia Goedecke", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5121/"}], "tags": ["linear map", "matrix multiplication", "matrix times vector", "matrix transformation"], "metadata": {"description": "Calculate matrix times vector.
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "Calculate the following:
", "advice": "To calculate matrix times vector, we calculate this row by row: the first entry of the resulting vector is \"row 1 of the matrix times the vector\". For example
\n\\[\\begin{pmatrix} a_{11} & a_{12} \\\\ a_{21} & a_{22}\\end{pmatrix} \\begin{pmatrix}x_1\\\\x_2\\end{pmatrix}= \\begin{pmatrix} a_{11}x_1+a_{12}x_2 \\\\ a_{21}x_1+a_{22}x_2\\end{pmatrix}\\]
\n\\(\\var{A}\\var{va}=\\var{unresolvedAva}=\\var{A*va}\\)
", "rulesets": {}, "variables": {"A": {"name": "A", "group": "Ungrouped variables", "definition": "matrix(repeat(repeat(random(-3..3),n),m))", "description": "", "templateType": "anything"}, "va": {"name": "va", "group": "Ungrouped variables", "definition": "vector(repeat(random(-2..2),n))", "description": "", "templateType": "anything"}, "rawunresolvedAva": {"name": "rawunresolvedAva", "group": "Ungrouped variables", "definition": "map(if({A[k][l]<0,'({A[k][l]})','{A[k][l]}')+'\\\\cdot'+if(va[l]<0,'({va[l]})','{va[l]}')+symbols(m,n)[k][l],[k,l],product(0..m-1,0..n-1))", "description": "collects the terms \\(a_{ij}\\cdot v_j\\) for the matrix times vector multiplication, with plus symbols or new line concatenated ready to put into latex code for the calulcation steps of the matrix.
\nAll the \"if\" things are to put brackets round negative numbers. not using simplify because i prefer \\(\\cdot\\) to \\(\\times\\).
\nWithout the need for brackets, it could just be map('{A[k][l]}\\\\cdot{va[l]}'+symbols(2,2)[k][l],[k,l],product(0..1,0..1))
\nThe \"symbols\" is a function giving the correct addition or new line symbols for the size of the matrix that is being used.
", "templateType": "anything"}, "unresolvedAva": {"name": "unresolvedAva", "group": "Ungrouped variables", "definition": "latex('\\\\begin{pmatrix}'+ concatstrings(rawunresolvedAva) +'\\\\end{'+'pmatrix}')", "description": "for the solution, the calculation steps written out unresolved.
", "templateType": "anything"}, "m": {"name": "m", "group": "Ungrouped variables", "definition": "random(2..4)", "description": "", "templateType": "anything"}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "random(2..4)", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["A", "va", "rawunresolvedAva", "unresolvedAva", "m", "n"], "variable_groups": [], "functions": {"concatstrings": {"parameters": [["input", "list"]], "type": "string", "language": "javascript", "definition": "var output = '';\nvar i;\nfor (i = 0; i < input.length; i++) {\n output += input[i];\n} \nreturn output;"}, "symbols": {"parameters": [["m", "number"], ["n", "number"]], "type": "list", "language": "jme", "definition": "repeat(repeat('+',n-1)+['\\\\\\\\'],m-1)+[repeat('+',n-1)+['']]"}}, "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": "\\(\\var{A}\\var{va}= \\) [[0]]
", "gaps": [{"type": "matrix", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "correctAnswer": "A*va", "correctAnswerFractions": false, "numRows": 1, "numColumns": 1, "allowResize": true, "tolerance": 0, "markPerCell": true, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Vector Notation", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Terry Young", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3130/"}], "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution-NonCommercial-NoDerivs 4.0 International"}, "statement": "GIVEN: $ \\overrightarrow{V} = \\simplify{ {vx} hat:i + {vy} hat:j } $
", "advice": "", "rulesets": {}, "variables": {"vx": {"name": "vx", "group": "Ungrouped variables", "definition": "random(-50..50 except 0)\n", "description": "", "templateType": "anything"}, "vy": {"name": "vy", "group": "Ungrouped variables", "definition": "random(-50..50 except 0)", "description": "", "templateType": "anything"}, "magV": {"name": "magV", "group": "Ungrouped variables", "definition": "sqrt(vx^2 + vy^2)", "description": "", "templateType": "anything"}, "dirV": {"name": "dirV", "group": "Ungrouped variables", "definition": "angle(vector(1,0),vector(vx,vy))*180/pi", "description": "As measured from the positive x-axis
", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["vx", "vy", "magV", "dirV"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Find $\\overrightarrow{V_{x}}$
", "minValue": "vx", "maxValue": "vx", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Find $\\overrightarrow{V_{y}}$
", "minValue": "vy", "maxValue": "vy", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "patternmatch", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Write the vector in bracket notation, e.g. <3,4>, with no spaces.
", "answer": "<{vx},{vy}>", "displayAnswer": "", "matchMode": "exact"}, {"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": "Write $\\overrightarrow{V}$ in \"column matrix\" form: $ \\simplify{ vector(m,n) } $
\n$m = $ [[0]]
\n$n = $ [[1]]
", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "vx", "maxValue": "vx", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "vy", "maxValue": "vy", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Vector Addition from different forms", "extensions": ["geogebra"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Terry Young", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3130/"}], "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution-NonCommercial-NoDerivs 4.0 International"}, "statement": "GIVEN: $\\overrightarrow{A} = <\\var{Ax}, \\var{Ay}>$,$ \\overrightarrow{B} = \\simplify{ {Bx} hat:i + {By} hat:j } $ and $\\overrightarrow{C}$ as graphed below:
{geogebra_applet('https://www.geogebra.org/m/qfarnu2z',defs)}
\n\nFIND: The resultant vector, $\\overrightarrow{R} = \\overrightarrow{A} + \\overrightarrow{B} + \\overrightarrow{C}$
", "advice": "", "rulesets": {}, "variables": {"Ax": {"name": "Ax", "group": "Ungrouped variables", "definition": "random(-10..10 except 0)", "description": "", "templateType": "anything"}, "Ay": {"name": "Ay", "group": "Ungrouped variables", "definition": "random(-15..15 except [0,Ax])", "description": "", "templateType": "anything"}, "Bx": {"name": "Bx", "group": "Ungrouped variables", "definition": "random(-5..5 except 0)", "description": "", "templateType": "anything"}, "By": {"name": "By", "group": "Ungrouped variables", "definition": "random(-5..5 except [0,Bx])", "description": "", "templateType": "anything"}, "Cx": {"name": "Cx", "group": "Ungrouped variables", "definition": "random(-15..15 except 0)", "description": "", "templateType": "anything"}, "Cy": {"name": "Cy", "group": "Ungrouped variables", "definition": "random(-15..10 except [0,Cx])", "description": "", "templateType": "anything"}, "Rx": {"name": "Rx", "group": "Ungrouped variables", "definition": "Ax+Bx+Cx", "description": "", "templateType": "anything"}, "Ry": {"name": "Ry", "group": "Ungrouped variables", "definition": "Ay+By+Cy", "description": "", "templateType": "anything"}, "defs": {"name": "defs", "group": "Ungrouped variables", "definition": "['P':P ]", "description": "", "templateType": "anything"}, "P": {"name": "P", "group": "Ungrouped variables", "definition": "Vector(Cx,Cy)", "description": "", "templateType": "anything"}, "magR": {"name": "magR", "group": "Ungrouped variables", "definition": "sqrt(Rx^2 + Ry^2)", "description": "", "templateType": "anything"}, "refthetaR": {"name": "refthetaR", "group": "Ungrouped variables", "definition": "arctan(abs(Ry/Rx))*180/pi", "description": "", "templateType": "anything"}, "signRx": {"name": "signRx", "group": "Ungrouped variables", "definition": "sign(Rx)", "description": "", "templateType": "anything"}, "signRy": {"name": "signRy", "group": "Ungrouped variables", "definition": "sign(Ry)", "description": "", "templateType": "anything"}, "thetaR": {"name": "thetaR", "group": "Ungrouped variables", "definition": "(abs(180*(1-signRx)/2-refthetaR))*signRy", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["Ax", "Ay", "Bx", "By", "Cx", "Cy", "Rx", "Ry", "defs", "P", "magR", "refthetaR", "signRx", "signRy", "thetaR"], "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": "$\\overrightarrow{R} =$ [[0]]$\\hat{i} +$ [[1]]$\\hat{j}$
", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "Rx", "maxValue": "Rx", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "Ry", "maxValue": "Ry", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"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": "$|\\overrightarrow{R}| = $[[0]]
", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "magnitudeR", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "magR", "maxValue": "magR", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "3", "precisionPartialCredit": "80", "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"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": "Direction of $\\overrightarrow{R}$ is $\\theta_{R} = $[[0]]
", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "thetaR", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "thetaR", "maxValue": "thetaR", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "3", "precisionPartialCredit": "80", "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Find magnitude and direction of three vectors", "extensions": ["geogebra", "quantities", "weh"], "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%,Given three vectors with integer components, find the corresponding magnitude and direction.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "Three forces, A, B, and C are drawn to scale of 1 square = {scale} {units[1]}. Find the magnitude and direction of each.
\n{geogebra_applet('qdbwtfa9', [['fa',FA],['fb',FB],['fc',FC]])}
\n", "advice": "For force $\\textbf{A}$
\n$A = \\sqrt{{A_x}^2 + {A_y}^2} = \\sqrt{\\var{FA[0]}^2 +\\var{FA[1]}^2}$ = {siground(mag_A,4)}
\n$\\theta_A = \\tan^{-1}\\left(\\left|\\dfrac{A_y}{A_x}\\right|\\right) = \\tan^{-1}\\left(\\left|\\dfrac{\\var{FA[1]}}{\\var{FA[0]}}\\right|\\right) =\\var{siground(degrees(arctan(abs(FA[1]/FA[0]))),4)}°$
\nand similarly for $\\textbf{B}$ and $\\textbf{C}$.
", "rulesets": {}, "variables": {"FC": {"name": "FC", "group": "Inputs", "definition": "vector(random(-5..5 except 0),random(-5..5 except 0))", "description": "", "templateType": "anything"}, "scale": {"name": "scale", "group": "Inputs", "definition": "random(0.1,0.25,0.5,2,4,5,10,20)", "description": "", "templateType": "anything"}, "ref": {"name": "ref", "group": "Ungrouped variables", "definition": "0", "description": "placeholder for reference axis
", "templateType": "anything"}, "theta_b": {"name": "theta_b", "group": "Outputs", "definition": "degrees(atan2(FB[1],FB[0]))", "description": "", "templateType": "anything"}, "c_from_ref": {"name": "c_from_ref", "group": "Ungrouped variables", "definition": "let(ang,theta_c,\n[if(ang>180,ang-360,ang),\nif(ang>270,ang-450,if(ang < -90,ang+270,ang-90)),\nif(ang>0,ang-180,ang+180),\nif(ang>90,ang-270,90+ang)])\n", "description": "", "templateType": "anything"}, "theta_a": {"name": "theta_a", "group": "Outputs", "definition": "mod(degrees(atan2(FA[1],FA[0])),360)", "description": "", "templateType": "anything"}, "C1": {"name": "C1", "group": "Inputs", "definition": "vector(5,0)\n", "description": "Position of point C
", "templateType": "anything"}, "b_from_ref": {"name": "b_from_ref", "group": "Ungrouped variables", "definition": "let(ang,theta_b,\n[if(ang>180,ang-360,ang),\nif(ang>270,ang-450,if(ang < -90,ang+270,ang-90)),\nif(ang>0,ang-180,ang+180),\nif(ang>90,ang-270,90+ang)])\n", "description": "", "templateType": "anything"}, "A1": {"name": "A1", "group": "Inputs", "definition": "vector(-5,0)", "description": "Position of point A (start point for force A) fixed in this problem
", "templateType": "anything"}, "mag_c": {"name": "mag_c", "group": "Outputs", "definition": "qty(abs(FC),units[1]) scale", "description": "", "templateType": "anything"}, "mag_a": {"name": "mag_a", "group": "Outputs", "definition": "qty(abs(FA),units[1]) scale", "description": "", "templateType": "anything"}, "debug": {"name": "debug", "group": "Inputs", "definition": "false", "description": "", "templateType": "anything"}, "theta_c": {"name": "theta_c", "group": "Outputs", "definition": "degrees(atan2(FC[1],FC[0]))", "description": "", "templateType": "anything"}, "a_from_ref": {"name": "a_from_ref", "group": "Ungrouped variables", "definition": "let(ang,theta_a,\n[if(ang>180,ang-360,ang),\nif(ang>270,ang-450,if(ang < -90,ang+270,ang-90)),\nif(ang>0,ang-180,ang+180),\nif(ang>90,ang-270,90+ang)])", "description": "", "templateType": "anything"}, "units": {"name": "units", "group": "Inputs", "definition": "random(['ft','lb'],['in','lb'],['cm','N'])", "description": "", "templateType": "anything"}, "FA": {"name": "FA", "group": "Inputs", "definition": "vector(random(-5..5 except 0),random(-5..5))", "description": "", "templateType": "anything"}, "FB": {"name": "FB", "group": "Inputs", "definition": "vector(random(-5..5),random(-5..5 except 0))", "description": "", "templateType": "anything"}, "mag_b": {"name": "mag_b", "group": "Outputs", "definition": "qty(abs(FB),units[1]) scale", "description": "", "templateType": "anything"}, "B1": {"name": "B1", "group": "Inputs", "definition": "vector(0,0)\n", "description": "Position of point B
", "templateType": "anything"}}, "variablesTest": {"condition": "abs(FA)>=3 and abs(FB)>=3 and abs(FC)>=3", "maxRuns": "100"}, "ungrouped_variables": ["a_from_ref", "b_from_ref", "c_from_ref", "ref"], "variable_groups": [{"name": "Inputs", "variables": ["A1", "FA", "B1", "FB", "C1", "FC", "units", "debug", "scale"]}, {"name": "Outputs", "variables": ["mag_a", "theta_a", "mag_b", "theta_b", "mag_c", "theta_c"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Force A", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "interpreted_angle: // a qty string corrected to standard angle\n student_angle[2] + student_angle[1] * student_angle[0] + student_units\n\nmagnitude:\n studentAnswer[3]\n\nstudent_angle:\n [mod(matchnumber(studentAnswer[0],['plain','en'])[1],360), // angle\n [1,-1][indices(studentAnswer[1],[true])[0]], // ccw = 1 cw = -1\n [0,90,180,-90][indices(studentAnswer[2],[true])[0]]] // reference axis\n\nstudent_units:\n studentAnswer[0][len(matchnumber(studentAnswer[0],['plain','en'])[0])..len(studentAnswer[0])]\n\ninterpreted_answers:\n [interpreted_angle, studentAnswer[1], studentAnswer[2], studentAnswer[3]]\n\ngap_feedback (Feedback on each of the gaps):\n map(\n try(\n let(\n result, submit_part(gaps[gap_number][\"path\"],answer),\n gap, gaps[gap_number],\n name, gap[\"name\"], \n noFeedbackIcon, not gap[\"settings\"][\"showFeedbackIcon\"],\n assert(name=\"\" or len(gaps)=1,feedback(translate('part.gapfill.feedback header',[\"name\": name])));\n concat_feedback(filter(x[\"op\"]<>\"warning\",x,result[\"feedback\"]), if(marks>0,result[\"marks\"]/marks,1), noFeedbackIcon);\n result\n ),\n err,\n fail(translate(\"part.gapfill.error marking gap\",[\"name\": gaps[gap_number][\"name\"], \"message\": err]))\n ),\n [gap_number,answer,index],\n zip([3,0],[studentAnswer[3], interpreted_angle],[1,2])\n )\n\n", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Find the magnitude and direction of A.
\n$A$ = [[3]]
\n$\\theta_A$ = [[0]] measured [[1]] from the [[2]].
\nmagnitude = {siground(mag_A,4)}
\ndirection={theta_A}
", "gaps": [{"type": "angle", "useCustomName": true, "customName": "angle", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"expected_answer": "qty(theta_a,'deg')", "unit_penalty": "20", "close_penalty": "20", "close_tol": "0.5", "right_tol": "0.2"}}, {"type": "1_n_2", "useCustomName": true, "customName": "dir", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["CCW", "CW"], "matrix": [0, 0], "distractors": ["", ""]}, {"type": "1_n_2", "useCustomName": true, "customName": "ref", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["+x axis", "+y axis", "-x axis", "-y axis"], "matrix": [0, 0, 0, 0], "distractors": ["", "", "", ""]}, {"type": "engineering-answer", "useCustomName": true, "customName": "Magnitude", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "mag_A", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "Force B", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "interpreted_angle: // a qty string corrected to standard angle\n student_angle[2] + student_angle[1] * student_angle[0] + student_units\n\nmagnitude:\n studentAnswer[3]\n\nstudent_angle:\n [mod(matchnumber(studentAnswer[0],['plain','en'])[1],360), // angle\n [1,-1][indices(studentAnswer[1],[true])[0]], // ccw = 1 cw = -1\n [0,90,180,-90][indices(studentAnswer[2],[true])[0]]] // reference axis\n\nstudent_units:\n studentAnswer[0][len(matchnumber(studentAnswer[0],['plain','en'])[0])..len(studentAnswer[0])]\n\ninterpreted_answers:\n [interpreted_angle, studentAnswer[1], studentAnswer[2], studentAnswer[3]]\n\ngap_feedback (Feedback on each of the gaps):\n map(\n try(\n let(\n result, submit_part(gaps[gap_number][\"path\"],answer),\n gap, gaps[gap_number],\n name, gap[\"name\"], \n noFeedbackIcon, not gap[\"settings\"][\"showFeedbackIcon\"],\n assert(name=\"\" or len(gaps)=1,feedback(translate('part.gapfill.feedback header',[\"name\": name])));\n concat_feedback(filter(x[\"op\"]<>\"warning\",x,result[\"feedback\"]), if(marks>0,result[\"marks\"]/marks,1), noFeedbackIcon);\n result\n ),\n err,\n fail(translate(\"part.gapfill.error marking gap\",[\"name\": gaps[gap_number][\"name\"], \"message\": err]))\n ),\n [gap_number,answer,index],\n zip([3,0],[studentAnswer[3], interpreted_angle],[1,2])\n )\n\n", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "\nFind the magnitude and direction of B.
\n$B$ = [[3]]
\n$\\theta_B$ = [[0]] measured [[1]] from the [[2]].
\nmagnitude = {siground(mag_B,4)}
\ndirection={theta_B}
", "gaps": [{"type": "angle", "useCustomName": true, "customName": "angle", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"expected_answer": "qty(theta_b,'deg')", "unit_penalty": "20", "close_penalty": "20", "close_tol": "0.5", "right_tol": "0.2"}}, {"type": "1_n_2", "useCustomName": true, "customName": "dir", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["CCW", "CW"], "matrix": [0, 0], "distractors": ["", ""]}, {"type": "1_n_2", "useCustomName": true, "customName": "ref", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["+x axis", "+y axis", "-x axis", "-y axis"], "matrix": [0, 0, 0, 0], "distractors": ["", "", "", ""]}, {"type": "engineering-answer", "useCustomName": true, "customName": "Magnitude", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "mag_B", "right": "0.2", "close": "1.0", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "Force C", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "interpreted_angle: // a qty string corrected to standard angle\n student_angle[2] + student_angle[1] * student_angle[0] + student_units\n\nmagnitude:\n studentAnswer[3]\n\nstudent_angle:\n [mod(matchnumber(studentAnswer[0],['plain','en'])[1],360), // angle\n [1,-1][indices(studentAnswer[1],[true])[0]], // ccw = 1 cw = -1\n [0,90,180,-90][indices(studentAnswer[2],[true])[0]]] // reference axis\n\nstudent_units:\n studentAnswer[0][len(matchnumber(studentAnswer[0],['plain','en'])[0])..len(studentAnswer[0])]\n\ninterpreted_answers:\n [interpreted_angle, studentAnswer[1], studentAnswer[2], studentAnswer[3]]\n\ngap_feedback (Feedback on each of the gaps):\n map(\n try(\n let(\n result, submit_part(gaps[gap_number][\"path\"],answer),\n gap, gaps[gap_number],\n name, gap[\"name\"], \n noFeedbackIcon, not gap[\"settings\"][\"showFeedbackIcon\"],\n assert(name=\"\" or len(gaps)=1,feedback(translate('part.gapfill.feedback header',[\"name\": name])));\n concat_feedback(filter(x[\"op\"]<>\"warning\",x,result[\"feedback\"]), if(marks>0,result[\"marks\"]/marks,1), noFeedbackIcon);\n result\n ),\n err,\n fail(translate(\"part.gapfill.error marking gap\",[\"name\": gaps[gap_number][\"name\"], \"message\": err]))\n ),\n [gap_number,answer,index],\n zip([3,0],[studentAnswer[3], interpreted_angle],[1,2])\n )\n\n", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Find the magnitude and direction of C.
\n$C$ = [[3]]
\n$\\theta_C$ = [[0]] measured [[1]] from the [[2]].
\nmagnitude = {siground(mag_C,4)}
\ndirection={theta_C} {C_from_ref}
", "gaps": [{"type": "angle", "useCustomName": true, "customName": "angle", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"expected_answer": "qty(theta_c,'deg')", "unit_penalty": "20", "close_penalty": "20", "close_tol": "0.5", "right_tol": "0.2"}}, {"type": "1_n_2", "useCustomName": true, "customName": "dir", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["CCW", "CW"], "matrix": [0, 0], "distractors": ["", ""]}, {"type": "1_n_2", "useCustomName": true, "customName": "ref", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["+x axis", "+y axis", "-x axis", "-y axis"], "matrix": [0, 0, 0, 0], "distractors": ["", "", "", ""]}, {"type": "engineering-answer", "useCustomName": true, "customName": "Magnitude", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "mag_C", "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": "Vector addition of three 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%,Determine the resultant of three random 2-D vectors.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "{geogebra_applet('cmq7dk74',[['A',A], ['B',B], ['C',C], ['O',O], ['MA',MA], ['MB',MB], ['MC',MC], ['units', '\"' + units + '\"']])}
\nDetermine the resultant of the three forces shown.
", "advice": "\n$R$ = [[3]]
\n$\\theta_R$ = [[0]] measured [[1]] from the [[2]].
", "gaps": [{"type": "angle", "useCustomName": true, "customName": "Angle", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"expected_answer": "qty(theta,'deg')", "unit_penalty": "20", "close_penalty": "20", "close_tol": "0.5", "right_tol": "0.2"}}, {"type": "1_n_2", "useCustomName": true, "customName": "Sign", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["CCW", "CW"], "matrix": [0, 0], "distractors": ["", ""]}, {"type": "1_n_2", "useCustomName": true, "customName": "Reference", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["+x axis", "+y axis", "-x axis", "-y axis"], "matrix": [0, 0, 0, 0], "distractors": ["", "", "", ""]}, {"type": "engineering-answer", "useCustomName": true, "customName": "Magnitude", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "R_mag", "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": "Vector addition: tip-to-tail method", "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%,Given three vectors, arrange them in a tip to tail arrangement using geogebra, then estimate the magnitude and direction of their resultant.
", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "{geogebra_applet('jwussezq', [['f_a', forceA],['f_b', forceB],['f_c', forceC]])}
\nThree forces act on point A: $A$ = {FA} {units[1]} at {alpha}°, $B$ = {FB} {units[1]} at {beta}° and, $C$ = {FC} {units[1]} at {gamma}°.
\nEstimate the magnitude and direction of the resultant force $R$ using the tip-to-tail method.
\nForce A: {fa} {units[1]} at {alpha} = {forceA}
\nForce B: {fb} {units[1]} at {beta} = {forceB}
\nForce C: {fc}{units[1]} at {gamma} = {forceC}
\nResultant: {R}{units[1]} at {rho} = {forceR}
\nBased on this diagram, estimate the magnitude and direction of the resultant.
", "advice": "Vector Addition:
\nWhen the forces have been moved to a tip-to=tail arrangement, the magnitude and direction can be read off the polar diagram.
\n$\\Sigma F_x = R_x \\qquad R=\\sqrt{R_x^2 + R_y^2}\\\\\\\\ \\Sigma F_y = R_y \\qquad \\theta = \\tan^{-1}\\left(\\left|\\frac{R_y}{R_x}\\right| \\right)$
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"FA": {"name": "FA", "group": "Inputs", "definition": "random(20..80#5)", "description": "Magnitude of force A
", "templateType": "anything", "can_override": false}, "alpha": {"name": "alpha", "group": "Inputs", "definition": "(random(-180..180#15))\n", "description": "direction of force A
", "templateType": "anything", "can_override": false}, "ForceC": {"name": "ForceC", "group": "Outputs", "definition": "FC *( vector(cos(radians(gamma)),sin(radians(gamma))))", "description": "Force C as a vector
", "templateType": "anything", "can_override": false}, "ForceR": {"name": "ForceR", "group": "Outputs", "definition": "ForceA+ForceB+ForceC", "description": "Resultant as a vector
", "templateType": "anything", "can_override": false}, "FB": {"name": "FB", "group": "Inputs", "definition": "random(20..80#5)", "description": "Magnitude of Force B
", "templateType": "anything", "can_override": false}, "units": {"name": "units", "group": "Inputs", "definition": "random(['ft','lb'],['in','lb'],['cm','N'])", "description": "", "templateType": "anything", "can_override": false}, "rho": {"name": "rho", "group": "Outputs", "definition": "degrees(direction(ForceR))", "description": "direction of resultant
", "templateType": "anything", "can_override": false}, "gamma": {"name": "gamma", "group": "Inputs", "definition": "(random(-180..180#15))", "description": "Direction of force C in degrees
", "templateType": "anything", "can_override": false}, "FC": {"name": "FC", "group": "Inputs", "definition": "random(20..80#5)", "description": "Magnitude of force C
", "templateType": "anything", "can_override": false}, "ForceA": {"name": "ForceA", "group": "Outputs", "definition": "FA *( vector(cos(radians(alpha)),sin(radians(alpha))))", "description": "force A as a vector
", "templateType": "anything", "can_override": false}, "ForceB": {"name": "ForceB", "group": "Outputs", "definition": "FB *( vector(cos(radians(beta)),sin(radians(beta))))", "description": "Force B as a vector
", "templateType": "anything", "can_override": false}, "debug": {"name": "debug", "group": "Inputs", "definition": "false", "description": "", "templateType": "anything", "can_override": false}, "R": {"name": "R", "group": "Outputs", "definition": "abs(ForceR)", "description": "Magnitude of resultant
", "templateType": "anything", "can_override": false}, "beta": {"name": "beta", "group": "Inputs", "definition": "(random(-180..180#15))", "description": "Direction of force B
", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "abs(alpha-beta) >= 15 and abs(beta-gamma) >= 15 and abs(gamma-alpha) >= 15 and r <=100 and r > 10", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [{"name": "Inputs", "variables": ["alpha", "gamma", "beta", "FA", "FB", "FC", "units", "debug"]}, {"name": "Outputs", "variables": ["ForceA", "ForceB", "ForceC", "ForceR", "rho", "R"]}], "functions": {"direction": {"parameters": [["v", "vector"]], "type": "number", "language": "javascript", "definition": "return Math.atan2(v[1],v[0])"}}, "preamble": {"js": "", "css": ".red{color:red;}\n.blue{color:blue;}\n.green{color:green;}"}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Magnitude", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "$R$ = [[0]]
", "gaps": [{"type": "engineering-answer", "useCustomName": true, "customName": "Magnitude", "marks": "10", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "settings": {"correctAnswer": "qty(R,units[1])", "right": "3", "close": "6", "C1": "75", "C2": "50", "C3": "25"}}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": true, "customName": "Direction", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "interpreted_angle: // a qty string corrected to standard angle\n student_angle[2] + student_angle[1] * student_angle[0] + student_units\n\n\nstudent_angle:\n [mod(matchnumber(studentAnswer[0],['plain','en'])[1],360), // angle\n [1,-1][indices(studentAnswer[1],[true])[0]], // ccw = 1 cw = -1\n [0,90,180,-90][indices(studentAnswer[2],[true])[0]]] // reference axis\n\nstudent_units:\n studentAnswer[0][len(matchnumber(studentAnswer[0],['plain','en'])[0])..len(studentAnswer[0])]\n\ninterpreted_answers:\n [interpreted_angle, studentAnswer[1], studentAnswer[2]]\n\ngap_feedback (Feedback on each of the gaps):\n map(\n try(\n let(\n result, submit_part(gaps[gap_number][\"path\"],answer),\n gap, gaps[gap_number],\n name, gap[\"name\"], \n noFeedbackIcon, not gap[\"settings\"][\"showFeedbackIcon\"],\n assert(name=\"\" or len(gaps)=1,feedback(translate('part.gapfill.feedback header',[\"name\": name])));\n concat_feedback(filter(x[\"op\"]<>\"warning\",x,result[\"feedback\"]), if(marks>0,result[\"marks\"]/marks,1), noFeedbackIcon);\n result\n ),\n err,\n fail(translate(\"part.gapfill.error marking gap\",[\"name\": gaps[gap_number][\"name\"], \"message\": err]))\n ),\n [gap_number,answer,index],\n zip([0],[interpreted_angle],[1])\n )\n\n", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "$\\theta$ = [[0]] measured [[1]] from the [[2]].
\n", "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": "precround(qty(rho,'deg'),0)", "unit_penalty": "20", "close_penalty": "20", "close_tol": "5", "right_tol": "2"}}, {"type": "1_n_2", "useCustomName": true, "customName": "sign", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["CCW", "CW"], "matrix": [0, 0], "distractors": ["", ""]}, {"type": "1_n_2", "useCustomName": true, "customName": "ref", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "dropdownlist", "displayColumns": 0, "showCellAnswerState": true, "choices": ["+x axis", "+y Axis", "-x Axis", "-y Axis"], "matrix": [0, 0, 0, 0], "distractors": ["", "", "", ""]}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}]}], "allowPrinting": true, "navigation": {"allowregen": true, "reverse": true, "browse": true, "allowsteps": false, "showfrontpage": true, "showresultspage": "never", "navigatemode": "sequence", "onleave": {"action": "warnifunattempted", "message": "You have not yet answered this question.
"}, "preventleave": true, "startpassword": ""}, "timing": {"allowPause": true, "timeout": {"action": "warn", "message": "Your time for this review assignment has expired.
"}, "timedwarning": {"action": "warn", "message": "You have five minutes remaining to finalize and submit your review assignment.
"}}, "feedback": {"showactualmark": true, "showtotalmark": true, "showanswerstate": true, "allowrevealanswer": false, "advicethreshold": 0, "intro": "", "reviewshowscore": false, "reviewshowfeedback": false, "reviewshowexpectedanswer": false, "reviewshowadvice": false, "feedbackmessages": [], "enterreviewmodeimmediately": false, "showexpectedanswerswhen": "never", "showpartfeedbackmessageswhen": "always", "showactualmarkwhen": "never", "showtotalmarkwhen": "always", "showanswerstatewhen": "never", "showadvicewhen": "never"}, "type": "exam", "contributors": [{"name": "Terry Young", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3130/"}], "extensions": ["geogebra", "quantities", "weh"], "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%,