// Numbas version: finer_feedback_settings {"name": "List all vectors in spanning set", "extensions": ["codewords", "permutations"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [], "variables": {"word_length": {"group": "Ungrouped variables", "templateType": "anything", "definition": "repeat(random(3..6),num_parts)", "name": "word_length", "description": "

Length of words in each span

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

All the words in each span.

\n

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

"}, "num_parts": {"group": "Ungrouped variables", "templateType": "anything", "definition": "3", "name": "num_parts", "description": "

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

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

Field size for each span

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

Number of words in each span

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

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

"}, "generated_code": {"group": "Ungrouped variables", "templateType": "anything", "definition": "map(code(x),x,spanning_set)", "name": "generated_code", "description": ""}}, "ungrouped_variables": ["num_parts", "field_size", "word_length", "num_words", "generators", "spanning_set", "generated_code"], "name": "List all vectors in spanning set", "functions": {"show_span": {"type": "string", "language": "jme", "definition": "// LaTeX representation of a span - words separated by commas, surrounded by angle brackets\nlatex('\\\\langle '+join_words(words)+' \\\\rangle')", "parameters": [["words", "list"]]}, "join_words": {"type": "string", "language": "jme", "definition": "// LaTeX representation of a list of words, separated by commas\nlatex(join(map('\\\\mathtt{'+x+'}',x,words),','))", "parameters": [["words", "list"]]}}, "parts": [{"answer": "", "displayAnswer": "{join(map(string(x),x,spanning_set[0]),',')}", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "prompt": "

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

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

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

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

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

", "unitTests": [], "matchMode": "regex", "showFeedbackIcon": true, "scripts": {"mark": {"script": "question.mark_spanning_set(this,variables.field_size[2],variables.generated_code[2]);", "order": "instead"}}, "type": "patternmatch", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "variableReplacements": [], "marks": 1}], "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.

", "tags": [], "rulesets": {}, "preamble": {"css": "", "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}"}, "type": "question", "extensions": ["codewords", "permutations"], "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"}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

List all vectors in a spanning set.

\n

(repeated 3 times)

"}, "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]))} \\]

", "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/"}]}]}], "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/"}]}