// Numbas version: exam_results_page_options {"name": "Simon's copy of 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": [{"tags": [], "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"}, "parts": [{"scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "unitTests": [], "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.

", "sortAnswers": false, "showCorrectAnswer": true, "gaps": [{"vsetRangePoints": 5, "checkingType": "absdiff", "scripts": {}, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "unitTests": [], "vsetRange": [0, 1], "showCorrectAnswer": true, "checkVariableNames": false, "answerSimplification": "std1", "failureRate": 1, "answer": "{c} * Exp({ - a} * x) + {f1} * x * Exp({- a} * x)", "showPreview": true, "expectedVariableNames": [], "checkingAccuracy": "0.001", "extendBaseMarkingAlgorithm": true, "marks": 3, "type": "jme", "variableReplacements": [], "variableReplacementStrategy": "originalfirst"}], "extendBaseMarkingAlgorithm": true, "marks": 0, "type": "gapfill", "variableReplacements": [], "variableReplacementStrategy": "originalfirst"}], "functions": {"graphdisplay": {"parameters": [], "type": "html", "language": "javascript", "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 "}, "advicedisplay": {"parameters": [], "type": "html", "language": "javascript", "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;"}}, "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

", "preamble": {"css": "", "js": ""}, "name": "Simon's copy of Julie's copy of Second order differential equations 2", "variables": {"g": {"description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "g", "definition": "(f1-a*c)/f1"}, "f": {"description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "f", "definition": "d*exp(a)-c"}, "c": {"description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "c", "definition": "random(1..6)"}, "s": {"description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "s", "definition": "random(1,-1)"}, "m": {"description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "m", "definition": "(f1/a)*e^(-g)"}, "d": {"description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "d", "definition": "random(1..6)"}, "f1": {"description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "f1", "definition": "precround(f,3)"}, "ytick": {"description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "ytick", "definition": "if(m>10,round(m/10),1)"}, "a": {"description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "definition": "s*random(1..7)"}}, "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"], "std1": ["all", "!collectNumbers", "!noLeadingMinus"]}, "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()}

", "ungrouped_variables": ["a", "f1", "c", "d", "g", "f", "m", "s", "ytick"], "extensions": ["jsxgraph"], "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "type": "question", "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}]}], "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}