// Numbas version: exam_results_page_options {"name": "List all vectors in spanning set", "extensions": ["codewords", "permutations"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"questions": [{"ungrouped_variables": ["num_parts", "field_size", "word_length", "num_words", "generators", "spanning_set", "generated_code"], "extensions": ["codewords", "permutations"], "name": "List all vectors in spanning set", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

List all vectors in a spanning set.

\n

(repeated 3 times)

"}, "variablesTest": {"condition": "sum(map(\n let(l,len(spanning_set[j]),\n if(l<15,0,1)\n ),\n j,\n 0..num_parts-1\n))=0", "maxRuns": "150"}, "variables": {"num_words": {"name": "num_words", "definition": "repeat(random(2..3),num_parts)", "group": "Ungrouped variables", "description": "

Number of words in each span

", "templateType": "anything"}, "word_length": {"name": "word_length", "definition": "repeat(random(3..6),num_parts)", "group": "Ungrouped variables", "description": "

Length of words in each span

", "templateType": "anything"}, "spanning_set": {"name": "spanning_set", "definition": "map(set_generated_by(x),x,generators)", "group": "Ungrouped variables", "description": "

All the words in each span.

\n

The testing condition makes sure there are no more than 15 words in each span.

", "templateType": "anything"}, "generated_code": {"name": "generated_code", "definition": "map(code(x),x,spanning_set)", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "num_parts": {"name": "num_parts", "definition": "3", "group": "Ungrouped variables", "description": "

Number of parts in the question (i.e., number of spanning sets to generate)

", "templateType": "anything"}, "field_size": {"name": "field_size", "definition": "repeat(random(2..3),num_parts)", "group": "Ungrouped variables", "description": "

Field size for each span

", "templateType": "anything"}, "generators": {"name": "generators", "definition": "map(sort(shuffle(allwords(word_length[j],field_size[j]))[0..num_words[j]]),j,0..num_parts-1)", "group": "Ungrouped variables", "description": "

Sets of words generating each span - shown to the student.

", "templateType": "anything"}}, "rulesets": {}, "parts": [{"scripts": {"mark": {"script": "question.mark_spanning_set(this,variables.field_size[0],variables.generated_code[0]);", "order": "instead"}}, "variableReplacements": [], "showCorrectAnswer": true, "answer": "", "unitTests": [], "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "marks": 1, "displayAnswer": "{join(map(string(x),x,spanning_set[0]),',')}", "matchMode": "regex", "type": "patternmatch", "customMarkingAlgorithm": "", "prompt": "

$\\var{latex(show_span(generators[0]))} \\subset \\mathbb{Z}_{\\var{field_size[0]}}^{\\var{word_length[0]}}$

"}, {"scripts": {"mark": {"script": "question.mark_spanning_set(this,variables.field_size[1],variables.generated_code[1]);", "order": "instead"}}, "variableReplacements": [], "showCorrectAnswer": true, "answer": "", "unitTests": [], "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "marks": 1, "displayAnswer": "{join(map(string(x),x,spanning_set[1]),',')}", "matchMode": "regex", "type": "patternmatch", "customMarkingAlgorithm": "", "prompt": "

$\\var{latex(show_span(generators[1]))} \\subset \\mathbb{Z}_{\\var{field_size[1]}}^{\\var{word_length[1]}}$

"}, {"scripts": {"mark": {"script": "question.mark_spanning_set(this,variables.field_size[2],variables.generated_code[2]);", "order": "instead"}}, "variableReplacements": [], "showCorrectAnswer": true, "answer": "", "unitTests": [], "extendBaseMarkingAlgorithm": true, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "marks": 1, "displayAnswer": "{join(map(string(x),x,spanning_set[2]),',')}", "matchMode": "regex", "type": "patternmatch", "customMarkingAlgorithm": "", "prompt": "

$\\var{latex(show_span(generators[2]))} \\subset \\mathbb{Z}_{\\var{field_size[2]}}^{\\var{word_length[2]}}$

"}], "tags": [], "preamble": {"js": "with(Numbas.extensions.codewords) {\n question.mark_spanning_set = function(part,field_size,correctAnswer) {\n mark_codeword_set(part,field_size,function(words) {\n var student_code = new Code(words);\n if(student_code.eq(correctAnswer)) {\n this.setCredit(1,\"Your answer is correct.\");\n } else {\n this.setCredit(0,\"Your answer is incorrect.\");\n }\n this.answered = true;\n });\n }\n}", "css": ""}, "statement": "

List all of the vectors in the following spans.

\n

Enter each answer as a list of vectors, separated by commas. For example, 000,001,002.

", "functions": {"join_words": {"type": "string", "definition": "// LaTeX representation of a list of words, separated by commas\nlatex(join(map('\\\\mathtt{'+x+'}',x,words),','))", "language": "jme", "parameters": [["words", "list"]]}, "show_span": {"type": "string", "definition": "// LaTeX representation of a span - words separated by commas, surrounded by angle brackets\nlatex('\\\\langle '+join_words(words)+' \\\\rangle')", "language": "jme", "parameters": [["words", "list"]]}}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas-editor.mas.ncl.ac.uk/accounts/profile/3/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "type": "question", "advice": "

#### a)

\n

$\\var{show_span(generators[0])}$ is the set of all linear combinations of the vectors $\\var{join_words(generators[0])}$.

\n

Every vector in the span is the sum of {join(list(0..field_size[0]-2),',')} or {field_size[0]-1} times each of the given vectors. That is, every vector in the span has the form

\n

\$w = \\var{latex(join(map('\\\\lambda_{j+1} \\\\times \\\\mathtt{'+generators[0][j]+'}',j,0..num_words[0]-1),'+'))} \$

\n

The set of vectors in the span is thus

\n

\$\\var{latex(join_words(spanning_set[0]))} \$

\n

#### b)

\n

$\\var{show_span(generators[1])}$ is the set of all linear combinations of the vectors $\\var{join_words(generators[1])}$.

\n

Every vector in the span is the sum of {join(list(0..field_size[1]-2),',')} or {field_size[1]-1} times each of the given vectors. That is, every vector in the span has the form

\n

\$w = \\var{latex(join(map('\\\\lambda_{j+1} \\\\times \\\\mathtt{'+generators[1][j]+'}',j,0..num_words[1]-1),'+'))} \$

\n

The set of vectors in the span is thus

\n

\$\\var{latex(join_words(spanning_set[1]))} \$

\n

#### a)

\n

$\\var{show_span(generators[2])}$ is the set of all linear combinations of the vectors $\\var{join_words(generators[2])}$.

\n

Every vector in the span is the sum of {join(list(0..field_size[2]-2),',')} or {field_size[2]-1} times each of the given vectors. That is, every vector in the span has the form

\n

\$w = \\var{latex(join(map('\\\\lambda_{j+1} \\\\times \\\\mathtt{'+generators[2][j]+'}',j,0..num_words[2]-1),'+'))} \$

\n

The set of vectors in the span is thus

\n

\$\\var{latex(join_words(spanning_set[2]))} \$

", "variable_groups": []}], "pickingStrategy": "all-ordered"}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas-editor.mas.ncl.ac.uk/accounts/profile/3/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}