// Numbas version: exam_results_page_options {"name": "Mid-Ordinate Rule", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Mid-Ordinate Rule", "tags": [], "metadata": {"description": "Using the mid-ordinate rule with 5 ordinates to approximate $\\int_a^b{c^x}$", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

Using the mid-ordinate rule with {n} strips:

", "advice": "

The mid-ordinate rule states that $\\int^b_aydx\\approx h[(y_{0.5}+y_{1.5}+...+y_{n-0.5})]$ where $h=\\frac{b-a}{n}$

\n

In our example $a=\\var{a}, b=\\var{b}$ and $n=\\var{n}$ is the number of strips.

\n

Hence $h=\\frac{\\var{b}-\\var{a}}{\\var{n}}=\\var{h}$

\n

So $\\int^\\var{b}_\\var{a}{\\var{c}^x}dx\\approx\\var{h}[(y_{0.5}+y_{1.5}+y_{2.5}+y_{3.5}+y_{4.5}]$

\n

Our values of $x_i$ are given by $a+h \\times i=\\var{a}+\\var{h}\\times i$, as we vary $i$ from $0.5$ to $\\var{n-0.5}$ with step-size 1

\n

Thus we obtain $[x_{0.5},...,x_\\var{n-0.5}] = \\var{x}$

\n

Now we can calculate each $y_i$ as $y_i = y(x_i) = {\\var{c}^{x_i}}$

\n

Thus we obtain $[y_{0.5},...,y_\\var{n-0.5}] = \\var{y}$

\n

Hence $\\int^\\var{b}_\\var{a}{\\var{c}^x}dx\\approx \\var{h}[\\var{y[0]}+\\var{y[1]}+\\var{y[2]}+\\var{y[3]}+\\var{y[4]}] \\approx \\var{answer}$

\n

\n

\n
\n

\n

For comparison, the exact integral $\\int\\var{c}^x$ is given by $\\frac{\\var{c}^x}{\\ln{\\var{c}}}$. Hence the exact value of $\\int^\\var{b}_\\var{a}{\\var{c}^x}dx$ is $\\frac{\\var{c}^\\var{b}}{\\ln{\\var{c}}}-\\frac{\\var{c}^\\var{a}}{\\ln{\\var{c}}} = \\var{precround(exactanswer,5)}$

\n

\n

The mid-ordinate rule approximation to the area under the curve can be seen below. The convexity (increasing gradient) of the curve explains why in this case the mid-ordinate rule gives an underestimate of the true integral.

\n

{plotf(c,n,a,b)}

\n

 

\n

", "rulesets": {}, "extensions": ["jsxgraph"], "variables": {"a": {"name": "a", "group": "Ungrouped variables", "definition": "random(1 .. 4#1)", "description": "", "templateType": "randrange"}, "h": {"name": "h", "group": "Ungrouped variables", "definition": "random(0.2,0.4,0.5)", "description": "", "templateType": "anything"}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "5", "description": "", "templateType": "anything"}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "a+(n)*h", "description": "", "templateType": "anything"}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "random(1.5,2,2.5)", "description": "", "templateType": "anything"}, "x": {"name": "x", "group": "Ungrouped variables", "definition": "list(a+0.5*h..b#h)", "description": "", "templateType": "anything"}, "y": {"name": "y", "group": "Ungrouped variables", "definition": "map(precround(c^z,5),z,x)", "description": "", "templateType": "anything"}, "answer": {"name": "answer", "group": "Ungrouped variables", "definition": "precround(h*(y[0]+y[1]+y[2]+y[3]+y[4]),5)", "description": "", "templateType": "anything"}, "exactanswer": {"name": "exactanswer", "group": "Ungrouped variables", "definition": "(c^b-c^a)/ln(c)", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "a<>h", "maxRuns": 100}, "ungrouped_variables": ["a", "h", "n", "b", "c", "x", "y", "answer", "exactanswer"], "variable_groups": [], "functions": {"plotf": {"parameters": [["c", "number"], ["n", "number"], ["a", "number"], ["b", "number"]], "type": "html", "language": "javascript", "definition": "\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px', {axis:true,showNavigation:false, boundingbox:[a-0.25,Math.pow(c,b+0.25),b+0.25,-0.1*Math.pow(c,b+0.25)]});\nvar brd=div.board;\n//The function for which we are estimating the integral. \n//This dispays to the right\nvar f = function(x){ return (Math.pow(c,x)); };\nvar plot = brd.create('functiongraph',[f,0,b+1]);\nvar os = brd.create('riemannsum',[f,n,'middle',a, b ], \n{fillColor:'#ffff00', fillOpacity:0.3});\nreturn div;"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "3", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

Find an approximate value for $\\int_\\var{a}^\\var{b}{\\var{c}^x}dx$

", "minValue": "answer", "maxValue": "answer", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "contributors": [{"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}]}], "contributors": [{"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}