// Numbas version: finer_feedback_settings {"name": "Demo accept NA or any counter-example", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Demo accept NA or any counter-example", "tags": ["counterexample", "demo"], "metadata": {"description": "

Marking algorithm that allows NA or any correct counterexample.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

This demo shows how you can make a gap asking for a counter-example: if the statement is actually true, then the counterexample gap takes NA. If the statement is false, the gap takes any valid counterexample.

\n

The gaps have pattern restrictions, and the second part has an altered marking algorithm. For allowing any correct counterexample (without the \"NA\" bit), search also for a question by Christian Lawson-Perfect on \"Accept any symmetric matrix\". That's where I learnt that part of it.

", "advice": "", "rulesets": {}, "extensions": [], "variables": {"v1": {"name": "v1", "group": "Ungrouped variables", "definition": "vector((repeat(random(1..5),2)))", "description": "", "templateType": "anything"}, "v2": {"name": "v2", "group": "Ungrouped variables", "definition": "vector((repeat(random(1..5),2)))", "description": "", "templateType": "anything"}, "w1": {"name": "w1", "group": "Ungrouped variables", "definition": "vector(sqrt(n),pi)", "description": "", "templateType": "anything"}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "random(2..5 except 4)", "description": "", "templateType": "anything"}, "w2": {"name": "w2", "group": "Ungrouped variables", "definition": "vector(-w1[0]/b,pi)", "description": "", "templateType": "anything"}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "random(2..3)", "description": "", "templateType": "anything"}, "mu1": {"name": "mu1", "group": "Ungrouped variables", "definition": "random(2..4)", "description": "", "templateType": "anything"}, "mu2": {"name": "mu2", "group": "Ungrouped variables", "definition": "b*mu1", "description": "", "templateType": "anything"}, "e1": {"name": "e1", "group": "Ungrouped variables", "definition": "\"\\\\begin\\{pmatrix\\}1\\\\\\\\0\\\\\\\\0\\\\\\\\0\\\\end\\{pmatrix\\}\"", "description": "

first standard basis vector

", "templateType": "anything"}, "e2": {"name": "e2", "group": "Ungrouped variables", "definition": "\"\\\\begin\\{pmatrix\\}0\\\\\\\\1\\\\\\\\0\\\\\\\\0\\\\end\\{pmatrix\\}\"", "description": "", "templateType": "anything"}, "e3": {"name": "e3", "group": "Ungrouped variables", "definition": "\"\\\\begin\\{pmatrix\\}0\\\\\\\\0\\\\\\\\1\\\\\\\\0\\\\end\\{pmatrix\\}\"", "description": "", "templateType": "anything"}, "e4": {"name": "e4", "group": "Ungrouped variables", "definition": "\"\\\\begin\\{pmatrix\\}0\\\\\\\\0\\\\\\\\0\\\\\\\\1\\\\end\\{pmatrix\\}\"", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "v1<>v2", "maxRuns": 100}, "ungrouped_variables": ["v1", "v2", "w1", "w2", "n", "b", "mu1", "mu2", "e1", "e2", "e3", "e4"], "variable_groups": [], "functions": {}, "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": "

[Here question about a true statement about vectors in \\(\\mathbb{R}^4\\).]

\n

If you decided that the statement is false give a counterexample here. Write it into the gap as vector(1,2,3,4) with the numbers substituted by your chosen entries. (The marking algorithm will not understand fractions.) If you decided the statement is true (so there is no counterexample), then write NA into the gap.

\n

Counterexample: [[0]]

\n

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "1", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "NA", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "mustmatchpattern": {"pattern": "vector($n,$n,$n,$n)`|NA", "partialCredit": 0, "message": "You should input a vector with four entries, or NA.", "nameToCompare": ""}, "valuegenerators": [{"name": "na", "value": ""}]}], "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": "

[Here question about a false statement about vectors in \\(\\mathbb{R}^4\\).]

\n

If you decided that the statement is false, give a counterexample here. Write it into the gap as vector(1,2,3,4) with the numbers substituted by your chosen entries. (The marking algorithm will not understand fractions.) If you decided that the statement is true (so no counterexample exists), then write NA into the gap. (Correct is any vector with non-zero fourth entry.)

\n

Counter-example: [[0]]

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "is_NA (Is the student's entry NA?):\n matches(studentExpr,\"NA\")\n\nis_vector (Is the student's entry a vector with four entries?):\n matches(studentExpr,\"vector(`+- $n,`+- $n,`+- $n,`+- $n)\")\n\nstudentVector (Make the student Entries into a vector):\n if(is_vector,eval(studentExpr),false)\n\nhas_non_zero_fourth_entry (Does the student's answer have non-zero fourth entry?):\n correctif(is_vector and studentVector[3]<>0)\n\nmark:\n apply(studentExpr);\n apply(forbiddenStringsPenalty);\n apply(requiredStringsPenalty);\n apply(failMatchPattern);\n if(is_NA,\n incorrect(\"Your answer is incorrect.\"); end(),\n apply(has_non_zero_fourth_entry))", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "vector(0,0,0,1)", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "mustmatchpattern": {"pattern": "vector($n,$n,$n,$n)`|NA", "partialCredit": 0, "message": "You should input a vector with four entries, or NA.", "nameToCompare": ""}, "valuegenerators": []}], "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/"}]}