// Numbas version: finer_feedback_settings {"name": "Find matrix from entry formula", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Find matrix from entry formula", "tags": ["entry", "matrix"], "metadata": {"description": "
Finding a matrix from a formula for each entry, which involves the row and column numbers of that entry. Randomized size of the matrices and formula.
\nThe interesting part about the implementation is the way the output is generated for \"Advice\".
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "Find the \\(\\var{m}\\times \\var{n}\\) matrix \\(A=(a_{ij})_{\\var{m}\\times \\var{n}}\\) whose entries satisfy the stated condition:
", "advice": "The entry \\(a_{ij}\\) is the entry in row \\(i\\) and column \\(j\\). So when we know the row and column, we can work out the entry from the formula.
\n\\(a_{ij}=\\var{latex(term('i',d1)+latexoperation+term('j',d2))}\\), so \\(a_{11}=\\var{a11}=\\var{A1[0][0]}\\) and \\(a_{12}=\\var{a12}=\\var{A1[0][1]}\\) and so on.
\n\\[ A = \\var{generalA} =\\var{unresolvedA1}= \\var{A1}\\]
", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"A1": {"name": "A1", "group": "Ungrouped variables", "definition": "matrix(map(rawA1[k..k+n],k,list(vector(0..m-1)*n)))", "description": "matrix([2,3,4,5],[3,4,5,6],[4,5,6,7],[5,6,7,8])
", "templateType": "anything", "can_override": false}, "generalA": {"name": "generalA", "group": "Ungrouped variables", "definition": "latex('\\\\begin{pmatrix}'+ concatstrings(rawgeneralA) +'\\\\end{'+'pmatrix}')\n", "description": "latex('\\\\begin{pmatrix} a_{11}&a_{12} & a_{13} & a_{14}\\\\\\\\ a_{21} & a_{22} & a_{23} & a_{24} \\\\\\\\ a_{31} & a_{32} & a_{33} & a_{34} \\\\\\\\ a_{41} & a_{42} & a_{43} & a_{44}\\\\end{pmatrix}')
", "templateType": "anything", "can_override": false}, "unresolvedA1": {"name": "unresolvedA1", "group": "Ungrouped variables", "definition": "latex('\\\\begin{pmatrix}'+ concatstrings(rawunresolvedA1) +'\\\\end{'+'pmatrix}')\n", "description": "latex('\\\\begin{pmatrix} 1+1&1+2 &1+3 & 1+4\\\\\\\\ 2+1 & 2+2 & 2+3 & 2+4 \\\\\\\\ 3+1 & 3+2 & 3+3 & 3+4 \\\\\\\\ 4+1 & 4+2 & 4+3 & 4+4\\\\end{pmatrix}')
", "templateType": "anything", "can_override": false}, "rawA1": {"name": "rawA1", "group": "Ungrouped variables", "definition": "map(eval(simplify(expression(termnumber({k},d1)+ '{operation}'+ termnumber({l},d2)),\"all\")),[k,l],product(1..m,1..n))", "description": "", "templateType": "anything", "can_override": false}, "rawunresolvedA1": {"name": "rawunresolvedA1", "group": "Ungrouped variables", "definition": "map(termnumber({k},d1)+ '{latexoperation}'+ termnumber({l},d2)+symbols[k-1][l-1],[k,l],product(1..m,1..n))", "description": "", "templateType": "anything", "can_override": false}, "symbols": {"name": "symbols", "group": "Ungrouped variables", "definition": "repeat(repeat('&',n-1)+['\\\\\\\\'],m-1)+[repeat('&',n-1)+['']]", "description": "['&','&','&','\\\\\\\\']
", "templateType": "anything", "can_override": false}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "random(2..4)", "description": "number of columns
", "templateType": "anything", "can_override": false}, "rawgeneralA": {"name": "rawgeneralA", "group": "Ungrouped variables", "definition": "map('a_{'+'{k}'+'{l}}'+symbols[k-1][l-1],[k,l],product(1..m,1..n))", "description": "", "templateType": "anything", "can_override": false}, "m": {"name": "m", "group": "Ungrouped variables", "definition": "random(2..4)", "description": "number of rows
", "templateType": "anything", "can_override": false}, "operation": {"name": "operation", "group": "Ungrouped variables", "definition": "random(['+','-','*','^'])", "description": "random(['+','-','*','^'])
", "templateType": "anything", "can_override": false}, "latexoperation": {"name": "latexoperation", "group": "Ungrouped variables", "definition": "if(operation='*',latex('\\\\cdot'),latex(operation))", "description": "", "templateType": "anything", "can_override": false}, "a11": {"name": "a11", "group": "Ungrouped variables", "definition": "latex(termnumber(1,d1)+latexoperation+termnumber(1,d2))", "description": "", "templateType": "anything", "can_override": false}, "a12": {"name": "a12", "group": "Ungrouped variables", "definition": "latex(termnumber(1,d1)+latexoperation+termnumber(2,d2))", "description": "", "templateType": "anything", "can_override": false}, "term1test": {"name": "term1test", "group": "Ungrouped variables", "definition": "term('k',d1)", "description": "", "templateType": "anything", "can_override": false}, "d1": {"name": "d1", "group": "Ungrouped variables", "definition": "random(0..2)", "description": "", "templateType": "anything", "can_override": false}, "d2": {"name": "d2", "group": "Ungrouped variables", "definition": "random(0..2)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["m", "n", "rawA1", "A1", "rawgeneralA", "generalA", "symbols", "rawunresolvedA1", "unresolvedA1", "operation", "latexoperation", "a11", "a12", "term1test", "d1", "d2"], "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;"}, "term": {"parameters": [["k", "string"], ["d", "number"]], "type": "string", "language": "jme", "definition": "switch(d=0,'{'+'('+k+'-1)'+'}',d=1,'{'+k+'}',d=2,'{'+'('+k+'+1)'+'}',k)"}, "termnumber": {"parameters": [["k", "number"], ["d", "number"]], "type": "number", "language": "jme", "definition": "switch(d=0,k-1,d=1,k,d=2,k+1,k)"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "\\(a_{ij}=\\var{latex(term('i',d1)+latexoperation+term('j',d2))}\\). Then \\(A= \\) [[0]]
", "gaps": [{"type": "matrix", "useCustomName": false, "customName": "", "marks": "4", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "correctAnswer": "A1", "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/"}]}