// Numbas version: exam_results_page_options {"name": "Ethan'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": [{"metadata": {"licence": "Creative Commons Attribution 4.0 International", "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.

"}, "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$.

", "ungrouped_variables": ["t", "v", "mh", "g", "t1"], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"mh": {"group": "Ungrouped variables", "templateType": "anything", "name": "mh", "description": "", "definition": "precround(V^2/(2*g),2)"}, "v": {"group": "Ungrouped variables", "templateType": "anything", "name": "v", "description": "", "definition": "random(50..100)"}, "g": {"group": "Ungrouped variables", "templateType": "anything", "name": "g", "description": "", "definition": "9.81"}, "t": {"group": "Ungrouped variables", "templateType": "anything", "name": "t", "description": "", "definition": "V/g"}, "t1": {"group": "Ungrouped variables", "templateType": "anything", "name": "t1", "description": "", "definition": "precround(t,2)"}}, "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "variable_groups": [], "parts": [{"type": "gapfill", "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
", "variableReplacements": [], "marks": 0, "scripts": {}, "gaps": [{"checkvariablenames": true, "vsetrange": [0, 1], "variableReplacements": [], "marks": 1, "showpreview": true, "vsetrangepoints": 5, "type": "jme", "checkingaccuracy": 0.001, "answer": "{v}t-1/2g*t^2", "checkingtype": "absdiff", "scripts": {}, "showCorrectAnswer": true, "expectedvariablenames": ["t", "z", "g"], "variableReplacementStrategy": "originalfirst"}], "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst"}, {"type": "gapfill", "prompt": "

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

\n

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

", "variableReplacements": [], "marks": 0, "scripts": {}, "gaps": [{"precisionType": "dp", "type": "numberentry", "correctAnswerStyle": "plain", "showPrecisionHint": false, "variableReplacements": [], "marks": 1, "precision": "2", "minValue": "t1", "allowFractions": false, "correctAnswerFraction": false, "strictPrecision": false, "scripts": {}, "maxValue": "t1", "precisionMessage": "You have not given your answer to the correct precision.", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "precisionPartialCredit": 0, "variableReplacementStrategy": "originalfirst"}, {"precisionType": "dp", "type": "numberentry", "correctAnswerStyle": "plain", "showPrecisionHint": false, "variableReplacements": [], "marks": 1, "precision": "2", "minValue": "mh", "allowFractions": false, "correctAnswerFraction": false, "strictPrecision": false, "scripts": {}, "maxValue": "mh", "precisionMessage": "You have not given your answer to the correct precision.", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "precisionPartialCredit": 0, "variableReplacementStrategy": "originalfirst"}], "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst"}], "preamble": {"js": "", "css": ""}, "functions": {"advicegraph": {"parameters": [], "language": "javascript", "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;"}, "graphsolution": {"parameters": [], "language": "javascript", "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 "}}, "tags": ["2nd order differential equation", "acceleration", "applied mathematics", "Calculus", "calculus", "Differential equations", "differential equations", "graphs", "initial conditions", "integration", "interactive", "Jsxgraph", "jsxgraph", "modelling", "motion under gravity", "ode", "ODE", "plot solution", "second order differential equation", "velocity"], "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.

", "name": "Ethan's copy of Numbas demo: Motion under gravity", "extensions": ["jsxgraph"], "type": "question", "contributors": [{"name": "Ethan Smith", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/739/"}]}]}], "contributors": [{"name": "Ethan Smith", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/739/"}]}