// Numbas version: finer_feedback_settings {"name": "Bill's copy of Dynamical system 6:Centre.", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [], "advice": "

Given the system of differential equations:

\n

\\[\\begin{align}\\dot{x}&=\\simplify[std]{a*x+b*y},\\\\\\dot{y}&=\\simplify[std]{c*x+d*y}.\\end{align}\\]

\n

It can be written in the form $\\dot{\\boldsymbol{x}}=\\mathsf{A}\\boldsymbol{x}$, where $\\boldsymbol{x}=\\pmatrix{x,y}^\\mathsf{T}$ and 

\n

\\[\\mathsf{A}=\\pmatrix{a& b\\\\c & d}\\]

\n

In this case, with $a=\\var{f}$  we want to enter values for $b,\\;c,\\;d$ such that the system gives a centre.

\n

For this to happen we need the eigenvalues of $A$ to be purely imaginary and you are given that they are $\\simplify{{v}*i}$ and $\\simplify{{-v}*i}$.

\n

The characteristic polynomial for $A$ is given by 

\n

\\[\\det\\left(\\mathsf{A}-\\lambda\\mathsf{I}\\right)=0,\\]

\n

i.e.  $(a-\\lambda)(d-\\lambda)-bc=0$.  This leads to $\\lambda^2-(a+d)\\lambda+(ad-bc)=0$.

\n

So in order to get purely imaginary eigenvalues $\\pm \\var{abs(v)*i}$ we need :

\n

1. $a+d=0 \\Rightarrow d=\\var{-f}$ as $a=\\var{f}$.

\n

2. $ad-bc=\\var{v^2} \\Rightarrow bc=-\\var{v^2}-\\var{f^2}$.

\n

Hence if you set $d=\\var{-f}$ and you  choose values of  $b,\\;c$ such that $bc=-\\var{f^2+v^2}$, this will give the required system of differential equations with phase space a centre and the required eigenvalues.

