// Numbas version: finer_feedback_settings {"name": "LN02 The L1 Norm", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "LN02 The L1 Norm", "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "

What is the $L^{1}$ norm of the following vectors

", "advice": "

The L-one norm

\n

The $L^{1}$ norm of a vector is found by adding up the absolute value of all of the elements of the vector.

\n

So, introducing the $\\left| \\bf{v} \\right|_1$ notation for the $L^{1}$ norm, gives the definition:

\n

$$
\\begin{vmatrix}
\\left(
\\begin{array}{l}
x\\\\
y\\\\
z\\\\
\\end{array}
\\right)
\\end{vmatrix}_1 =\\left|x\\right| + \\left| y \\right| + \\left| z \\right|
$$

\n

Therefore, for example, a) has the answer:

\n

$$
\\begin{vmatrix}
\\var{vector1}
\\end{vmatrix}_1 = \\var{advice} = \\var{answera}
$$

\n

For more information on norms read (for example) this.

", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"vector1": {"name": "vector1", "group": "Ungrouped variables", "definition": "vector(repeat(random(-4..4),rowsa))", "description": "", "templateType": "anything", "can_override": false}, "vector2": {"name": "vector2", "group": "Ungrouped variables", "definition": "vector(repeat(random(-6..2),rowsb))", "description": "", "templateType": "anything", "can_override": false}, "answera": {"name": "answera", "group": "Ungrouped variables", "definition": "sumabsval(vector1)", "description": "", "templateType": "anything", "can_override": false}, "answerb": {"name": "answerb", "group": "Ungrouped variables", "definition": "sumabsval(vector2)", "description": "", "templateType": "anything", "can_override": false}, "answerc": {"name": "answerc", "group": "Ungrouped variables", "definition": "abs(number)*answera", "description": "", "templateType": "anything", "can_override": false}, "rowsa": {"name": "rowsa", "group": "Ungrouped variables", "definition": "random(2..5)", "description": "", "templateType": "anything", "can_override": false}, "rowsb": {"name": "rowsb", "group": "Ungrouped variables", "definition": "random(2,3,4)", "description": "", "templateType": "anything", "can_override": false}, "number": {"name": "number", "group": "Ungrouped variables", "definition": "random(-4,5,-6,3,-2,7)", "description": "", "templateType": "anything", "can_override": false}, "rawadviceabs": {"name": "rawadviceabs", "group": "Ungrouped variables", "definition": "map('|\\\\' + 'var{'+'vector1[{i-1}]'+'}|'+ latexcodebits(rowsa)[i-1],[dummy,i],product(1..1,1..rowsa))", "description": "", "templateType": "anything", "can_override": false}, "advice": {"name": "advice", "group": "Ungrouped variables", "definition": "latex(stringify(rawadviceabs))", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["vector1", "vector2", "answera", "answerb", "answerc", "rowsa", "rowsb", "number", "rawadviceabs", "advice"], "variable_groups": [], "functions": {"sumabsval": {"parameters": [["vector", "vector"]], "type": "number", "language": "javascript", "definition": "var output = 0;\nvar i;\n let count = 0;\n for (let i = 0; i < vector.length; i++) {\n if (vector[i] !== 0) {\n output = output + Math.abs(vector[i]);\n }\n }\n return output;"}, "Latexcodebits": {"parameters": [["n", "number"]], "type": "anything", "language": "jme", "definition": "repeat('+',n-1)+['']"}, "Stringify": {"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;"}}, "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": "

$\\var{vector1}$

", "minValue": "answera", "maxValue": "answera", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "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": "

$\\var{vector2}$

", "minValue": "answerb", "maxValue": "answerb", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "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": "

$\\var{number} \\times \\var{vector1}$

", "minValue": "answerc", "maxValue": "answerc", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Mash Sheffield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4679/"}, {"name": "Will Morgan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/21933/"}], "resources": []}]}], "contributors": [{"name": "Mash Sheffield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4679/"}, {"name": "Will Morgan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/21933/"}]}