// Numbas version: exam_results_page_options {"name": "Homogeneous 2nd-order ODE (distinct roots)", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Homogeneous 2nd-order ODE (distinct roots)", "extensions": [], "metadata": {"licence": "Creative Commons Attribution-NonCommercial-NoDerivs 4.0 International", "description": "

Straightforward question: student must find the general solution to a second order constant coefficient ODE. Uses custom marking algorithm to check that both roots appear and that the solution is in the correct form (e.g. two arbitrary constants are present). Arbitrary constants can be any non space-separated string of characters. The algorithm also allows for the use of $e^x$ rather than $\\exp(x)$.

\n

Unit tests are also included, to check whether the algorithm accurately marks when the solution is correct; when it's correct but deviates from the 'answer'; when one or more roots is incorrect; or when the roots are correct but constants of integration have been forgotten.

"}, "parts": [{"extendBaseMarkingAlgorithm": true, "answer": "A*e^({root1}*x)+B*e^({root2}*x)", "showCorrectAnswer": true, "vsetRange": [0, 1], "checkVariableNames": false, "unitTests": [], "checkingType": "absdiff", "showPreview": true, "type": "jme", "scripts": {}, "failureRate": 1, "expectedVariableNames": [], "variableReplacements": [], "showFeedbackIcon": true, "checkingAccuracy": 0.001, "customMarkingAlgorithm": "cleanAnswer (Replaces e with exp):\n simplify(replace(\"e^?;x\",\"exp(x)\",expression(studentAnswer)),[\"basic\",\"unitfactor\"])\n\nhasForm (Checks whether the result is in the right form):\n length(match_regex(\"[a-zA-Z]+\\\\*exp\\\\(?.+\\\\)?\\\\s*\\\\+\\\\s*[a-zA-Z]+\\\\*exp\\\\(?.+\\\\)?\",string(cleanAnswer)))=1\n\ncr1 (Fixes problems with root being 1 or -1):\n if (root1 = -1, \"-\", if (root1 = 1, \"\", root1))\n\ncr2 (Fixes problems with root being 1 or -1):\n if (root2 = -1, \"-\", if (root1 = 2, \"\", root2))\n\ncontainsRoot1 (Check that the first root is contained):\n not (length(match_regex(\"exp\\\\(\\\\(?\"+cr1+\"\\\\)?x\\\\)\",string(cleanAnswer)))=0)\n\ncontainsRoot2 (Check that the second root is contained):\n not (length(match_regex(\"exp\\\\(\\\\(?\"+cr2+\"\\\\)?x\\\\)\",string(cleanAnswer)))=0)\n\nmark (Mark the thing):\n apply(studentExpr);\n apply(unexpectedVariables);\n //apply(sameVars);\n //apply(numericallyCorrect);\n apply(forbiddenStringsPenalty);\n apply(requiredStringsPenalty);\n set_credit(0,\"\");\n if (containsRoot1 and containsRoot2, add_credit(2/3, \"Your roots are correct.\"), if (containsRoot1 or containsRoot2, add_credit(1/3, \"One of your roots is incorrect.\"), feedback(\"Your roots are incorrect.\")));\n if (hasForm, add_credit(1/3,\"You have appropriate constants of integration.\"),feedback(\"You have forgotten one or more constants of integration.\"));\n end()", "marks": "3", "vsetRangePoints": 5, "variableReplacementStrategy": "originalfirst"}], "preamble": {"css": "", "js": ""}, "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "

Find the general solution, $y(x)$, for the following ODE:

\n

$\\simplify{y''-{root1+root2}*y'+{root1*root2}*y}=0.$

", "advice": "

This is a constant coefficient, second-order ODE. We can use the auxilliary equation to find solutions.

\n

Suppose the differential equation is

\n

$y''+4y'-12y=0.$

\n

Then trying a solution of the form $y=e^{\\lambda x}$ gives

\n

$(\\lambda^{2}+4\\lambda-12)e^{\\lambda x}=0,$

\n

from which we can solve the auxilliary equation in $\\lambda$. Here, it factorises as $(\\lambda-2)(\\lambda+6)$, so we have roots $\\lambda=-6,\\,2$. Then the general solution is

\n

$y=A e^{-6 x}+B e^{2x},$

\n

where $A$ and $B$ are arbitrary constants.

", "rulesets": {}, "tags": [], "ungrouped_variables": ["root1", "root2"], "functions": {}, "variables": {"root2": {"name": "root2", "definition": "random(-5..5 except [0,root1])", "group": "Ungrouped variables", "templateType": "anything", "description": "

The second root of the auxilliary equation.

"}, "root1": {"name": "root1", "definition": "random(-5..5 except 0)", "group": "Ungrouped variables", "templateType": "anything", "description": "

The first root of the auxilliary equation.

"}}, "variable_groups": [], "type": "question", "contributors": [{"name": "Andrew Iskauskas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/724/"}, {"name": "Sam Fearn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2426/"}]}]}], "contributors": [{"name": "Andrew Iskauskas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/724/"}, {"name": "Sam Fearn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2426/"}]}