// Numbas version: exam_results_page_options {"name": "Andrew's copy of Homogeneous 2nd order ODE", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"parts": [{"showCorrectAnswer": true, "showPreview": true, "variableReplacements": [], "checkingType": "absdiff", "scripts": {}, "extendBaseMarkingAlgorithm": true, "unitTests": [{"notes": [{"expected": {"error": "", "valid": true, "value": "true", "messages": [], "warnings": [], "credit": 0}, "name": "hasform"}, {"expected": {"error": "", "valid": true, "value": "true", "messages": [], "warnings": [], "credit": 0}, "name": "containsroot1"}, {"expected": {"error": "", "valid": true, "value": "true", "messages": [], "warnings": [], "credit": 0}, "name": "containsroot2"}, {"expected": {"error": "", "valid": true, "value": "true", "messages": ["Your roots are correct.\n\nYou were awarded 2 marks.", "You have appropriate constants of integration.\n\nYou were awarded 1 mark."], "warnings": [], "credit": 1}, "name": "mark"}, {"expected": {"error": "", "valid": true, "value": "[ true ]", "messages": [], "warnings": [], "credit": 0}, "name": "agree"}], "answer": {"valid": true, "value": "A exp({root1}*x)+B exp({root2}*x)"}, "name": "Correct Solution", "variables": [{"name": "root1", "value": "-5"}, {"name": "root2", "value": "2"}]}, {"notes": [{"expected": {"error": "", "valid": true, "value": "true", "messages": [], "warnings": [], "credit": 0}, "name": "hasform"}, {"expected": {"error": "", "valid": true, "value": "true", "messages": [], "warnings": [], "credit": 0}, "name": "containsroot1"}, {"expected": {"error": "", "valid": true, "value": "true", "messages": [], "warnings": [], "credit": 0}, "name": "containsroot2"}, {"expected": {"error": "", "valid": true, "value": "true", "messages": ["Your roots are correct.\n\nYou were awarded 2 marks.", "You have appropriate constants of integration.\n\nYou were awarded 1 mark."], "warnings": [], "credit": 1}, "name": "mark"}, {"expected": {"error": "", "valid": true, "value": "[ false ]", "messages": [], "warnings": [], "credit": 0}, "name": "agree"}], "answer": {"valid": true, "value": "A*exp({root2}*x)+B exp({root1}*x)"}, "name": "Correct Solution (flipped)", "variables": [{"name": "root1", "value": "-5"}, {"name": "root2", "value": "2"}]}, {"notes": [{"expected": {"error": "", "valid": true, "value": "true", "messages": [], "warnings": [], "credit": 0}, "name": "hasform"}, {"expected": {"error": "", "valid": true, "value": "false", "messages": [], "warnings": [], "credit": 0}, "name": "containsroot1"}, {"expected": {"error": "", "valid": true, "value": "true", "messages": [], "warnings": [], "credit": 0}, "name": "containsroot2"}, {"expected": {"error": "", "valid": true, "value": "true", "messages": ["One of your roots is incorrect.\n\nYou were awarded 1 mark.", "You have appropriate constants of integration.\n\nYou were awarded 1 mark."], "warnings": [], "credit": 0.6666666666666666}, "name": "mark"}, {"expected": {"error": "", "valid": true, "value": "[ false ]", "messages": [], "warnings": [], "credit": 0}, "name": "agree"}], "answer": {"valid": true, "value": "A*exp(random(-5..5 except[0,{root1}])*x)+B exp({root2}*x)"}, "name": "Root 1 Wrong", "variables": [{"name": "root1", "value": "-5"}, {"name": "root2", "value": "2"}]}, {"notes": [{"expected": {"error": "", "valid": true, "value": "true", "messages": [], "warnings": [], "credit": 0}, "name": "hasform"}, {"expected": {"error": "", "valid": true, "value": "true", "messages": [], "warnings": [], "credit": 0}, "name": "containsroot1"}, {"expected": {"error": "", "valid": true, "value": "false", "messages": [], "warnings": [], "credit": 0}, "name": "containsroot2"}, {"expected": {"error": "", "valid": true, "value": "true", "messages": ["One of your roots is incorrect.\n\nYou were awarded 1 mark.", "You have appropriate constants of integration.\n\nYou were awarded 1 mark."], "warnings": [], "credit": 0.6666666666666666}, "name": "mark"}, {"expected": {"error": "", "valid": true, "value": "[ false ]", "messages": [], "warnings": [], "credit": 0}, "name": "agree"}], "answer": {"valid": true, "value": "A*exp({root1}*x)+B exp(random(-5..5 except[0,{root2}])*x)"}, "name": "Root 2 Wrong", "variables": [{"name": "root1", "value": "-5"}, {"name": "root2", "value": "2"}]}, {"notes": [{"expected": {"error": "", "valid": true, "value": "true", "messages": [], "warnings": [], "credit": 0}, "name": "hasform"}, {"expected": {"error": "", "valid": true, "value": "false", "messages": [], "warnings": [], "credit": 0}, "name": "containsroot1"}, {"expected": {"error": "", "valid": true, "value": "false", "messages": [], "warnings": [], "credit": 0}, "name": "containsroot2"}, {"expected": {"error": "", "valid": true, "value": "true", "messages": ["Your roots are incorrect.", "You have appropriate constants of integration.\n\nYou were awarded 1 mark."], "warnings": [], "credit": 0.3333333333333333}, "name": "mark"}, {"expected": {"error": "", "valid": true, "value": "[ false ]", "messages": [], "warnings": [], "credit": 0}, "name": "agree"}], "answer": {"valid": true, "value": "A*exp(random(-5..5 except[0,{root2},{root1}])*x)+B*exp(random(-5..5 except[0,{root2},{root1}])*x)"}, "name": "Both Roots Wrong", "variables": [{"name": "root1", "value": "-5"}, {"name": "root2", "value": "2"}]}, {"notes": [{"expected": {"error": "", "valid": true, "value": "a*exp(1x) + b*exp((-2)x)", "messages": [], "warnings": [], "credit": 0}, "name": "cleananswer"}, {"expected": {"error": "", "valid": true, "value": "true", "messages": [], "warnings": [], "credit": 0}, "name": "hasform"}, {"expected": {"error": "", "valid": true, "value": "\"\"", "messages": [], "warnings": [], "credit": 0}, "name": "cr1"}, {"expected": {"error": "", "valid": true, "value": "-2", "messages": [], "warnings": [], "credit": 0}, "name": "cr2"}, {"expected": {"error": "", "valid": true, "value": "false", "messages": [], "warnings": [], "credit": 0}, "name": "containsroot1"}, {"expected": {"error": "", "valid": true, "value": "true", "messages": [], "warnings": [], "credit": 0}, "name": "containsroot2"}, {"expected": {"error": "", "valid": true, "value": "true", "messages": ["One of your roots is incorrect.\n\nYou were awarded 1 mark.", "You have appropriate constants of integration.\n\nYou were awarded 1 mark."], "warnings": [], "credit": 0.6666666666666666}, "name": "mark"}, {"expected": {"error": "", "valid": true, "value": "a*e^(1x) + b*e^((-2)x)", "messages": [], "warnings": [], "credit": 0}, "name": "studentexpr"}, {"expected": {"error": "", "valid": true, "value": "\"a*e^(1x) + b*e^((-2)x)\"", "messages": [], "warnings": [], "credit": 0}, "name": "cleanedstudentstring"}, {"expected": {"error": "", "valid": true, "value": "a*e^(1x) + b*e^((-2)x)", "messages": [], "warnings": [], "credit": 0}, "name": "interpreted_answer"}], "answer": {"valid": true, "value": "a*e^(1x)+b*e^(-2x)"}, "name": "Testing for unit values of root", "variables": [{"name": "root1", "value": "1"}, {"name": "root2", "value": "-2"}]}], "type": "jme", "failureRate": 1, "checkVariableNames": false, "expectedVariableNames": [], "variableReplacementStrategy": "originalfirst", "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()", "answer": "A*e^({root1}*x)+B*e^({root2}*x)", "prompt": "

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

