// Numbas version: exam_results_page_options {"name": "Julie's copy of Second order differential equations 2", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {"graphdisplay": {"definition": "var c = Numbas.jme.unwrapValue(scope.variables.c);\nvar d = Numbas.jme.unwrapValue(scope.variables.d);\nvar a = Numbas.jme.unwrapValue(scope.variables.a);\nvar m = Numbas.jme.unwrapValue(scope.variables.m);\nvar ytick= Numbas.jme.unwrapValue(scope.variables.ytick);\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',\n {boundingBox:[-5,m+2,5,-5],\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,ytick],{\ndrawLabels: true,\nlabel: {offset: [-20, 0]},\nminorTicks: 0\n }); \nvar p=brd.create('point',[0,c],{fixed:true,name:''});\nvar q=brd.create('point',[1,d],{fixed:true,name:''});\nvar tree;\n//x is the variable in the equation to be input\n var nscope = new Numbas.jme.Scope([scope,{variables:{x:new Numbas.jme.types.TNum(0)}}]);\n//create a functiongraph from the student input\nfunction userf(t){\nif(tree) {\n try {\nnscope.variables.x.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,-5,5],{strokeColor:'red',strokeWidth:3});\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 ", "type": "html", "parameters": [], "language": "javascript"}, "advicedisplay": {"definition": "var c = Numbas.jme.unwrapValue(scope.variables.c);\nvar d = Numbas.jme.unwrapValue(scope.variables.d);\nvar a = Numbas.jme.unwrapValue(scope.variables.a);\nvar m = Numbas.jme.unwrapValue(scope.variables.m);\nvar f1 = Numbas.jme.unwrapValue(scope.variables.f1);\nvar ytick= Numbas.jme.unwrapValue(scope.variables.ytick);\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',\n {boundingBox:[-5,m+2,5,-5],\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,ytick],{\ndrawLabels: true,\nlabel: {offset: [-20, 0]},\nminorTicks: 0\n }); \nvar p=brd.create('point',[0,c],{fixed:true,name:''});\nvar q=brd.create('point',[1,d],{fixed:true,name:''});\n\nfunction userf(x){return c * Math.exp( - a * x) + f1 * x * Math.exp(- a * x);}\nvar curve=brd.create('functiongraph',[userf,-5,5],{strokeColor:'red',strokeWidth:3});\nreturn div;", "type": "html", "parameters": [], "language": "javascript"}}, "ungrouped_variables": ["a", "f1", "c", "d", "g", "f", "m", "s", "ytick"], "name": "Julie's copy of Second order differential equations 2", "tags": ["2nd order differential equation", "auxiliary equation", "auxiliary equation with equal roots", "boundary condition", "Calculus", "calculus", "constant coefficients", "differential equations", "Differential equations", "equal roots", "exponential function", "general solution", "graphs", "jsxgraph", "Jsxgraph", "linear differential equation", "linear differential equations with constant coefficients", "ode", "ODE", "plot solutions", "quadratic function", "repeated roots for auxiliary equation", "second order differential equations", "solving differential equations", "solving quadratic equation", "trigonometric functions"], "advice": "

The auxillary equation is $\\simplify[std]{lambda^2+{2*a}lambda+{a^2}}=0$.

\n

On solving this equation we get $\\lambda=\\var{-a}$ twice.

\n

Hence the general solution is:
\\[y = \\simplify[std]{A*e^({-a}x)+B*x*e^({-a}x)}\\]
The boundary conditions give:

\n

$y(0)=\\var{c} \\Rightarrow A=\\var{c}$

\n

$y(1)=\\var{d} \\Rightarrow \\simplify[std]{Ae^{-a}+Be^{-a}={d}}\\Rightarrow A+B = \\simplify[std1]{{d}e^{a}}$

\n

So $B=\\simplify[std1]{{d}e^{a}-{c}}=\\var{f1}$ to 3 decimal places.

\n

Hence the solution is:
\\[y=\\simplify[std1]{(({c} * Exp(({( - a)} * x))) + ({f1} * x * Exp(({( - a)} * x))))}\\]

\n

{advicedisplay()}

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

{graphdisplay()}

\n

Solution is:

\n

$y=\\;\\;$[[0]]

\n

Input all numbers correct to 3 decimal places.

\n

Your solution is graphed above once you have input the solution before submitting.

\n

Note that the points $(0,\\var{c}),\\;(1,\\var{d})$ which the curve has to go through are marked on the graph.

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 1e-05, "type": "jme", "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "answersimplification": "std1", "scripts": {}, "answer": "{c} * Exp({ - a} * x) + {f1} * x * Exp({- a} * x)", "marks": 3, "checkvariablenames": false, "checkingtype": "absdiff", "vsetrange": [0, 1]}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}], "extensions": ["jsxgraph"], "statement": "

Method of undetermined coefficients:

\n

Find the solution of:
\\[\\simplify[std]{(d^2y/dx^2)+{2*a}*(dy/dx)+{a^2}y}=0\\]
which satisfies $y(0)=\\var{c}$ and $y(1)=\\var{d}$.

\n

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "preamble": {"css": "", "js": ""}, "variables": {"a": {"definition": "s*random(1..7)", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "f1": {"definition": "precround(f,3)", "templateType": "anything", "group": "Ungrouped variables", "name": "f1", "description": ""}, "c": {"definition": "random(1..6)", "templateType": "anything", "group": "Ungrouped variables", "name": "c", "description": ""}, "d": {"definition": "random(1..6)", "templateType": "anything", "group": "Ungrouped variables", "name": "d", "description": ""}, "g": {"definition": "(f1-a*c)/f1", "templateType": "anything", "group": "Ungrouped variables", "name": "g", "description": ""}, "f": {"definition": "d*exp(a)-c", "templateType": "anything", "group": "Ungrouped variables", "name": "f", "description": ""}, "m": {"definition": "(f1/a)*e^(-g)", "templateType": "anything", "group": "Ungrouped variables", "name": "m", "description": ""}, "s": {"definition": "random(1,-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "s", "description": ""}, "ytick": {"definition": "if(m>10,round(m/10),1)", "templateType": "anything", "group": "Ungrouped variables", "name": "ytick", "description": ""}}, "metadata": {"description": "

Method of undermined coefficients:

\n

Solve: $\\displaystyle \\frac{d^2y}{dx^2}+2a\\frac{dy}{dx}+a^2y=0,\\;y(0)=c$ and $y(1)=d$.  (Equal roots example). Includes an interactive plot.

\n

rebelmaths

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