// Numbas version: finer_feedback_settings {"name": "Second order differential equations - sine forcing ", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {}, "ungrouped_variables": ["q1", "p", "q", "A", "f", "yd0", "y0"], "name": "Second order differential equations - sine forcing ", "tags": ["2nd order differential equation", "Calculus", "calculus", "CF", "complementary function", "constant coefficients", "Differential equations", "differential equations", "general solution", "linear differential equation", "ode", "ODE", "particular integral", "PI", "second order differential equation", "solving differential equations"], "advice": "

First we find the Complementary Function (CF) i.e. the solution of:

\n

\\[\\simplify[std]{d^2y/dx^2+{2*p}*(dy/dx)+{p^2-q^2}y=0}\\]

\n

The auxillary equation is $\\simplify[std]{lambda^2+{2*p}lambda+{p^2-q^2}=0} \\Rightarrow \\simplify[std]{(lambda+{p-q})(lambda+{p+q})=0}\\Rightarrow \\lambda = \\var{q-p}\\textrm{ or }\\lambda = \\var{-q-p} $

\n

Hence the CF is $\\displaystyle{y_{CF}(x)=\\simplify[std]{A*e^({q-p}x)+ B*e^({-q-p}x)}}$ for $A$, $B$ arbitrary constants.

\n

So $a=\\var{q-p}$ and $b=\\var{-q-p}$ as we required $a \\gt b$.

\n

To find the Particular Integral (PI) for $\\displaystyle{\\simplify[std]{d^2y/dx^2+{2*p}*(dy/dx)+{p^2-q^2}y={A}sin({f}x)}}$, we observe that $y_{PI}(x)=\\simplify[std]{C*sin({f}x)+D*cos({f}x)}$ is a possible PI for constants $C,\\;D$ to be found.

\n

Substituting $y_{PI}(x)=\\simplify[std]{C*sin({f}x)+D*cos({f}x)}$ in to the equation gives:

\n

$\\displaystyle \\simplify[std]{-{f^2}C*sin({f}x) -{f^2}D*cos({f}x)+{2*p*f}C*cos({f}x)-{2*p*f}D*sin({f}x)+{p^2-q^2}C*sin({f}x)+{p^2-q^2}D*cos({f}x) ={A} sin({f}x)}$.  Now collect terms to obtain

\n

$\\displaystyle \\simplify[std]{sin({f}x)*({-f^2+p^2-q^2}C-{2*p*f}D)+cos({f}x)*({-f^2+p^2-q^2}D+{2*p*f}C)={A} sin({f}x)}$

\n

so that

\n

\n

$\\simplify[std]{{-f^2+p^2-q^2}C-{2*p*f}D={A}}$  and $\\simplify[std]{{-f^2+p^2-q^2}D+{2*p*f}C=0}$

\n

We solve the two equations to obtain $\\displaystyle\\simplify[std]{C={(A*p^2-A*f^2-A*q^2)/((p^2+2*p*q+q^2+f^2)*(p^2-2*p*q+q^2+f^2))}}$ and $\\displaystyle\\simplify[std]{D={-2*A*f*p/((p^2+2*p*q+q^2+f^2)*(p^2-2*p*q+q^2+f^2))}}$.

\n

and obtain the particular integral:

\n

 $\\displaystyle\\simplify[std]{{(A*p^2-A*f^2-A*q^2)/((p^2+2*p*q+q^2+f^2)*(p^2-2*p*q+q^2+f^2))}sin({f}x)+{-2*A*f*p/((p^2+2*p*q+q^2+f^2)*(p^2-2*p*q+q^2+f^2))}cos({f}x)}$

\n

\n

Now differentiate $y=y_{CF}+y_{PI}$ and substitute the initial conditions to obtain $A$ and $B$.

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

