// Numbas version: finer_feedback_settings {"name": "Alan's copy of Numbas demo: Motion under gravity", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Alan's copy of Numbas demo: Motion under gravity", "variables": {"t1": {"definition": "precround(t,2)", "description": "", "name": "t1", "group": "Ungrouped variables", "templateType": "anything"}, "g": {"definition": "9.81", "description": "", "name": "g", "group": "Ungrouped variables", "templateType": "anything"}, "v": {"definition": "random(50..100)", "description": "", "name": "v", "group": "Ungrouped variables", "templateType": "anything"}, "t": {"definition": "V/g", "description": "", "name": "t", "group": "Ungrouped variables", "templateType": "anything"}, "mh": {"definition": "precround(V^2/(2*g),2)", "description": "", "name": "mh", "group": "Ungrouped variables", "templateType": "anything"}}, "variable_groups": [], "advice": "

a)

\n

Integrating $\\displaystyle{\\frac{\\mathrm{d}^2z}{\\mathrm{d}t^2}=-g}$ once gives the velocity $\\displaystyle{\\frac{\\mathrm{d}z}{\\mathrm{d}t}=-gt+A}$.

\n

But $A=\\var{v}$ as the velocity is $\\var{V}\\;m/s$ at $t=0$.

\n

So the velocity is

\n

\\begin{align} \\frac{\\mathrm{d}z}{\\mathrm{d}t} &= \\var{v}-gt & (1) \\end{align}

\n

Integrating again gives

\n

\\[ z = \\var{v}t-\\frac{g}{2}t^2+B \\]

\n

and $B=0$ as $z=0$ at $t=0$.

\n

Hence the distance travelled upwards is given by

\n

\\begin{align} z &= \\var{v}t-\\frac{g}{2}t^2 & (2) \\end{align}

\n

{advicegraph()}

\n

b)

\n

The time $t_{\\text{max}}$ taken to reach maximum height is the time satisfying $\\displaystyle{\\frac{dz}{dt}=0}$

\n

$t_{\\text{max}}$ is given from equation $(1)$ by

\n

\\begin{align}
\\var{v} - gt_{\\text{max}} &= 0 \\\\
gt_{\\text{max}} &= \\var{v} \\\\
t_{\\text{max}} &= \\frac{\\var{v}}{g} \\\\[0.5em]
&= \\frac{\\var{v}}{9.81} \\\\[0.5em]
&= \\var{t1}
\\end{align}

\n

(to $2$ decimal places)

\n

This is at the point $A$ in the graph above.

\n

c)

\n

The maximum height $z_{\\text{max}}$ is given from equation $(2)$ by substituting in the value $t_{\\text{max}}= \\var{v}/g$, giving

\n

\\begin{align}
z_{\\text{max}} &= \\var{v} \\times \\frac{\\var{v}}{g} - \\frac{g}{2}\\left(\\frac{\\var{v}}{g}\\right)^2 \\\\
&= \\frac{\\var{v}^2}{g}-\\frac{g\\var{v}^2}{2g^2} \\\\
&= \\frac{\\var{v}^2}{2g} \\\\
&= \\var{mh}\\;m
\\end{align}

\n

(to $2$ decimal places)

\n

This is at the point $B$ in the graph above.

", "ungrouped_variables": ["t", "v", "mh", "g", "t1"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "statement": "

A Numbas question can include interactive graphics, such as this plot of the trajectory given by the student's answer.

\n

See this question in the public editor

\n

A ball is thrown upwards, and moves according to the equation $\\displaystyle{\\frac{d^2z}{dt^2}=-g}$
(where $z(t)$ is distance in metres measured upwards from the ground and the constant acceleration of gravity, $g$ , is given as $9.81\\;m/s^2$).

\n

The ball is projected upwards with a speed $\\var{v}\\;m/s$.

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

Customised for the Numbas demo exam

\n

Motion under gravity. Object is projected vertically with initial velocity $V\\;m/s$. Find time to maximum height and the maximum height. Now includes an interactive plot.