\n

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

", "vsetRange": [0, 1], "showFeedbackIcon": true, "marks": "3", "vsetRangePoints": 5}, {"showCorrectAnswer": true, "showPreview": true, "variableReplacements": [], "answerSimplification": "all, fractionNumbers", "scripts": {}, "extendBaseMarkingAlgorithm": true, "unitTests": [], "type": "jme", "failureRate": 1, "checkVariableNames": false, "expectedVariableNames": [], "variableReplacementStrategy": "originalfirst", "checkingAccuracy": 0.001, "customMarkingAlgorithm": "", "checkingType": "absdiff", "answer": "{(y00-root2*y0)/(root1-root2)} exp({root1}*x)+{(root1*y0-y00)/(root1-root2)} exp({root2}*x)", "prompt": "

Suppose now that we know that $y(0)=\\var{y0}$ and $y'(0)=\\var{y00}$. Find the specific solution corresponding to these initial conditions.

", "vsetRange": [0, 1], "showFeedbackIcon": true, "marks": "2", "vsetRangePoints": 5}], "preamble": {"js": "", "css": ""}, "tags": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "statement": "", "functions": {}, "variable_groups": [], "extensions": [], "metadata": {"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.

", "licence": "Creative Commons Attribution-NonCommercial-NoDerivs 4.0 International"}, "ungrouped_variables": ["randomroots", "root1", "root2", "y0", "y00"], "variables": {"y0": {"description": "

The value of y(0).

", "name": "y0", "group": "Ungrouped variables", "definition": "random(-2..2)", "templateType": "anything"}, "y00": {"description": "

The value of y'(0).

", "name": "y00", "group": "Ungrouped variables", "definition": "random(-2..2)", "templateType": "anything"}, "root1": {"description": "

The first root of the auxilliary equation (selected so that root1<root2).

", "name": "root1", "group": "Ungrouped variables", "definition": "min(randomroots)", "templateType": "anything"}, "root2": {"description": "

The second root of the auxilliary equation (selected so that root1<root2).

", "name": "root2", "group": "Ungrouped variables", "definition": "max(randomroots)", "templateType": "anything"}, "randomroots": {"description": "

Two values from the interval [-5,5]\\{0}. These will be the two roots of the auxilliary equation.

", "name": "randomroots", "group": "Ungrouped variables", "definition": "shuffle(-5..5 except 0)[0..2]", "templateType": "anything"}}, "name": "Andrew's copy of Homogeneous 2nd order ODE", "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.

\n

To find a specific solution, given initial conditions, we simply consider $y(0)$ and $y'(0)$. In our case, we have

\n

$y(0)=A+B$, $y'(0)=-6A+2B$,

\n

and from this we can solve for $A$ and $B$.

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