// Numbas version: exam_results_page_options {"name": "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": [{"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 ", "type": "html", "parameters": [], "language": "javascript"}}, "ungrouped_variables": ["a", "c", "b"], "name": "Julie's copy of Second order differential equations 1", "tags": ["2nd order differential equation", "auxiliary equation", "boundary conditions on differential equation", "Calculus", "calculus", "complex roots of auxiliary equation", "constant coefficients", "Differential equations", "differential equations", "exponential function", "finding the auxiliary equation", "linear differential equation", "ode", "ODE", "quadratic equation", "second order differential equation", "solving differential equations", "solving quadratic equation", "trigonometric functions"], "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))}\\]

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

Solution is:

\n

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

\n

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

\n ", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"notallowed": {"message": "

Input all numbers as integers or fractions.

", "showStrings": false, "strings": ["."], "partialCredit": 0}, "variableReplacements": [], "expectedvariablenames": [], "checkingaccuracy": 1e-05, "type": "jme", "showpreview": true, "vsetrangepoints": 5, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "answersimplification": "std", "scripts": {}, "answer": "exp({- a} * x) * (cos({b} * x) + ({c+a} / {b}) * sin({b} * x))", "marks": 3, "checkvariablenames": false, "checkingtype": "absdiff", "vsetrange": [0, 1]}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}], "extensions": ["jsxgraph"], "statement": "

Method of undertermined 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).

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "preamble": {"css": "", "js": ""}, "variables": {"a": {"definition": "random(-5..5 except 0)", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "c": {"definition": "random(1..5)", "templateType": "anything", "group": "Ungrouped variables", "name": "c", "description": ""}, "b": {"definition": "random(1..7)", "templateType": "anything", "group": "Ungrouped variables", "name": "b", "description": ""}}, "metadata": {"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

", "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/"}]}