", "licence": "Creative Commons Attribution 4.0 International"}, "functions": {"advicegraph": {"type": "html", "definition": "var v = Numbas.jme.unwrapValue(scope.variables.v);\nvar mh = Numbas.jme.unwrapValue(scope.variables.mh);\nvar t = Numbas.jme.unwrapValue(scope.variables.t1);\nvar g = Numbas.jme.unwrapValue(scope.variables.g);\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',\n {boundingBox:[-3,mh+50,2*t+2,-50],\n axis:false,\n showNavigation:false,\n grid:false});\nvar brd = div.board; \n var xas = brd.create('line',[[0,0],[1,0]], { strokeColor: 'black',fixed:true});\n var xticks = brd.create('ticks',[xas,1],{\ndrawLabels: true,\nlabel: {offset: [-4, -10]},\nminorTicks: 0\n });\n var yas = brd.create('line',[[0,0],[0,1]], { strokeColor: 'black',fixed:true});\n var yticks = brd.create('ticks',[yas,50],{\ndrawLabels: true,\nlabel: {offset: [-20, 0]},\nminorTicks: 0\n }); \nfunction traj(x){return v*x-g*Math.pow(x,2)/2;}\nvar p=brd.create('point',[0,0],{fixed:true,name:'',size:1});\n//var q=brd.create('line',[[0,0],[1,v]],{fixed:true,name:'',dash:2});\nvar r=brd.create('point',[t,0],{fixed:true,name:'A',size:1});\nvar s=brd.create('point',[t,mh],{fixed:true,name:'B',size:1});\nvar maxh=brd.create(\"segment\",[[0,mh],[t,mh]],{dash:1,strokeColor:'green'});\nvar gr=brd.create(\"functiongraph\",[traj,0,2*t],{strokeColor:'blue',strokeWidth:2});\nvar halft=brd.create(\"segment\",[[t,0],[t,traj(t)]],{dash:1,strokeColor:'green'});\nreturn div;", "parameters": [], "language": "javascript"}, "graphsolution": {"type": "html", "definition": "var v = Numbas.jme.unwrapValue(scope.variables.v);\nvar mh = Numbas.jme.unwrapValue(scope.variables.mh);\nvar t = Numbas.jme.unwrapValue(scope.variables.t1);\nvar g = Numbas.jme.unwrapValue(scope.variables.g);\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',\n {boundingBox:[-3,mh+10,2*t+2,-50],\n axis:false,\n showNavigation:false,\n grid:false});\nvar brd = div.board; \n var xas = brd.create('line',[[0,0],[1,0]], { strokeColor: 'black',fixed:true});\n var xticks = brd.create('ticks',[xas,1],{\ndrawLabels: true,\nlabel: {offset: [-4, -10]},\nminorTicks: 0\n });\n var yas = brd.create('line',[[0,0],[0,1]], { strokeColor: 'black',fixed:true});\n var yticks = brd.create('ticks',[yas,50],{\ndrawLabels: true,\nlabel: {offset: [-20, 0]},\nminorTicks: 0\n }); \nvar p=brd.create('point',[0,0],{fixed:true,name:'',size:1});\nvar q=brd.create('line',[[0,0],[1,v]],{fixed:true,name:'',dash:2});\nvar tree;\n//x is the variable in the equation to be input\n var nscope = new Numbas.jme.Scope([scope,{variables:{t:new Numbas.jme.types.TNum(0)}}]);\n//create a functiongraph from the student input\nfunction userf(t){\nif(tree) {\n try {\nnscope.variables.t.value = t;\n//the user input is evaluated at x=t\n var val = Numbas.jme.evaluate(tree,nscope).value;\n return val;\n }\n catch(e) {\nreturn 0;\n }\n}\nelse\n return 0;\n}\nvar curve=brd.create('functiongraph',[userf,0,2*t],{strokeColor:'red',strokeWidth:2});\n\n //pick up the student answer and is parsed\n question.signals.on('HTMLAttached',function(e) {\nko.computed(function(){\nvar expr = question.parts[0].gaps[0].display.studentAnswer();\ntry {\n tree = Numbas.jme.compile(expr,scope);\n}\ncatch(e) {\n tree = null;\n}\ncurve.updateCurve();\n\nbrd.update();\n});\n }); \n\nreturn div;\n ", "parameters": [], "language": "javascript"}}, "preamble": {"css": "", "js": ""}, "tags": [], "extensions": ["jsxgraph"], "variablesTest": {"maxRuns": 100, "condition": ""}, "parts": [{"scripts": {}, "prompt": "

