// Numbas version: exam_results_page_options {"name": "blackfyre's copy of Functions: approximate area under graph", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"advice": "

See Lecture 4.1, Workshop 4.2, and the previous questions in this online exercise.

\n

(If you have studied integration before, it would be worthwhile to attempt the appropriate integration and compare the exact area with this estimated value).

", "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["a", "b", "c", "x0", "x", "fx", "total"], "functions": {"plotgraph": {"language": "javascript", "parameters": [["a", "number"], ["b", "number"], ["c", "number"], ["num", "number"]], "type": "html", "definition": "// Shading under a graph! This functions plots a graph of y = a(x-r1)(x-r2)\n// It creates the board, sets it up, then returns an\n// HTML div tag containing the board.\n\n\n// Max and min x and y values for the axis.\nvar xmin = -2;\nvar xmax = 8;\nvar ymin = -10;\nvar ymax = 100;\n\n// First, make the JSXGraph board.\nvar div = Numbas.extensions.jsxgraph.makeBoard(\n '500px',\n '500px',\n {\n boundingBox: [xmin,ymax,xmax,ymin],\n axis: false,\n showNavigation: false,\n grid: false\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.\nvar xaxis = board.create('line',[[0,0],[1,0]], { strokeColor: 'black', fixed: true});\nvar xticks = board.create('ticks',[xaxis,1],{\n drawLabels: true,\n label: {offset: [-4, -10]},\n minorTicks: 1\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,10],{\ndrawLabels: true,\nlabel: {offset: [-20, 0]},\nminorTicks: 0\n});\n\n\n\n// This function shades in the area below the graph of f\n// between the x values x1 and x2\n\nvar shade = function(f,x1,x2,colour,opacity) {\n var dataX1 = [x1,x1];\n var dataY1 = [0,f(x1)];\n\n var dataX2 = [];\n var dataY2 = [];\n for (var i = x1; i <= x2; i = i+0.1) {\n dataX2.push(i);\n dataY2.push(f(i));\n }\n\n var dataX3 = [x2,x2];\n var dataY3 = [f(x2),0];\n\n dataX = dataX1.concat(dataX2).concat(dataX3);\n dataY = dataY1.concat(dataY2).concat(dataY3);\n\nvar shading = board.create('curve', [dataX,dataY],{strokeWidth:0, fillColor:colour, fillOpacity:opacity});\n\nreturn shading;\n}\n\n\n//Define your functions\nvar f = function(x) {\n return a*(x-b)*(c-x);\n}\n\n\nvar f1 = function(x) {\n return a*(c-4-b)*(c-c+4);\n}\n\nvar f2 = function(x) {\n return a*(c-3-b)*(c-c+3);\n}\n\nvar f3 = function(x) {\n return a*(c-2-b)*(c-c+2);\n}\n\nvar f4 = function(x) {\n return a*(c-1-b)*(c-c+1);\n}\n\n\n\n//Plot the graph and do shading\nboard.create('functiongraph', [f]);\n\n\n\nswitch(num) {\n case 1:\n shade(f,c-4,c, 'red',0.2);\n break;\n case 2:\n for (i = 0; i < 8; i++) { \n var g = function(x) {\n return a*(c-(4-0.5*i)-b)*(c-(c-(4-0.5*i))); //defining horizontal function for ith column\n }\n if (i%2 == 0) { \n shade(g,c-(4-0.5*i),c-(4-0.5*(i+1)), 'blue',0.2); //shading ith column blue if i even\n } else {\n shade(g,c-(4-0.5*i),c-(4-0.5*(i+1)), 'green',0.6); // shading ith column green if i odd\n }\n } \n board.create('ellipse',[[c-4,f(c-4)+0.995],[c-4,f(c-4)-0.995],[c-4,f(c-4)+1]],{color:'black'});\n //brd.create('circle',[[c-4,f(c-4)],0.1],{color:'black'}); //adding a point\n board.create('text',[c-4,a*(c-4-b)*(c-c+4)+3,'A']);\n board.create('ellipse',[[c-3.5,f(c-3.5)+0.995],[c-3.5,f(c-3.5)-0.995],[c-3.5,f(c-3.5)+1]],{color:'black'});\n board.create('text',[c-3.5,a*(c-3.5-b)*(c-c+3.5)+3,'B']);\n break;\n}\n \n\n\nreturn div;"}}, "variables": {"fx": {"name": "fx", "definition": "vector([a*(x[0]-b)*(c-x[0]),\n a*(x[1]-b)*(c-x[1]),\n a*(x[2]-b)*(c-x[2]),\n a*(x[3]-b)*(c-x[3]),\n a*(x[4]-b)*(c-x[4]),\n a*(x[5]-b)*(c-x[5]),\n a*(x[6]-b)*(c-x[6]),\n a*(x[7]-b)*(c-x[7])])\n\n ", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "total": {"name": "total", "definition": "sum(fx)*0.5", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "x": {"name": "x", "definition": "[x0,x0+0.5,x0+1,x0+1.5,x0+2,x0+2.5,x0+3,x0+3.5]", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "a": {"name": "a", "definition": "random(3)", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "b": {"name": "b", "definition": "random(-5..-2)", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "x0": {"name": "x0", "definition": "random(1..2)", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "c": {"name": "c", "definition": "x0+4", "group": "Ungrouped variables", "templateType": "anything", "description": ""}}, "parts": [{"scripts": {}, "type": "gapfill", "showFeedbackIcon": true, "gaps": [{"markPerCell": false, "numRows": 1, "showFeedbackIcon": true, "correctAnswer": "matrix([x[0],fx[0]])", "variableReplacements": [], "allowResize": false, "variableReplacementStrategy": "originalfirst", "marks": 1, "showCorrectAnswer": true, "scripts": {}, "type": "matrix", "tolerance": 0, "numColumns": "2", "allowFractions": false, "correctAnswerFractions": false}, {"markPerCell": false, "numRows": 1, "showFeedbackIcon": true, "correctAnswer": "matrix([x[1],fx[1]])", "variableReplacements": [], "allowResize": false, "variableReplacementStrategy": "originalfirst", "marks": 1, "showCorrectAnswer": true, "scripts": {}, "type": "matrix", "tolerance": 0, "numColumns": "2", "allowFractions": true, "correctAnswerFractions": false}, {"minValue": "{total}", "showFeedbackIcon": true, "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "marks": "3", "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "maxValue": "{total}", "allowFractions": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerFraction": false, "mustBeReduced": false}, {"minValue": "", "showFeedbackIcon": true, "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "marks": 1, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "maxValue": "", "allowFractions": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerFraction": false, "mustBeReduced": false}, {"markPerCell": false, "numRows": 1, "showFeedbackIcon": true, "correctAnswer": "", "variableReplacements": [], "allowResize": true, "variableReplacementStrategy": "originalfirst", "marks": 1, "showCorrectAnswer": true, "scripts": {}, "type": "matrix", "tolerance": 0, "numColumns": 1, "allowFractions": false, "correctAnswerFractions": false}, {"displayColumns": 0, "showFeedbackIcon": true, "choices": ["Choice 1", "Choice 2", "Choice 3"], "distractors": ["", "", ""], "shuffleChoices": false, "variableReplacementStrategy": "originalfirst", "minMarks": 0, "showCorrectAnswer": true, "scripts": {}, "type": "1_n_2", "displayType": "radiogroup", "marks": 0, "maxMarks": 0, "matrix": [0, 0, 0], "variableReplacements": []}], "prompt": "

Below is the graph of the function $v(t) =\\simplify{{a}(t-{b})*({c}-t)}$.  We would like to calculate the area of the shaded region.

\n

{plotgraph(a,b,c,1)}

\n

\n

$v(t) = \\simplify{{a}(t-{b}*({c}-t))}$

\n

\n

You will learn how to do this in Maths 2 (using so-called integration), but for now we will just estimate the area. We do this by calculating the area of the columns, as in the diagram below:

\n

{plotgraph(a,b,c,2)}

\n

\n

To save you scrolling, the function was $v(t) =\\simplify{{a}(t-{b})*({c}-t)}$.

\n

(i) What are the coordinates of the points A and B?

\n

A. [[0]]

\n

B. [[1]]

\n

\n

(ii) By completing a table like the one below, determine the total area of the columns.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
WidthHeightArea
Column 1
Column 2
Column 3
Column 4
Column 5
Column 6
Column 7
Column 8
\n

Total area of columns  = [[2]]

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "marks": 0}], "name": "blackfyre's copy of Functions: approximate area under graph", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Graphs are given with areas underneath them shaded. The area of the shaded regions are given and from this the value of various integrals are to be deduced.

"}, "preamble": {"css": "", "js": ""}, "variable_groups": [], "tags": [], "statement": "

This is a calculator question.

", "extensions": ["jsxgraph"], "rulesets": {}, "type": "question", "contributors": [{"name": "blackfyre blackfyre", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2008/"}]}]}], "contributors": [{"name": "blackfyre blackfyre", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2008/"}]}