// Numbas version: finer_feedback_settings {"name": "Matrix times vector (same as WBQ 1.27)", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Matrix times vector (same as WBQ 1.27)", "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:
\n(This question is not randomized: it is the same as our Workbook Question 1.27. You can find a randomized version of it as well.)
", "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}\\]
\na) \\(\\var{A}\\var{va}=\\var{unresolvedAva}=\\var{A*va}\\)
\nb) \\(\\var{B}\\var{vb}=\\var{unresolvedBvb}=\\var{B*vb}\\)
\nc) \\(\\var{C}\\var{vc}=\\var{unresolvedCvc}=\\var{C*vc}\\)
\nd) \\(\\var{D}\\var{vd}=\\var{unresolvedDvd}=\\var{D*vd}\\)
", "rulesets": {}, "extensions": [], "variables": {"A": {"name": "A", "group": "Ungrouped variables", "definition": "matrix([3,2],[5,1])", "description": "", "templateType": "anything"}, "va": {"name": "va", "group": "Ungrouped variables", "definition": "vector(1,1)", "description": "", "templateType": "anything"}, "B": {"name": "B", "group": "Ungrouped variables", "definition": "matrix([1,3,2],[9,2,-1])", "description": "", "templateType": "anything"}, "vb": {"name": "vb", "group": "Ungrouped variables", "definition": "vector(1,3,2)", "description": "", "templateType": "anything"}, "C": {"name": "C", "group": "Ungrouped variables", "definition": "matrix([1,9,0],[8,0,1],[0,2,8])", "description": "", "templateType": "anything"}, "vc": {"name": "vc", "group": "Ungrouped variables", "definition": "vector(1,2,3)", "description": "", "templateType": "anything"}, "D": {"name": "D", "group": "Ungrouped variables", "definition": "matrix([1,9],[2,3],[2,-1])", "description": "", "templateType": "anything"}, "vd": {"name": "vd", "group": "Ungrouped variables", "definition": "vector(-1,2)", "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(2,2)[k][l],[k,l],product(0..1,0..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"}, "rawunresolvedBvb": {"name": "rawunresolvedBvb", "group": "Ungrouped variables", "definition": "map(if({B[k][l]<0,'({B[k][l]})','{B[k][l]}')+'\\\\cdot'+if(vb[l]<0,'({vb[l]})','{vb[l]}')+symbols(2,3)[k][l],[k,l],product(0..1,0..2))", "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. All the \"if\" things are to put brackets round negative numbers. not using simplify because i prefer \\(\\cdot\\) to \\(\\times\\).
\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"}, "rawunresolvedCvC": {"name": "rawunresolvedCvC", "group": "Ungrouped variables", "definition": "map(if({C[k][l]<0,'({C[k][l]})','{C[k][l]}')+'\\\\cdot'+if(vc[l]<0,'({vc[l]})','{vc[l]}')+symbols(3,3)[k][l],[k,l],product(0..2,0..2))", "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. All the \"if\" things are to put brackets round negative numbers. not using simplify because i prefer \\(\\cdot\\) to \\(\\times\\).
\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"}, "rawunresolvedDvd": {"name": "rawunresolvedDvd", "group": "Ungrouped variables", "definition": "map(if({D[k][l]<0,'({D[k][l]})','{D[k][l]}')+'\\\\cdot'+if(vd[l]<0,'({vd[l]})','{vd[l]}')+symbols(3,2)[k][l],[k,l],product(0..2,0..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. All the \"if\" things are to put brackets round negative numbers. not using simplify because i prefer \\(\\cdot\\) to \\(\\times\\).
\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"}, "unresolvedBvb": {"name": "unresolvedBvb", "group": "Ungrouped variables", "definition": "latex('\\\\begin{pmatrix}'+ concatstrings(rawunresolvedBvb) +'\\\\end{'+'pmatrix}')", "description": "for the solution, the calculation steps written out unresolved.
", "templateType": "anything"}, "unresolvedCvc": {"name": "unresolvedCvc", "group": "Ungrouped variables", "definition": "latex('\\\\begin{pmatrix}'+ concatstrings(rawunresolvedCvc) +'\\\\end{'+'pmatrix}')", "description": "for the solution, the calculation steps written out unresolved.
", "templateType": "anything"}, "unresolvedDvd": {"name": "unresolvedDvd", "group": "Ungrouped variables", "definition": "latex('\\\\begin{pmatrix}'+ concatstrings(rawunresolvedDvd) +'\\\\end{'+'pmatrix}')", "description": "for the solution, the calculation steps written out unresolved.
", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["A", "va", "B", "vb", "C", "vc", "D", "vd", "rawunresolvedAva", "unresolvedAva", "rawunresolvedBvb", "unresolvedBvb", "rawunresolvedCvC", "unresolvedCvc", "rawunresolvedDvd", "unresolvedDvd"], "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}, {"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{B}\\var{vb}= \\) [[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": "B*vb", "correctAnswerFractions": false, "numRows": 1, "numColumns": 1, "allowResize": true, "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{C}\\var{vc}= \\) [[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": "C*vc", "correctAnswerFractions": false, "numRows": 1, "numColumns": 1, "allowResize": true, "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{D}\\var{vd}= \\) [[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": "D*vd", "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", "contributors": [{"name": "Julia Goedecke", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5121/"}]}]}], "contributors": [{"name": "Julia Goedecke", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5121/"}]}