", "parts": [{"gaps": [{"minValue": "1", "type": "numberentry", "variableReplacements": [], "correctAnswerStyle": "plain", "showFeedbackIcon": true, "allowFractions": false, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": false, "maxValue": "1", "marks": 0, "correctAnswerFraction": false, "scripts": {"mark": {"script": "!doesMarking;\nthis.answered=true;", "order": "instead"}}}, {"minValue": "1", "type": "numberentry", "variableReplacements": [], "correctAnswerStyle": "plain", "showFeedbackIcon": true, "allowFractions": false, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": false, "maxValue": "1", "marks": 0, "correctAnswerFraction": false, "scripts": {"mark": {"script": "!doesMarking;\nthis.answered=true;", "order": "instead"}}}, {"minValue": "1", "type": "numberentry", "variableReplacements": [], "correctAnswerStyle": "plain", "showFeedbackIcon": true, "allowFractions": false, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": false, "maxValue": "1", "marks": 0, "correctAnswerFraction": false, "scripts": {"mark": {"script": "!doesMarking;\nthis.answered=true;", "order": "instead"}}}, {"minValue": "0", "type": "numberentry", "variableReplacements": [], "correctAnswerStyle": "plain", "showFeedbackIcon": true, "allowFractions": false, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "maxValue": "0", "marks": 1, "correctAnswerFraction": false, "scripts": {}}, {"minValue": "0", "type": "numberentry", "variableReplacements": [], "correctAnswerStyle": "plain", "showFeedbackIcon": true, "allowFractions": false, "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "maxValue": "0", "marks": 2, "correctAnswerFraction": false, "scripts": {}}], "type": "gapfill", "steps": [{"type": "information", "showFeedbackIcon": true, "scripts": {}, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "prompt": "

Graph of $x(t),\\;y(t)$

\n
\n

\n

$x(t)$ is in black, $y(t)$ in blue.

\n

You can use the navigation bar to zoom in and out of the graph.

", "variableReplacements": [], "marks": 0}], "showFeedbackIcon": true, "scripts": {}, "stepsPenalty": 0, "showCorrectAnswer": true, "prompt": "

The system can be written in the form $\\dot{\\boldsymbol{x}}=\\mathsf{A}\\boldsymbol{x}$, where $\\boldsymbol{x}=\\pmatrix{x,y}^\\mathsf{T}$.

\n

Input the components of the matrix $\\mathsf{A}$ in order to obtain a centre where the eigenvalues of $A$ are $\\simplify{{v}*i}$ and $\\simplify{{-v}*i}$.

\n

You are given that $a=\\var{f}$.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$\\mathsf{A}=\\Bigg($$\\var{f}$[[0]]$\\Bigg)$
[[1]][[2]]
\n

\n

\n

Once you have input appropriate values into the matrix, the diagram below shows the plot of $(x(t),y(t))$.

\n

At $t=0$ we have initally $x=-5,\\;\\;y=5$. Moving the point gives phase diagrams for the following initial values at $t=0$:

\n

$x=\\;$       $y=\\;$

\n

\n

\n
\n

\n\n

\n

You can click on Steps to see the solutions for $x(t),\\;y(t)$ after you have input values into the matrix.

", "variableReplacements": [], "marks": 0, "variableReplacementStrategy": "originalfirst"}], "variables": {"v": {"description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "v", "definition": "random(1..5)"}, "xr": {"description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "xr", "definition": "50"}, "yr": {"description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "yr", "definition": "50"}, "f": {"description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "f", "definition": "random(-9..9 except[0,1,-1])"}}, "tags": ["centres", "Differential equations", "differential equations", "dynamical system", "feedback", "fixed points", "interactive", "Jsxgraph", "jsxgraph", "navigation change", "phase space", "stable", "systems of differential equations", "unstable"], "rulesets": {"std": ["all", "!collectNumbers", "!noLeadingMinus"]}, "variablesTest": {"condition": "", "maxRuns": 100}, "functions": {}, "metadata": {"description": "

Asking users to input coefficients of a system of diff equations so that the phase space is a centre. All systems input by the user are graphed together with immediate feedback. Also included in the Steps are the graphs of the solutions for $x(t),\\; y(t);\\; x(0)=-5,\\;y(0)=5.$

", "licence": "Creative Commons Attribution 4.0 International"}, "extensions": ["jsxgraph"], "preamble": {"css": "", "js": "var pc;\nvar brd;\nvar P1;\nvar brd1;\nvar g1;\nvar g2;\nvar fin;\nvar m;\nvar adv;\nfunction updateBoards(a,b,c,d) {\n function f(x,yy) {\n var y1 = yy[0];\n var y2 = yy[1];\n var z1 = a*y1+b*y2;\n var z2 = c*y1+d*y2;\n return [z1,z2];\n }\n \n function ode() {\n //solution curve data array produced in the interval between 0 and 10, 200 steps\n return JXG.Math.Numerics.rungeKutta('heun', [P1.Y(),P1.X()], [0, 10], 500, f);\n }\n function ode1() {\n //solution curve data array produced in the interval between 0 and -10, 200 steps\n return JXG.Math.Numerics.rungeKutta('heun', [P1.Y(),P1.X()], [0, -10], 500, f);\n }\n \n pc.updateDataArray = function() {\n var data = ode();\n var l=data.length;\n var data1=ode1();\n var l1=data1.length;\n this.dataX = [];\n this.dataY = [];\n for(var i=0; i0){\n ty='Unstable spiral.';\n } \n else if(ans1<0){\n ty='Stable spiral.';\n }\n else {\n ty='Centre.';\n }\n }\n else {\n if(det<0){\n ty='Saddle.';\n }\n else if ((det>0)&&(ans1>0)){\n ty='Unstable node.';\n } \n else {\n ty='Stable node.';\n }\n }\n }\n else {ty=''};\n //if either the input has not been completed or the correct answer has been input - no message.\n if(fin){adv='You have not entered all the numerical values into the matrix';}\n if(fin||((ans1==0)&&(ans2==0))){ m='';}\n //all entries have been input and an incorrect diagonal value has been input or gives the wrong eigenvalue.\n else if(ans1!=0){m='You did not enter the correct value for the diagonal.';}\n else {m='You have the wrong eigenvalue.';}\n \n var html = $(question.display.html);\n html.find('#type').text(ty);\n //This is displayed in the question as an aid to the user.\n html.find('#mess').text(m);\n \n /*values for hidden gapfills which are marked*/\n question.parts[0].gaps[3].display.studentAnswer(ans1); \n question.parts[0].gaps[4].display.studentAnswer(ans2);\n \n updateBoards(a,b,c,d);\n });\n});\n"}, "statement": "

Consider the following two-dimensional dynamical system . You have to find values for $a,\\;b\\;c,\\;d$ such that the system's phase space is a centre.

\n

\\[\\begin{align}\\dot{x}&=\\simplify[std]{a*x+b*y},\\\\\\dot{y}&=\\simplify[std]{c*x+d*y}.\\end{align}\\]

\n

Note that this question is purely formative and for experimenting with. No marks are given.

", "ungrouped_variables": ["xr", "yr", "v", "f"], "name": "Bill's copy of Dynamical system 6:Centre.", "type": "question", "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}]}]}], "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}]}