// Numbas version: exam_results_page_options {"name": "Area under the curve - below x-axis", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"preamble": {"js": "", "css": ""}, "ungrouped_variables": ["a", "x2", "b", "y2", "c", "ans"], "advice": "

Recall that the area under a curve $f(x)$ between $x=a$ and $x=b$ is given by $\\int^b_a f(x) \\mathrm{d}x$

\n

Hence we calculate $\\int^\\var{y2}_\\simplify{{a}+1} (\\simplify{-x^2+({a}+{b})x-{a}{b}}) \\mathrm{d}x = \\simplify[all,fractionnumbers]{(-({y2})^3/3+({a}+{b})({y2})^2/2-{a}{b}({y2}))-(-({a}+1)^3/3+({a}+{b})({a}+1)^2/2-{a}{b}({a}+1))={ans}}$

\n

Note that the area under the curve is always positive yet out answer here is negative, so we must remember to multiply our answer by $-1$

", "metadata": {"description": "

Find the area under a curve. The step is given.

", "licence": "Creative Commons Attribution 4.0 International"}, "variable_groups": [], "variablesTest": {"maxRuns": "10000", "condition": "{a}>{b}\nand\n{y2}-1>{a}\nand {y2}<3*{a}"}, "parts": [{"steps": [{"customName": "", "variableReplacementStrategy": "originalfirst", "type": "information", "customMarkingAlgorithm": "", "scripts": {}, "showFeedbackIcon": true, "useCustomName": false, "variableReplacements": [], "prompt": "

You need to find the integral of $\\simplify{y =-x^2+({a}+{b})x-{a}{b}}$, then the definite inegral by substituting $x=\\simplify{({a}+1)}$ to $x=\\simplify{{y2}}$.

\n

Remember the answer is negative because the area is below the x-axis. You need to give the positive answer.

", "unitTests": [], "showCorrectAnswer": true, "marks": 0, "extendBaseMarkingAlgorithm": true}], "variableReplacementStrategy": "originalfirst", "checkingType": "absdiff", "customMarkingAlgorithm": "", "type": "jme", "showFeedbackIcon": true, "useCustomName": false, "checkingAccuracy": "0.01", "prompt": "

Find the area under the curve from $x=\\simplify{({a}+1)}$ to $x=\\simplify{{y2}}$

\n

Give your answer accurate to 2 decimal places.

", "answer": "-{ans}", "vsetRangePoints": 5, "showCorrectAnswer": true, "marks": "1", "checkVariableNames": false, "valuegenerators": [], "customName": "", "stepsPenalty": 0, "showPreview": true, "scripts": {}, "variableReplacements": [], "unitTests": [], "vsetRange": [0, 1], "extendBaseMarkingAlgorithm": true, "failureRate": 1, "answerSimplification": "all,fractionnumbers"}], "tags": [], "statement": "

{eqnline(a,b,x2,y2)}

\n

You are given a quadratic graph of $\\simplify{y =-x^2+({a}+{b})x-{a}{b}}$

", "variables": {"y2": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "a+c", "name": "y2"}, "c": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "random(1..4)", "name": "c"}, "a": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "random(-4..5 except 0)", "name": "a"}, "b": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "random(-5..5 except [0,a,-a])", "name": "b"}, "ans": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "(-({y2})^3/3+({a}+{b})({y2})^2/2-{a}*{b}*({y2}))-(-({a}+1)^3/3+({a}+{b})({a}+1)^2/2-{a}*{b}*({a}+1))", "name": "ans"}, "x2": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "random(-3..3 except -1..1)", "name": "x2"}}, "rulesets": {}, "functions": {"eqnline": {"parameters": [["a", "number"], ["b", "number"], ["x2", "number"], ["y2", "number"]], "type": "html", "language": "javascript", "definition": "// This function creates the board and sets it up, then returns an\n// HTML div tag containing the board.\n \n// The line is described by the equation \n// y = a*x + b\n\n// This function takes as its parameters the coefficients a and b,\n// and the coordinates (x2,y2) of a point on the line.\n\n// First, make the JSXGraph board.\n// The function provided by the JSXGraph extension wraps the board up in \n// a div tag so that it's easier to embed in the page.\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',\n{boundingBox: [-13,22,13,-22],\n axis: false,\n showNavigation: false,\n grid: true\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.\nvar xaxis = board.create('line',[[0,0],[1,0]], { strokeColor: 'black', fixed: true});\nvar xticks = board.create('ticks',[xaxis,2],{\n drawLabels: true,\n label: {offset: [-4, -10]},\n minorTicks: 0\n});\n\n// create the y-axis\nvar yaxis = board.create('line',[[0,0],[0,1]], { strokeColor: 'black', fixed: true });\nvar yticks = board.create('ticks',[yaxis,2],{\ndrawLabels: true,\nlabel: {offset: [-20, 0]},\nminorTicks: 0\n});\n\n// mark the two given points - one on the y-axis, and one at (x2,y2)\n\n\n\n\nboard.create('functiongraph',[function(x){ return (-x+a)*(x-b);},-13,13]);\n\nboard.create('segment',[[a+1,0],[a+1,-(a+1-b)]]);\nboard.create('segment',[[y2,0],[y2,-(y2*y2-y2*b-y2*a+a*b)]]);\n\n\n\nreturn div;"}}, "extensions": ["jsxgraph"], "name": "Area under the curve - below x-axis", "contributors": [{"name": "Jean jinhua Mathias", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/353/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}]}], "contributors": [{"name": "Jean jinhua Mathias", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/353/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}