$a=\\;\\;$[[0]]$\\;\\;\\;b=\\;\\;$[[1]]. Remember that we require $a \\gt b$

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"allowFractions": false, "variableReplacements": [], "maxValue": "{q-p}", "minValue": "{q-p}", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "{-q-p}", "minValue": "{-q-p}", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}, {"prompt": "

$\\displaystyle{y_{PI}=\\;\\;}$[[0]].

\n

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

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

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

", "showStrings": false, "strings": ["."], "partialCredit": 0}, "variableReplacements": [], "expectedvariablenames": [], "checkingaccuracy": 1e-05, "type": "jme", "showpreview": true, "vsetrangepoints": 5, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "answersimplification": "std", "scripts": {}, "answer": "{(A*p^2-A*f^2-A*q^2)/((p^2+2*p*q+q^2+f^2)*(p^2-2*p*q+q^2+f^2))}sin({f}x)-{2*A*f*p/((p^2+2*p*q+q^2+f^2)*(p^2-2*p*q+q^2+f^2))}cos({f}x)", "marks": "4", "checkvariablenames": false, "checkingtype": "reldiff", "vsetrange": [0, 1]}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}, {"prompt": "

Enter the value of $\\displaystyle{A\\;\\;}$. Input as fraction or integer and not as decimal.

", "allowFractions": true, "variableReplacements": [], "maxValue": "{(1/2)*(f^2*p*y0+f^2*q*y0+p^3*y0-p^2*q*y0-p*q^2*y0+q^3*y0+f^2*yd0+p^2*yd0-2*p*q*yd0+q^2*yd0+A*f)/(q*(f^2+p^2-2*p*q+q^2))}", "minValue": "{(1/2)*(f^2*p*y0+f^2*q*y0+p^3*y0-p^2*q*y0-p*q^2*y0+q^3*y0+f^2*yd0+p^2*yd0-2*p*q*yd0+q^2*yd0+A*f)/(q*(f^2+p^2-2*p*q+q^2))}", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": true, "showCorrectAnswer": true, "scripts": {}, "marks": "2", "type": "numberentry", "showPrecisionHint": false}, {"prompt": "

Enter the value of $\\displaystyle{B\\;\\;}$. Input as fraction or integer and not as decimal.

", "allowFractions": true, "variableReplacements": [], "maxValue": "{-(1/2)*(f^2*p*y0-f^2*q*y0+p^3*y0+p^2*q*y0-p*q^2*y0-q^3*y0+f^2*yd0+p^2*yd0+2*p*q*yd0+q^2*yd0+A*f)/(q*(f^2+p^2+2*p*q+q^2))}", "minValue": "{-(1/2)*(f^2*p*y0-f^2*q*y0+p^3*y0+p^2*q*y0-p*q^2*y0-q^3*y0+f^2*yd0+p^2*yd0+2*p*q*yd0+q^2*yd0+A*f)/(q*(f^2+p^2+2*p*q+q^2))}", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": true, "showCorrectAnswer": true, "scripts": {}, "marks": "2", "type": "numberentry", "showPrecisionHint": false}], "statement": "

Find the complete general solution of the equation:
$\\displaystyle\\simplify{y''+{2*p}*(y')+{p^2-q^2}y={A}sin({f}x)}$
in the form $\\displaystyle{y_{CF}(x)+y_{PI}(x)}$ where  $y_{CF}$ is the complementary function of the form $\\displaystyle{Ae^{ax}+Be^{bx}}$, $A$ and $B$ are arbitrary constants, and $y_{PI}$ is a particular integral.

\n

Calculate $y_{CF}$ and $y_{PI}$ and input the values of $a$, $b$ and $y_{PI}$ below.

\n

Note that we require that $a \\gt b$.

\n

Finally, obtain the values of $A$ and $B$ by using the initial conditions $\\simplify{y(0)={y0}}$ and $\\simplify{ y'(0)={yd0}}$.

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "preamble": {"css": "", "js": ""}, "variables": {"q1": {"definition": "random(1..8)", "templateType": "anything", "group": "Ungrouped variables", "name": "q1", "description": ""}, "A": {"definition": "random(1..6)", "templateType": "anything", "group": "Ungrouped variables", "name": "A", "description": ""}, "f": {"definition": "random(2..8)\n", "templateType": "anything", "group": "Ungrouped variables", "name": "f", "description": ""}, "q": {"definition": "if(q1=abs(p),q1+1,q1)", "templateType": "anything", "group": "Ungrouped variables", "name": "q", "description": ""}, "p": {"definition": "random(-6..6)", "templateType": "anything", "group": "Ungrouped variables", "name": "p", "description": ""}, "y0": {"definition": "random(-3..3 except yd0)", "templateType": "anything", "group": "Ungrouped variables", "name": "y0", "description": ""}, "yd0": {"definition": "random(-3..3)", "templateType": "anything", "group": "Ungrouped variables", "name": "yd0", "description": ""}}, "metadata": {"notes": "

2/06/2012:

\n

Added tags.

\n

Improved display in Advice.

\n

Changed accuracy setting to relative difference of 0.00001 for second part in order to catch any errors.

\n

19/07/2012:

\n

Added description.

\n

Checked calculations.

\n

23/07/2012:

\n

Added tags.

\n

 

\n

Question appears to be working correctly.

\n

 

\n

29/4/2016

\n

Replaced forcing term x with Asin(fx). Appears to be working.

\n

3/5/16: Initial conditions included. Works. No detail in finding ICs in feedback.

", "description": "

Find the general solution of $y''+2py'+(p^2-q^2)y=A\\sin(fx)$ in the form  $A_1e^{ax}+B_1e^{bx}+y_{PI}(x),\\;y_{PI}(x)$ a particular integral. Use initial conditions to find $A_1,B_1$.

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}], "contributors": [{"name": "Daniel Nucinkis", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/767/"}]}]}], "contributors": [{"name": "Daniel Nucinkis", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/767/"}]}