// Numbas version: finer_feedback_settings {"name": "Musa's copy of 3 solving equations graphically, x-y intercepts", "extensions": ["jsxgraph"], "custom_part_types": [{"source": {"pk": 2, "author": {"name": "Christian Lawson-Perfect", "pk": 7}, "edit_page": "/part_type/2/edit"}, "name": "List of numbers", "short_name": "list-of-numbers", "description": "
The answer is a comma-separated list of numbers.
\nThe list is marked correct if each number occurs the same number of times as in the expected answer, and no extra numbers are present.
\nYou can optionally treat the answer as a set, so the number of occurrences doesn't matter, only whether each number is included or not.
", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "join(\n if(settings[\"correctAnswerFractions\"],\n map(let([a,b],rational_approximation(x), string(a/b)),x,settings[\"correctAnswer\"])\n ,\n settings[\"correctAnswer\"]\n ),\n settings[\"separator\"] + \" \"\n)", "hint": {"static": false, "value": "if(settings[\"show_input_hint\"],\n \"Enter a list of numbers separated by{settings['separator']}
.\",\n \"\"\n)"}, "allowEmpty": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "bits:\nlet(b,filter(x<>\"\",x,split(studentAnswer,settings[\"separator\"])),\n if(isSet,list(set(b)),b)\n)\n\nexpected_numbers:\nlet(l,settings[\"correctAnswer\"] as \"list\",\n if(isSet,list(set(l)),l)\n)\n\nvalid_numbers:\nif(all(map(not isnan(x),x,interpreted_answer)),\n true,\n let(index,filter(isnan(interpreted_answer[x]),x,0..len(interpreted_answer)-1)[0], wrong, bits[index],\n warn(wrong+\" is not a valid number\");\n fail(wrong+\" is not a valid number.\")\n )\n )\n\nis_sorted:\nassert(sort(interpreted_answer)=interpreted_answer,\n multiply_credit(0.5,\"Not in order\")\n )\n\nincluded:\nmap(\n let(\n num_student,len(filter(x=y,y,interpreted_answer)),\n num_expected,len(filter(x=y,y,expected_numbers)),\n switch(\n num_student=num_expected,\n true,\n num_studentIs every number in the student's list valid?
", "definition": "if(all(map(not isnan(x),x,interpreted_answer)),\n true,\n let(index,filter(isnan(interpreted_answer[x]),x,0..len(interpreted_answer)-1)[0], wrong, bits[index],\n warn(wrong+\" is not a valid number\");\n fail(wrong+\" is not a valid number.\")\n )\n )"}, {"name": "is_sorted", "description": "Are the student's answers in ascending order?
", "definition": "assert(sort(interpreted_answer)=interpreted_answer,\n multiply_credit(0.5,\"Not in order\")\n )"}, {"name": "included", "description": "Is each number in the expected answer present in the student's list the correct number of times?
", "definition": "map(\n let(\n num_student,len(filter(x=y,y,interpreted_answer)),\n num_expected,len(filter(x=y,y,expected_numbers)),\n switch(\n num_student=num_expected,\n true,\n num_studentTrue if the student's list doesn't contain any numbers that aren't in the expected answer.
", "definition": "if(all(map(x in expected_numbers, x, interpreted_answer)),\n true\n ,\n incorrect(\"Your answer contains \"+extra_numbers[0]+\" but should not.\");\n false\n )"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "if(lower(studentAnswer) in [\"empty\",\"\u2205\"],[],\n map(\n if(settings[\"allowFractions\"],parsenumber_or_fraction(x,notationStyles), parsenumber(x,notationStyles))\n ,x\n ,bits\n )\n)"}, {"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(studentanswer=\"\",fail(\"You have not entered an answer\"),false);\napply(valid_numbers);\napply(included);\napply(no_extras);\ncorrectif(all_included and no_extras)"}, {"name": "notationStyles", "description": "", "definition": "[\"en\"]"}, {"name": "isSet", "description": "Should the answer be considered as a set, so the number of times an element occurs doesn't matter?
", "definition": "settings[\"isSet\"]"}, {"name": "extra_numbers", "description": "Numbers included in the student's answer that are not in the expected list.
", "definition": "filter(not (x in expected_numbers),x,interpreted_answer)"}], "settings": [{"name": "correctAnswer", "label": "Correct answer", "help_url": "", "hint": "The list of numbers that the student should enter. The order does not matter.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "allowFractions", "label": "Allow the student to enter fractions?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": false}, {"name": "correctAnswerFractions", "label": "Display the correct answers as fractions?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": false}, {"name": "isSet", "label": "Is the answer a set?", "help_url": "", "hint": "If ticked, the number of times an element occurs doesn't matter, only whether it's included at all.", "input_type": "checkbox", "default_value": false}, {"name": "show_input_hint", "label": "Show the input hint?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": true}, {"name": "separator", "label": "Separator", "help_url": "", "hint": "The substring that should separate items in the student's list", "input_type": "string", "default_value": ",", "subvars": false}], "public_availability": "always", "published": true, "extensions": []}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Musa's copy of 3 solving equations graphically, x-y intercepts", "tags": [], "metadata": {"description": "A quadratic equation (equivalent to $(x+a)^2-b$) is given and sketched. Three equations are given that can be solved using the graph. There is a chance there will only be one solution.
Finding X-Y intercepts for quadratic and cubic equations.
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "If there is more than one answer, enter them all but separated with commas.
\n-----------------------------------
", "advice": "See ??
", "rulesets": {}, "extensions": ["jsxgraph"], "variables": {"rand": {"name": "rand", "group": "part a", "definition": "shuffle(0..3)", "description": "", "templateType": "anything"}, "a": {"name": "a", "group": "part a", "definition": "random(1..5)", "description": "", "templateType": "anything"}, "x": {"name": "x", "group": "part a", "definition": "[ [-a],\n [-1-a,1-a],\n [-2-a,2-a],\n [-3-a,3-a]\n]", "description": "", "templateType": "anything"}, "b": {"name": "b", "group": "part a", "definition": "random(1..3)", "description": "", "templateType": "anything"}, "y": {"name": "y", "group": "part a", "definition": "[-b,-b+1,-b+4,-b+9]", "description": "", "templateType": "anything"}, "k": {"name": "k", "group": "part a", "definition": "random(-3..3 except 0)", "description": "", "templateType": "anything"}, "na": {"name": "na", "group": "part a", "definition": "random(-3..3 except 0)", "description": "", "templateType": "anything"}, "nb": {"name": "nb", "group": "part a", "definition": "random(-3..-1)*k", "description": "", "templateType": "anything"}, "x1": {"name": "x1", "group": "part a", "definition": "na-sqrt(-nb/k)", "description": "", "templateType": "anything"}, "x2": {"name": "x2", "group": "part a", "definition": "na+sqrt(-nb/k)", "description": "", "templateType": "anything"}, "k2": {"name": "k2", "group": "Ungrouped variables", "definition": "random(-3..3 except 0)", "description": "", "templateType": "anything"}, "na2": {"name": "na2", "group": "part a", "definition": "random(-5..5 except 0)", "description": "", "templateType": "anything"}, "xi": {"name": "xi", "group": "part a", "definition": "random(-3,-2,-1,1,2,3)", "description": "", "templateType": "anything"}, "nb2": {"name": "nb2", "group": "part a", "definition": "(xi^3)*k2", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["k2"], "variable_groups": [{"name": "part a", "variables": ["a", "b", "y", "x", "rand", "k", "na", "nb", "x1", "x2", "na2", "xi", "nb2"]}], "functions": {"plot": {"parameters": [["a", "number"], ["b", "number"]], "type": "html", "language": "javascript", "definition": "// This functions plots a quadratic graph of the form y = (x+a)^2 - b\n\n\n// Max and min x and y values for the axis.\nvar x_min = -10;\nvar x_max = 4;\nvar y_min = -6;\nvar y_max = 10;\n\n\n// First, make the JSXGraph board.\nvar div = Numbas.extensions.jsxgraph.makeBoard(\n '500px',\n '600px',\n {\n boundingBox: [x_min,y_max,x_max,y_min],\n axis: false,\n showNavigation: true,\n grid: true\n }\n);\n\n\n\n\n// div.board is the object created by JSXGraph, which you use to \n// manipulate elements\nvar board = div.board; \n\n// create the x-axis and y-axis\nvar xaxis = board.create('axis',[[0,0],[1,0]]);\n\n// create the y-axis\nvar yaxis = board.create('axis',[[0,0],[0,1]], );\n\n\n\n\n// Plot the function.\n board.create('functiongraph',\n [function(x){ return (x+a)*(x+a)-b},x_min,x_max]);\n\n\n\nreturn div;"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "Below is the graph of the quadratic function $y=\\simplify{x^2 + {2*a}*x + {a^2-b}}$.
\n{plot(a,b)}
\n\nUse the graph to solve the following equations.
\n\n$\\simplify{x^2 + {2*a}*x + {a^2-b}}=\\var{y[rand[0]]}$
\n[[0]]
\n\nUse the graph to determine the coordinates of the minimum point.
\n[[1]]
\n", "gaps": [{"type": "list-of-numbers", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "settings": {"correctAnswer": "x[rand[0]]", "allowFractions": true, "correctAnswerFractions": true}}, {"type": "matrix", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "correctAnswer": "{matrix([-a,-b])}", "correctAnswerFractions": false, "numRows": 1, "numColumns": "2", "allowResize": false, "tolerance": 0, "markPerCell": false, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "Given cubic function $ y=\\simplify{{k2}*(x + {na2})^3 + {nb2}} $ find
\n