// Numbas version: exam_results_page_options {"name": "Simon's copy of Julie's copy of Second order differential equations 1", "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": "

Solve: $\\displaystyle \\frac{d^2y}{dx^2}+2a\\frac{dy}{dx}+(a^2+b^2)y=0,\\;y(0)=1$ and $y'(0)=c$. 

\n

rebelmaths

"}, "statement": "

Method of undetermined coefficients

\n

Solve:
\\[\\simplify[std]{(d^2y/dx^2)+{2*a}*(dy/dx)+{a^2+b^2}y}=0\\]
which satisfies $y(0)=1$ and $y'(0)=\\var{c}$ (where prime denotes the derivative).

", "advice": "

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

\n

On solving this equation we get $\\lambda=\\simplify[std]{{-a}+{b}i}$ and $\\lambda=\\simplify[std]{{-a}-{b}i}$.

\n

Hence the general solution is:
\\[y = \\simplify[std]{e^({-a}x)(A*sin({b}x)+B*cos({b}x))}\\]
Note that
\\[y'(x)=\\simplify[std]{-{a}e^({-a}x)(A*sin({b}x)+B*cos({b}x))+e^({-a}x)({b}*A*cos({b}x)-{b}*B*sin({b}x))}\\]
Using the conditions $y(0)=1$ and $y'(0)=\\var{c}$ gives:
\\[\\begin{eqnarray*} B &=& 1\\\\ \\simplify[std]{{b}A+{-a}B}&=& \\var{c} \\end{eqnarray*} \\]
This gives $\\displaystyle{A = \\simplify[std]{{c+a}/{b}}}$.

\n

Hence the solution is:

\n

\\[y=\\simplify[std]{exp({- a} * x) * (cos({b} * x) + ({c+a} / {b}) * sin({b} * x))}\\]

", "parts": [{"showCorrectAnswer": true, "variableReplacements": [], "unitTests": [], "scripts": {}, "gaps": [{"showCorrectAnswer": true, "variableReplacements": [], "unitTests": [], "checkingAccuracy": 1e-05, "scripts": {}, "variableReplacementStrategy": "originalfirst", "notallowed": {"message": "

Input all numbers as integers or fractions.

", "partialCredit": 0, "strings": ["."], "showStrings": false}, "expectedVariableNames": [], "answer": "exp({- a} * x) * (cos({b} * x) + ({c+a} / {b}) * sin({b} * x))", "marks": 3, "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "customMarkingAlgorithm": "", "type": "jme", "checkingType": "absdiff", "vsetRange": [0, 1], "vsetRangePoints": 5, "checkVariableNames": false, "answerSimplification": "std", "failureRate": 1, "showPreview": true}], "sortAnswers": false, "variableReplacementStrategy": "originalfirst", "marks": 0, "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "customMarkingAlgorithm": "", "type": "gapfill", "prompt": "\n

Solution is:

\n

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

\n

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

\n "}], "variable_groups": [], "name": "Simon's copy of Julie's copy of Second order differential equations 1", "preamble": {"js": "", "css": ""}, "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "functions": {"graphsolution": {"definition": "var c = Numbas.jme.unwrapValue(scope.variables.c);\n\n//var m=Math.abs((c-d*Math.exp(a))/(-a)*Math.exp(-(1-c*a/(d*Math.exp(a)-c))));\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',\n {boundingBox:[-5,30,5,-30],\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,5],{\ndrawLabels: true,\nlabel: {offset: [-20, 0]},\nminorTicks: 0\n }); \nvar p=brd.create('point',[0,1],{fixed:true,name:''});\nvar q=brd.create('line',[[0,0],[1,c]],{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:{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,-10,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(){\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 ", "language": "javascript", "parameters": [], "type": "html"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "tags": [], "variables": {"c": {"name": "c", "group": "Ungrouped variables", "definition": "random(1..5)", "templateType": "anything", "description": ""}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "random(1..7)", "templateType": "anything", "description": ""}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "random(-5..5 except 0)", "templateType": "anything", "description": ""}}, "ungrouped_variables": ["a", "c", "b"], "extensions": ["jsxgraph"], "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/"}]}