{graphsolution()}

\n

Input the vertical distance $z$ as a  function of $t$.

\n

Note that at $t=0$ we have $z=0$ and that $\\displaystyle \\frac{dz}{dt}=\\var{v}m/s$.

\n

Input gravitational acceleration as $g$.

\n

$z=$ [[0]]

\n

Your formula is plotted in the graph above. The vertical axis represents $z$ and the horizontal axis represents $t$.

\n

Note that the blue line indicates that:

\n
    \n
  1. Your solution should go through $(0,0)$;
  2. \n
  3. Your solution should have this line as the tangent to the curve at $(0,0)$, because $\\displaystyle \\frac{\\mathrm{d}z}{\\mathrm{d}t}=\\var{v}\\; m/s$.
  4. \n
", "customMarkingAlgorithm": "", "unitTests": [], "gaps": [{"showPreview": true, "vsetRangePoints": 5, "valuegenerators": [{"value": "", "name": "g"}, {"value": "", "name": "t"}], "adaptiveMarkingPenalty": 0, "customName": "", "scripts": {}, "unitTests": [], "failureRate": 1, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "checkingAccuracy": 0.001, "checkVariableNames": true, "showCorrectAnswer": true, "vsetRange": [0, 1], "marks": 1, "type": "jme", "extendBaseMarkingAlgorithm": true, "answer": "{v}t-1/2g*t^2", "useCustomName": false, "showFeedbackIcon": true, "variableReplacements": [], "checkingType": "absdiff"}], "marks": 0, "adaptiveMarkingPenalty": 0, "customName": "", "type": "gapfill", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "useCustomName": false, "showFeedbackIcon": true, "variableReplacements": [], "sortAnswers": false}, {"scripts": {}, "prompt": "

Time taken to reach maximum height = [[0]] $s$ (accurate to $2$ decimal places)

\n

Maximum height = [[1]] $m$ (accurate to $2$ decimal places)

", "customMarkingAlgorithm": "", "unitTests": [], "gaps": [{"mustBeReducedPC": 0, "minValue": "t1", "showPrecisionHint": false, "adaptiveMarkingPenalty": 0, "customName": "", "correctAnswerFraction": false, "scripts": {}, "unitTests": [], "allowFractions": false, "variableReplacementStrategy": "originalfirst", "mustBeReduced": false, "customMarkingAlgorithm": "", "precision": "2", "maxValue": "t1", "showCorrectAnswer": true, "marks": 1, "notationStyles": ["plain", "en", "si-en"], "precisionMessage": "You have not given your answer to the correct precision.", "type": "numberentry", "correctAnswerStyle": "plain", "extendBaseMarkingAlgorithm": true, "precisionPartialCredit": 0, "useCustomName": false, "showFeedbackIcon": true, "strictPrecision": false, "variableReplacements": [], "precisionType": "dp"}, {"mustBeReducedPC": 0, "minValue": "mh", "showPrecisionHint": false, "adaptiveMarkingPenalty": 0, "customName": "", "correctAnswerFraction": false, "scripts": {}, "unitTests": [], "allowFractions": false, "variableReplacementStrategy": "originalfirst", "mustBeReduced": false, "customMarkingAlgorithm": "", "precision": "2", "maxValue": "mh", "showCorrectAnswer": true, "marks": 1, "notationStyles": ["plain", "en", "si-en"], "precisionMessage": "You have not given your answer to the correct precision.", "type": "numberentry", "correctAnswerStyle": "plain", "extendBaseMarkingAlgorithm": true, "precisionPartialCredit": 0, "useCustomName": false, "showFeedbackIcon": true, "strictPrecision": false, "variableReplacements": [], "precisionType": "dp"}], "marks": 0, "adaptiveMarkingPenalty": 0, "customName": "", "type": "gapfill", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "useCustomName": false, "showFeedbackIcon": true, "variableReplacements": [], "sortAnswers": false}], "type": "question", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Alan Levine", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4070/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Alan Levine", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4070/"}]}