// Numbas version: exam_results_page_options {"name": "Harry'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": {"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"}, "tags": [], "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.

", "variables": {"mh": {"description": "", "group": "Ungrouped variables", "templateType": "anything", "definition": "precround(V^2/(2*g),2)", "name": "mh"}, "t": {"description": "", "group": "Ungrouped variables", "templateType": "anything", "definition": "V/g", "name": "t"}, "t1": {"description": "", "group": "Ungrouped variables", "templateType": "anything", "definition": "precround(t,2)", "name": "t1"}, "g": {"description": "", "group": "Ungrouped variables", "templateType": "anything", "definition": "9.81", "name": "g"}, "v": {"description": "", "group": "Ungrouped variables", "templateType": "anything", "definition": "random(50..100)", "name": "v"}}, "functions": {"graphsolution": {"language": "javascript", "parameters": [], "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 "}, "advicegraph": {"language": "javascript", "parameters": [], "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;"}}, "name": "Harry's copy of Numbas demo: Motion under gravity", "variablesTest": {"condition": "", "maxRuns": 100}, "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "ungrouped_variables": ["t", "v", "mh", "g", "t1"], "variable_groups": [], "parts": [{"type": "gapfill", "marks": 0, "variableReplacementStrategy": "originalfirst", "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": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "gaps": [{"showCorrectAnswer": true, "scripts": {}, "checkvariablenames": true, "type": "jme", "marks": 1, "checkingaccuracy": 0.001, "vsetrange": [0, 1], "vsetrangepoints": 5, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "checkingtype": "absdiff", "answer": "{v}t-1/2g*t^2", "showFeedbackIcon": true, "expectedvariablenames": ["t", "z", "g"], "showpreview": true}], "scripts": {}}, {"type": "gapfill", "marks": 0, "variableReplacementStrategy": "originalfirst", "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": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "gaps": [{"showPrecisionHint": false, "correctAnswerFraction": false, "maxValue": "t1", "precision": "2", "scripts": {}, "allowFractions": false, "correctAnswerStyle": "plain", "precisionType": "dp", "type": "numberentry", "minValue": "t1", "marks": 1, "precisionMessage": "You have not given your answer to the correct precision.", "notationStyles": ["plain", "en", "si-en"], "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "precisionPartialCredit": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "strictPrecision": false}, {"showPrecisionHint": false, "correctAnswerFraction": false, "maxValue": "mh", "precision": "2", "scripts": {}, "allowFractions": false, "correctAnswerStyle": "plain", "precisionType": "dp", "type": "numberentry", "minValue": "mh", "marks": 1, "precisionMessage": "You have not given your answer to the correct precision.", "notationStyles": ["plain", "en", "si-en"], "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "precisionPartialCredit": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "strictPrecision": false}], "scripts": {}}], "preamble": {"js": "", "css": ""}, "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$.

", "extensions": ["jsxgraph"], "type": "question", "contributors": [{"name": "Harry Flynn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/976/"}]}]}], "contributors": [{"name": "Harry Flynn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/976/"}]}