// Numbas version: exam_results_page_options {"name": "First order differential equations 8", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {"solad": {"definition": "var a = Numbas.jme.unwrapValue(scope.variables.a);\nvar b = Numbas.jme.unwrapValue(scope.variables.b);\nvar n = Numbas.jme.unwrapValue(scope.variables.n);\nvar m = Numbas.jme.unwrapValue(scope.variables.m);\n\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',\n {boundingBox:[-1.5,6*m/5,10,-m/4],\n axis:false,\n showNavigation:true,\n grid:true});\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,m/4],{\ndrawLabels: true,\nlabel: {offset: [-40, 0]},\nminorTicks: 0\n }); \nvar p=brd.create('point',[0,0],{fixed:true,name:'0',size:1});\nfunction sol(t) { return Math.pow(Math.pow(b,n+1)+(a*(n+1)*t),1/(n+1))-b;}\nvar curve =brd.create('functiongraph',[sol,0,10],{strokeColor:'red',strokeWidth:2});\nreturn div;\n ", "type": "html", "language": "javascript", "parameters": []}, "userdisplay": {"definition": "var a = Numbas.jme.unwrapValue(scope.variables.a);\nvar b = Numbas.jme.unwrapValue(scope.variables.b);\nvar n = Numbas.jme.unwrapValue(scope.variables.n);\nvar m = Numbas.jme.unwrapValue(scope.variables.m);\n\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',\n {boundingBox:[-1.5,6*m/5,10,-m/4],\n axis:false,\n showNavigation:true,\n grid:true});\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,m/4],{\ndrawLabels: true,\nlabel: {offset: [-40, 0]},\nminorTicks: 0\n }); \nvar p=brd.create('point',[0,0],{fixed:true,name:'0',size:1});\nvar tree;\n//t 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\n\nfunction userf(u){\nif(tree) {\n try {\nnscope.variables.t.value = u;\n//the user input is evaluated at t=u\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,10],{strokeColor:'red',strokeWidth:2});\n\n //pick up the student answer and is parsed\n question.signals.on('HTMLAttached',function(e) {\nko.computed(function(){\n\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 ", "type": "html", "language": "javascript", "parameters": []}}, "ungrouped_variables": ["a", "b", "m", "n"], "name": "First order differential equations 8", "tags": ["1st order differential equation", "Calculus", "Differential equations", "Jsxgraph", "ODE", "calculus", "differential equations", "first order differential equation", "growth", "gtaphs", "initial conditions", "interactive", "jsxgraph", "modelling", "ode", "plot solution", "separable variables", "separation of variables"], "preamble": {"css": "", "js": ""}, "advice": "

On rearranging the equation we get $\\displaystyle{\\simplify[std]{(x+{b})^{n}*(dx/dt) = {a}}}$ and on integrating we obtain:
$\\displaystyle{\\simplify[std]{(x+{b})^{n+1}/{n+1}={a}t +A} \\Rightarrow x+\\var{b}=(A+\\var{a*(n+1)}t)^{1/\\var{n+1}}}$

\n

Using the condition $x(0)=0$ gives $\\displaystyle{A^{1/\\var{n+1}}=\\var{b} \\Rightarrow A=\\var{b^(n+1)}}$

\n

Hence the solution is:
\\[x(t) = \\simplify[std]{({(b ^ (n + 1))} + ({(a * (n + 1))} * t)) ^ (1 / {(n + 1)}) - {b}}\\]

\n

{solad()}

", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "parts": [{"prompt": "

{userdisplay()}

\n

The thickness at time $t$ is given by:

\n

$x(t)=\\;\\;$[[0]]

\n

Input all numbers as integers or fractions – not as decimals.

", "marks": 0, "gaps": [{"notallowed": {"message": "

Input all numbers as integers or fractions.

", "showStrings": false, "strings": ["."], "partialCredit": 0}, "expectedvariablenames": [], "checkingaccuracy": 0.0001, "vsetrange": [0, 1], "showpreview": true, "vsetrangepoints": 5, "showCorrectAnswer": true, "answersimplification": "std", "scripts": {}, "answer": "({(b ^ (n + 1))} + ({(a * (n + 1))} * t)) ^ (1 / {(n + 1)}) - {b}", "marks": 3, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}], "statement": "

The thickness of ice on water, $x(t)$, grows according to the equation:
\\[\\frac{dx}{dt}=\\simplify[std]{{a}/(x+{b})^{n}}\\]
Given that $x(0)=0$ find $x(t)$.

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"a": {"definition": "random(1..9)", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "b": {"definition": "random(1..7)", "templateType": "anything", "group": "Ungrouped variables", "name": "b", "description": ""}, "m": {"definition": "(b^(n+1)+10*a*(n+1))^(1/(n+1))-b", "templateType": "anything", "group": "Ungrouped variables", "name": "m", "description": ""}, "n": {"definition": "random(1..3)", "templateType": "anything", "group": "Ungrouped variables", "name": "n", "description": ""}}, "metadata": {"notes": "\n \t\t

29/06/2012:

\n \t\t

Added and edited tags.

\n \t\t

Checked answer. Checking range OK as we are taking roots of positive numbers, given the choice of ranges for the variables.

\n \t\t

18/07/2012:

\n \t\t

Added description.

\n \t\t

23/07/2012:

\n \t\t

Added tags.

\n \t\t

The arbitrary constant A should be relabelled as A_1 in the Advice section part way though the solution.

\n \t\t

Question appears to be working correctly.

\n \t\t

 

\n \t\t", "description": "

Solve for $x(t)$, $\\displaystyle\\frac{dx}{dt}=\\frac{a}{(x+b)^n},\\;x(0)=0$

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}], "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}]}]}], "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}]}