// Numbas version: finer_feedback_settings {"name": "Thinking about Integrals (draft)", "metadata": {"description": "", "licence": "Creative Commons Attribution-ShareAlike 4.0 International"}, "duration": 0, "percentPass": 0, "showQuestionGroupNames": false, "shuffleQuestionGroups": false, "showstudentname": true, "question_groups": [{"name": "Group", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": [""], "variable_overrides": [[]], "questions": [{"name": "Derivatives", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "feedback": {"showactualmarkwhen": "always", "showtotalmarkwhen": "always", "showanswerstatewhen": "always", "showpartfeedbackmessageswhen": "always", "allowrevealanswer": true, "showexpectedanswerswhen": "inreview", "showadvicewhen": "inreview"}, "contributors": [{"name": "Fern Gossow", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/38158/"}], "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution-ShareAlike 4.0 International"}, "statement": "", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [], "functions": {"derivative": {"parameters": [], "type": "html", "language": "javascript", "definition": "// Derivative at discrete points\n\nconst div = Numbas.extensions.jsxgraph.makeBoard('400px', '400px', {\n boundingBox: [-0.08, 1.08, 1.08, -0.08],\n axis: true,\n defaultAxes: {\n x: {highlight: false, \n ticks: {\n generateLabelText: function (tick, zero) {\n return 't+' + (tick.usrCoords[1]-zero.usrCoords[1]).toFixed(1);\n },\n ticksDistance: 0.2,\n insertTicks: false,\n majorHeight: 4, minorHeight: 4\n }\n },\n y: {highlight: false, \n ticks: {majorHeight: 5, minorHeight: 5,\n minorTicks: 4\n }}\n },\n pan: {enabled: false}, zoom: {enabled: false}\n});\n\nconst board = div.board;\n\nlet discrete = true;\n\nconst f = function(x) {\n return 0.3 + 2*x - 1.8*x*x;\n}\n\nvar pts = [];\nfor (let i=1; i<6; i++) {\n pts.push(board.create('point', [\n 0.2*i, f(0.2*i)\n ], {\n withLabel: false, showInfobox: false,\n highlight: false,\n visible: function() {return discrete;}\n }));\n}\n\n\nconst curve = board.create('functiongraph', [\n f, 0.001, 1.05\n], {\n strokeWidth: 3,\n highlight: false, fixed: true,\n strokeOpacity: function() {return discrete ? 0 : 1;}\n})\n\nconst p = board.create('point', [\n 0, 0.3\n], {\n withLabel: false, showInfobox: false,\n highlight: false, fixed: true,\n fillColor: \"black\", strokeColor: \"black\"\n})\n\nconst q = board.create('glider', [\n 1, 0.5, curve\n], {\n withLabel: false, showInfobox: false,\n highlight: false,\n fillColor: \"black\", strokeColor: \"black\",\n})\n\nconst line = board.create('line', [\n p, q\n], {\n highlight: false,\n strokeColor: \"red\"\n})\n\nconst rate = board.create('text', [\n 0.53, 0.1, \n function() {\n var x = q.X();\n if (discrete) {\n return \"$$\\\\frac{Q_{t+\" + x.toFixed(1) + \"}-Q_t}{\" + x.toFixed(1) + \n \"} = \\\\frac{\" + (f(x)-f(0)).toFixed(3) + \"}{\" + x.toFixed(1) + \"}=\" +\n ((f(x)-f(0))/x).toFixed(2) + \"$$\";\n } else {\n return \"$$\\\\frac{Q(t+\" + x.toFixed(3) + \")-Q(t)}{\" + x.toFixed(3) + \n \"} = \\\\frac{\" + (f(x)-f(0)).toFixed(3) + \"}{\" + x.toFixed(3) + \"}=\" +\n ((f(x)-f(0))/x).toFixed(3) + \"$$\";\n }\n }\n], {\n highlight: false, fixed: true,\n fontSize: 18,\n anchorX: \"middle\"\n})\n\n\nfunction snapToNearestPt() {\n // Find the best point using Euclidean metric\n const nearest = pts.reduce((best, pt) =>\n Math.hypot(pt.X() - q.X(), pt.Y() - q.Y()) <\n Math.hypot(best.X() - q.X(), best.Y() - q.Y())\n ? pt\n : best\n );\n\n q.moveTo([nearest.X(), nearest.Y()], 0);\n}\n\nq.on('drag', function () {\n if (discrete) {\n snapToNearestPt();\n }\n});\n\n\nconst toggle = board.create('button', [\n 0.7, 1.01, 'Discrete',\n function () {\n discrete = !discrete;\n toggle.setText(discrete ? 'Discrete' : 'Continuous');\n\n if (discrete) {\n snapToNearestPt();\n board.update();\n }\n }\n], {\n fontSize: 18,\n highlight: false, fixed: true,\n cssStyle: 'width: 120px'\n});\n\nreturn div;"}}, "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, "adaptiveMarkingUseCondition": "", "adaptiveMarkingNotUsedMessage": "", "exploreObjective": null, "prompt": "

