// Numbas version: finer_feedback_settings {"name": "Dynamical system 9: Saddle.", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {}, "parts": [{"stepsPenalty": 0, "showCorrectAnswer": true, "variableReplacements": [], "showFeedbackIcon": 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}$.
\nInput the components of the matrix $\\mathsf{A}$ in order to obtain a saddle.
\nIn order to achieve this you have to supply the diagonal elements of the matrix, the entries for $b,\\;c$ are given. In this case the eigenvalues of $A$ are real and of opposite signs.
\nYou are given that $b=\\var{f},\\;c=\\var{g}$.
\n$\\mathsf{A}=\\Bigg($ | \n[[0]] | \n$\\var{f}$ | \n$\\Bigg)$ | \n
$\\var{g}$ | \n[[1]] | \n
Once you have input appropriate values into the matrix, the diagram below shows the plot of $(x(t),y(t))$.
\nAt $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\nYou can click on Steps to see the solutions for $x(t),\\;y(t)$ after you have input values into the matrix.
", "type": "gapfill", "gaps": [{"showFeedbackIcon": true, "minValue": "1", "type": "numberentry", "allowFractions": false, "maxValue": "1", "showCorrectAnswer": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain", "variableReplacements": [], "correctAnswerFraction": false, "variableReplacementStrategy": "originalfirst", "scripts": {"mark": {"script": "!doesMarking;\nthis.answered=true;", "order": "instead"}}, "marks": 0}, {"showFeedbackIcon": true, "minValue": "1", "type": "numberentry", "allowFractions": false, "maxValue": "1", "showCorrectAnswer": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain", "variableReplacements": [], "correctAnswerFraction": false, "variableReplacementStrategy": "originalfirst", "scripts": {"mark": {"script": "!doesMarking;\nthis.answered=true;", "order": "instead"}}, "marks": 0}, {"showFeedbackIcon": true, "minValue": "1", "type": "numberentry", "allowFractions": false, "maxValue": "1", "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain", "variableReplacements": [], "correctAnswerFraction": false, "variableReplacementStrategy": "originalfirst", "scripts": {}, "marks": 1}, {"showFeedbackIcon": true, "minValue": "1", "type": "numberentry", "allowFractions": false, "maxValue": "1", "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain", "variableReplacements": [], "correctAnswerFraction": false, "variableReplacementStrategy": "originalfirst", "scripts": {}, "marks": 2}], "steps": [{"showCorrectAnswer": true, "variableReplacements": [], "showFeedbackIcon": true, "prompt": "\n
$x(t)$ is in black, $y(t)$ in blue.
\nYou can use the navigation bar to zoom in and out of the graph.
", "type": "information", "variableReplacementStrategy": "originalfirst", "scripts": {}, "marks": 0}], "variableReplacementStrategy": "originalfirst", "scripts": {}, "marks": 0}], "variablesTest": {"maxRuns": 100, "condition": ""}, "extensions": ["jsxgraph"], "metadata": {"description": "Asking users to input coefficients of a system of diff equations so that the phase space is a saddle. 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"}, "rulesets": {"std": ["all", "!collectNumbers", "!noLeadingMinus"]}, "ungrouped_variables": ["xr", "yr", "g", "f"], "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 saddle.
\n\\[\\begin{align}\\dot{x}&=\\simplify[std]{a*x+b*y},\\\\\\dot{y}&=\\simplify[std]{c*x+d*y}.\\end{align}\\]
\nNote that this question is purely formative and for experimenting with. No marks are given.
", "preamble": {"css": "", "js": "var pc;\nvar brd;\nvar P1;\nvar brd1;\nvar g1;\nvar g2;\nvar fin;\nvar m;\nvar e1;\nvar e2;\n\nfunction updateBoards(a,b,c,d,r1,r2) {\n function f(x,yy) {\nvar y1 = yy[0];\nvar y2 = yy[1];\nvar z1 = a*y1+b*y2;\nvar z2 = c*y1+d*y2;\nreturn [z1,z2];\n }\n \n function ode() {\n//solution curve data array produced in the interval between 0 and 10, 200 steps\nreturn 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\nreturn JXG.Math.Numerics.rungeKutta('heun', [P1.Y(),P1.X()], [0, -10], 500, f);\n }\n\npc.updateDataArray = function() {\nvar data = ode();\nvar l=data.length;\nvar data1=ode1();\nvar l1=data1.length;\nthis.dataX = [];\nthis.dataY = [];\nfor(var i=0; iGiven 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}\\]
\nIt 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}\\]
\nIn this case, with $b=\\var{f},\\;c=\\var{g}$ we want to enter values for $a,\\;d$ such that the system gives a saddle for its phase space.
\nFor this to happen we need the eigenvalues of $A$ to be real with one positive and one negative.
\nThe characteristic polynomial for $A$ is given by
\n\\[\\det\\left(\\mathsf{A}-\\lambda\\mathsf{I}\\right)=0,\\]
\ni.e. $(a-\\lambda)(d-\\lambda)-bc=0$. This leads to $\\lambda^2-(a+d)\\lambda+(ad-bc)=0$.
\nSo in order to get real eigenvalues with opposite signs we need :
\n1. Real roots. $(a+d)^2 \\gt 4(ad-bc) \\Rightarrow (a-d)^2 \\gt -4bc$.
\nHence we have one condition is that $(a-d)^2 \\gt \\simplify[all,!collectNumbers]{-4*{f}*{g}={-4*f*g}}$
\n2. Opposite signs. The roots are given by $\\displaystyle \\frac{(a+d) \\pm \\sqrt{(a+d)^2-4(ad-bc)}}{2}$.
\nHence if $\\operatorname{det}(A)=ad-bc \\lt 0$ we see that the roots are opposite in sign.
\nSo this is the other condition: $ad-bc \\lt 0 \\Rightarrow ad \\lt \\var{f}\\times \\var{g}=\\var{f*g}$
\n", "variables": {"yr": {"description": "", "group": "Ungrouped variables", "definition": "50", "templateType": "anything", "name": "yr"}, "g": {"description": "", "group": "Ungrouped variables", "definition": "-sign(f)*random(1..5)", "templateType": "anything", "name": "g"}, "f": {"description": "", "group": "Ungrouped variables", "definition": "random(-9..9 except[0,1,-1])", "templateType": "anything", "name": "f"}, "xr": {"description": "", "group": "Ungrouped variables", "definition": "50", "templateType": "anything", "name": "xr"}}, "tags": ["centres", "Differential equations", "differential equations", "dynamical system", "feedback", "fixed points", "interactive", "Jsxgraph", "jsxgraph", "phase space", "saddle", "stable", "systems of differential equations", "unstable"], "name": "Dynamical system 9: Saddle.", "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/"}]}