Calculus is an extremely useful tool for modelling physical phenomena, because it allows us to reason about continuous data. We will briefly recap derivatives and integrals, which we will argue should be thought about continuous differences and continuous sums respectively. This will allow us to generalise the concept of integrals to many other situations, far beyond the usual interpretation of simply being the \"area under a curve\".

\n

Imagine you have a quantity $Q$ which you want to measure over time. More specifically, you want to understand how quickly the quantity $Q$ changes.

\n

In the real-world, you can only take measurements at discrete time points. Suppose at time $t$ seconds the quantity has value $Q_t$ and at some later time $t+h$ it has value $Q_{t+h}$. The total change in the quantity was $\\Delta Q=Q_{t+h}-Q_{t}$ and this happened over a period of $\\Delta t=(t+h)-t=h$ seconds. Therefore, the overall rate of change per second was \\[\\frac{\\Delta Q}{\\Delta t}=\\frac{Q_{t+h}-Q_t}{h}.\\]

\n

Drag the right point on the line closer to the left point, and observe how this affects the rate of change. For example, the rate of change between $t$ and $t+0.4$ is [[0]].

\n

{derivative()}

\n

Now imagine we have a model for the function $Q$, which means we can find $Q(t)$ for any real number $t$. Press the button in the top-right corner of the diagram to switch to this model. The rate of change between $t$ and $t+0.25$ is [[1]].

\n

The derivative of $Q$ (with respect to $t$) is the instantaneous rate of change at time $t$, which is obtained by making the sampled points closer and closer together. Formally,

\n

$$\\frac{\\mathrm{d}Q}{\\mathrm{d}t}=\\lim_{h\\to 0}\\frac{Q(t+h)-Q(t)}{h}$$

\n

In the above model, the instantaneous rate of change at $t$ is [[2]].
(Hint: the answer is an integer)

\n
\n

Importantly, the derivative is measuring a difference (note the subtraction in the formula). But for continuous data, differences can be made infinitesimally small, so the more useful quantity is the proportion of how much the output changes against an infinitesimal change in the input.

\n

The inverse operation, known as the integral, will be the continuous version of a sum. In a discrete sum, we have finitely many things of finite size that are being added together. But when working with continuous data, we can make the pieces smaller and smaller in exchange for having more of them. Therefore, the integral tells us how to add an infinitely many pieces of infinitesimal size.

\n

Time to see many examples of this!

", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "rate1", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "adaptiveMarkingUseCondition": "", "adaptiveMarkingNotUsedMessage": "", "exploreObjective": null, "minValue": "1.28", "maxValue": "1.28", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "rate2", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "adaptiveMarkingUseCondition": "", "adaptiveMarkingNotUsedMessage": "", "exploreObjective": null, "minValue": "1.55-0.05", "maxValue": "1.55+0.05", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "rate3", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "adaptiveMarkingUseCondition": "", "adaptiveMarkingNotUsedMessage": "", "exploreObjective": null, "minValue": "2", "maxValue": "2", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false, "inlineCorrectAnswer": true}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "showAllParts": false}]}], "allowPrinting": true, "navigation": {"allowregen": true, "reverse": true, "browse": true, "allowsteps": true, "showfrontpage": false, "navigatemode": "sequence", "onleave": {"action": "none", "message": ""}, "preventleave": true, "typeendtoleave": false, "startpassword": "", "autoSubmit": true, "allowAttemptDownload": false, "downloadEncryptionKey": "", "showresultspage": "oncompletion"}, "timing": {"allowPause": true, "timeout": {"action": "none", "message": ""}, "timedwarning": {"action": "none", "message": ""}}, "feedback": {"enterreviewmodeimmediately": true, "showactualmarkwhen": "always", "showtotalmarkwhen": "always", "showanswerstatewhen": "always", "showpartfeedbackmessageswhen": "never", "showexpectedanswerswhen": "never", "showadvicewhen": "never", "allowrevealanswer": true, "intro": "", "end_message": "", "results_options": {"printquestions": true, "printadvice": true}, "feedbackmessages": [], "reviewshowexpectedanswer": false, "showanswerstate": false, "reviewshowfeedback": true, "showactualmark": true, "showtotalmark": true, "reviewshowscore": true, "reviewshowadvice": false}, "diagnostic": {"knowledge_graph": {"topics": [], "learning_objectives": []}, "script": "diagnosys", "customScript": ""}, "contributors": [{"name": "Fern Gossow", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/38158/"}], "extensions": ["jsxgraph"], "custom_part_types": [], "resources": []}