// Numbas version: exam_results_page_options {"timing": {"timeout": {"action": "none", "message": ""}, "allowPause": true, "timedwarning": {"action": "none", "message": ""}}, "metadata": {"description": "

description

", "licence": "Creative Commons Attribution-ShareAlike 4.0 International"}, "feedback": {"intro": "", "showactualmark": true, "showanswerstate": true, "allowrevealanswer": true, "showtotalmark": true, "feedbackmessages": [], "advicethreshold": 0}, "showstudentname": true, "name": "Joshua's copy of Week 1 homework test", "navigation": {"onleave": {"action": "none", "message": ""}, "preventleave": true, "showresultspage": "oncompletion", "showfrontpage": true, "reverse": true, "browse": true, "allowregen": true}, "duration": 0, "question_groups": [{"pickingStrategy": "all-ordered", "pickQuestions": 1, "name": "Group", "questions": [{"name": "The domain and codomain of a function", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Daniel Mansfield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/743/"}], "functions": {}, "ungrouped_variables": ["x1", "y1"], "tags": [], "preamble": {"css": "", "js": ""}, "advice": "", "rulesets": {}, "parts": [{"maxAnswers": 0, "displayColumns": 0, "prompt": "

Which combinations of domain and codomain make the formula $g(x) = 2x$ into a function?

", "matrix": ["1", "-1", "1", "1"], "shuffleChoices": false, "variableReplacements": [], "minAnswers": "0", "variableReplacementStrategy": "originalfirst", "maxMarks": 0, "distractors": ["", "$g(2)=4$ is not in the codomain", "", ""], "showCorrectAnswer": true, "scripts": {}, "warningType": "none", "marks": 0, "choices": ["

Domain $\\left\\{0,1,2\\right\\}$ and codomain $\\left\\{0,2,4\\right\\}$

", "

Domain $\\left\\{0,1,2\\right\\}$ and codomain $\\left\\{0,2\\right\\}$

", "

Domain $\\left\\{0,1,2\\right\\}$ and codomain $\\left\\{0,2,4,5\\right\\}$

", "

Domain $\\mathbb N$ and codomain $\\mathbb N$.

"], "type": "m_n_2", "displayType": "checkbox", "minMarks": 0}, {"maxAnswers": 0, "displayColumns": 0, "prompt": "

Which of the following forumulas make $h:\\mathbb Z \\mapsto \\mathbb Z$ into a function?

", "matrix": ["1", "-1", "-1", "1", "-1", "1"], "shuffleChoices": false, "variableReplacements": [], "minAnswers": 0, "variableReplacementStrategy": "originalfirst", "maxMarks": 0, "distractors": ["", "$h(1)=\\pm 1$ and so the input of 1 determines two possible outputs.", "$h(2) = \\sqrt(2)$ is not an element of the codomain", "", "$\\frac12$ is not in the codomain", ""], "showCorrectAnswer": true, "scripts": {}, "warningType": "none", "marks": 0, "choices": ["

$h(x) = -x$

", "

$h(x) = \\pm x$

", "

$h(x) = \\sqrt{x}$

", "

$h(x) = x^2$

", "

$h(x) = \\frac12$

", "

$h(x) = 1$

"], "type": "m_n_2", "displayType": "checkbox", "minMarks": 0}], "statement": "

Informally, a function tells you how to transform elements of one set into another. The parts of a function are the: name, domain, codomain and formula.

\n\n

We use the notation $f: X\\mapsto Y$ to mean that the function named $f$ has domain $X$ and codomain $Y$. The formula is expressed separately, for example

\n

$ f: \\left\\{-1,0,1\\right\\} \\mapsto \\left\\{0,1\\right\\}, f(x) = x^2.$

\n

The distinctive aspect of a function is that for any input, the formula determines exactly one output. 

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"y1": {"definition": "x1+1", "templateType": "anything", "group": "Ungrouped variables", "name": "y1", "description": ""}, "x1": {"definition": "random(-1,0,1)", "templateType": "anything", "group": "Ungrouped variables", "name": "x1", "description": ""}}, "metadata": {"description": "

A short question explaining the domain of a function.

", "licence": "Creative Commons Attribution-ShareAlike 4.0 International"}, "type": "question"}, {"name": "Testing JSXGraph for a network diagram", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Joshua Capel", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1479/"}], "advice": "", "statement": "

Goal: Make a diagram so students can click on the edges in a network diagram and create a tree.

", "metadata": {"licence": "None specified", "description": ""}, "rulesets": {}, "ungrouped_variables": ["a", "b"], "variablesTest": {"maxRuns": 100, "condition": "a<>b"}, "preamble": {"js": "", "css": ""}, "tags": [], "parts": [{"showCorrectAnswer": true, "marks": 0, "gaps": [{"showFeedbackIcon": true, "marks": 1, "variableReplacements": [], "type": "numberentry", "maxValue": "1", "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "minValue": "1", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "mustBeReduced": false, "correctAnswerFraction": false, "scripts": {"validate": {"order": "instead", "script": "console.log('Validating');\nreturn true;"}, "mark": {"order": "instead", "script": "console.log('Marking');\n\nvar selectedEdges=[]\n\nvar totalVertices=Object.keys(this.PointDict).length;\nconsole.log(\"There are \"+totalVertices+\" in this graph\");\n\nfor (i=0;i0){\n // grab the \"first\" item in the set (and remove it from the set)\n var chosenPoint=newPoints.values().next()['value'];\n newPoints.delete(chosenPoint);\n oldPoints.add(chosenPoint);\n \n // Loop (backwards) over all the selected edges looking for new points\n // remove edges that get used to reduced redundancy\n for (j=selectedEdges.length-1;j>=0;j--){\n // Make foundPoint a 'falsey' value\n foundPoint=false;\n if (selectedEdges[j][0]==chosenPoint){\n foundPoint=selectedEdges[j][1];\n } else if (selectedEdges[j][1]==chosenPoint){\n foundPoint=selectedEdges[j][0]; \n }\n // Check the truthy-ness of foundPoint\n if (foundPoint){\n // splice out the found edge\n selectedEdges.splice(j,1);\n console.log(\"Splicing\");\n console.log(selectedEdges);\n if (oldPoints.has(foundPoint)){\n } else {\n newPoints.add(foundPoint);\n // console.log(newPoints);\n }\n }\n }\n }\n console.log(oldPoints);\n if (oldPoints.size < totalVertices){\n this.setCredit(0,\"Your graph is not connected\");\n } else {\n if (totalSelected > totalVertices-1) {\n this.setCredit(0,\"Your graph contains loops.\");\n } else {\n this.setCredit(1,\"Your have created a tree. Good work!\");\n }\n }\n}\n//Check if all points were connected\n\n\n// Find all edges containing this edge and add the other points to the \"new\" set \n\n// Place this vertex in the \"old\" set remove it from the \"new\"\n\n// Pick a vertex from the \"new\" set and iterate\n\n// Now the loop has terminated we have all vertices connected to \"A\".\n// Check if the number of vertices we have found equals the number of vertices we should have.\n\n"}}, "allowFractions": false}], "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "type": "gapfill", "scripts": {}, "prompt": "

{createNetwork()}

\n

This will be the information only part.

", "showFeedbackIcon": true}], "variables": {"b": {"definition": "random(0.1..1#0.1)", "name": "b", "description": "", "templateType": "randrange", "group": "Ungrouped variables"}, "a": {"definition": "random(0.1..1#0.1)", "name": "a", "description": "", "templateType": "randrange", "group": "Ungrouped variables"}}, "variable_groups": [], "functions": {"createNetwork": {"definition": "// This function creates the board and sets it up, then returns an\n// HTML div tag containing the board.\n \n// The line is described by the equation \n// y = a*x + b\n\n// This function takes as its parameters the coefficients a and b,\n// and the coordinates (x2,y2) of a point on the line.\n\n// First, make the JSXGraph board.\n// The function provided by the JSXGraph extension wraps the board up in \n// a div tag so that it's easier to embed in the page.\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','266px',\n{boundingBox: [-3,2,3,-2],\n axis: false,\n showNavigation: false,\n // grid: true\n});\n\n// div.board is the object created by JSXGraph, which you use to \n// manipulate elements\n\nvar blueColor='#0000ff';\nvar grayColor='#9b9b9b';\n\nvar PointStyle={face:'o', size:5, fixed:true};\nvar LineStyle={straightFirst:false,straightLast:false,strokeWidth:5,dash:0,strokeColor:blueColor};\n\n//Setting .studentAnswer(0) prevents grading errors due to \n//undefined .studentAnswer\nquestion.parts[0].gaps[0].display.studentAnswer(0);\n\n//Create a function for changing the line styles based on state\nfunction changelinestyle(){\n// console.log(this);\n if(this.selected==true){\n this.selected=false;\n this.setAttribute({dash:1,strokeColor:grayColor});\n } else {\n this.selected=true ;\n this.setAttribute({dash:0,strokeColor:blueColor});\n }\n};\n\nvar board = div.board; \n\nvar PointDict={\"A\":0\n ,\"B\":1\n ,\"C\":2\n ,\"D\":3\n ,\"E\":4\n ,\"F\":5\n ,\"G\":6\n ,\"H\":7\n ,\"I\":8};\n\nvar PointInfoArray=[[[-2.0, 0.0],\"A\"]\n ,[[-1.0, 1.0],\"B\"]\n ,[[ 0.0, 0.0],\"C\"]\n ,[[ 1.0, 1.0],\"D\"]\n ,[[ 2.0, 0.0],\"E\"]\n ,[[ 1.0, .33],\"F\"]\n ,[[ 1.0,-.33],\"G\"]\n ,[[-1.0,-1.0],\"H\"]\n ,[[ 1.0,-1.0],\"I\"]];\n \nPointArray=[];\n\nfor (i=0;iEnter the value for \\(A\\) as an exact fraction.      \\(A=\\) [[0]]

\n

Enter the value for \\(B\\) as an exact fraction.      \\(B=\\) [[1]]

\n

Enter the value for \\(C\\) as an exact fraction.      \\(C=\\) [[2]]

\n

Enter the value for \\(D\\).                                           \\(D=\\) [[3]]

"}], "statement": "

The diagram below shows a typical mass-spring-damper system as might apply to the suspension of a car.

\n

(Masses have mass M, springs with stiffness k and dampers having damping coefficient B).

\n

The associated variables are displacement x(t) and force F(t).

\n

 

\n

Initially the mass is at a distance \\(\\var{i0}cm\\) from the equilibrium point and is moving at \\(\\var{i1}cm/s\\).

\n

If \\(B=\\simplify{2*{a1}}\\)  and  \\(k=\\simplify{{a1}^2}\\) and the system is subjected to an external applied force \\(F(t)=\\var{c1}e^{-\\var{d1}t}+\\var{b}\\delta(t-\\var{f})\\)

\n

then from Newton's law we get the differential equation:

\n

\n

     \\(\\frac{d^2x}{dt^2}+\\simplify{{a1}+{a1}}\\frac{dx}{dt}+\\simplify{{a1}*{a1}}x(t)=\\var{c1}e^{-\\var{d1}t}+\\var{b}\\delta(t-\\var{f})\\)  where \\(x(0)=\\var{i0} \\,\\, and \\,\\,  x'(0)=\\var{i1}\\)

\n

\n

The solution of the equation is given by:

\n

\n

     \\(x(t)=Ae^{-\\var{d1}t}+Be^{-\\var{a1}t}+Cte^{-\\var{a1}t}+Du(t-\\var{f})(t-\\var{f})e^{-\\var{a1}(t-\\var{f})}\\)

\n

.

", "rulesets": {}, "preamble": {"js": "", "css": ""}, "variable_groups": [], "functions": {}, "advice": "

\\(\\frac{d^2x}{dt^2}+\\simplify{{a1}+{a1}}\\frac{dx}{dt}+\\simplify{{a1}*{a1}}x(t)=\\var{c1}e^{-\\var{d1}t}+\\var{b}\\delta(t-\\var{f})\\)  where \\(x(0)=\\var{i0} \\,\\, and \\,\\,  x'(0)=\\var{i1}\\)

\n

The Laplace transform of this is given by:

\n

\\(s^2X(s)-\\var{i0}s-\\var{i1}+\\simplify{{a1}+{a1}}(sX(s)-\\var{i0})+\\simplify{{a1}*{a1}}X(s)=\\frac{\\var{c1}}{s+\\var{d1}}+\\var{b}e^{-\\var{f}s}\\)

\n

Gathering only \\(X(s)\\) terms on the left hand side and factoring gives:

\n

\\((s^2+\\simplify{{a1}+{a1}}s+\\simplify{{a1}*{a1}})X(s)=\\frac{\\var{c1}}{s+\\var{d1}}+\\var{i0}s+\\simplify{{i1}+({a1}+{a1})*{i0}}+\\var{b}e^{-\\var{f}s}\\)

\n

\\((s^2+\\simplify{{a1}+{a1}}s+\\simplify{{a1}*{a1}})X(s)=\\frac{\\simplify{{c1}+({i0}s+{i1}+({a1}+{a1})*{i0})*(s+{d1})}}{s+\\var{d1}}+\\var{b}e^{-\\var{f}s}\\)

\n

\\(X(s)=\\frac{\\simplify{{c1}+({i0}s+{i1}+({a1}+{a1})*{i0})*(s+{d1})}}{(s+\\var{d1})(s+\\var{a1})^2}+\\frac{\\var{b}}{(s+\\var{a1})^2}e^{-\\var{f}s}\\)

\n

Solving the first fraction gives:

\n

\\(X(s)=\\frac{A}{s+\\var{d1}}+\\frac{B}{s+\\var{a1}}+\\frac{C}{(s+\\var{a1})^2}\\)

\n

\\(\\simplify{{c1}+({i0}s+{i1}+({a1}+{a1})*{i0})*(s+{d1})}=A(s+\\var{a1})(s+\\var{a1})+B(s+\\var{d1})(s+\\var{a1})+C(s+\\var{d1})\\)

\n

Let \\(s=-\\var{d1}\\)

\n

\\(\\simplify{{c1}+({i0}*-{d1}+{i1}+({a1}+{a1})*{i0})*(-{d1}+{d1})}=\\simplify{(-{d1}+{a1})(-{d1}+{a1})}A\\)

\n

\\(A=\\simplify{({c1})/((-{d1}+{a1})(-{d1}+{a1}))}\\)

\n

Let \\(s=-\\var{a1}\\)

\n

\\(\\simplify{{c1}+({i0}*-{a1}+{i1}+({a1}+{a1})*{i0})*(-{a1}+{d1})}=\\simplify{(-{a1}+{d1})}C\\)

\n

\\(C=\\simplify{({c1}+({i0}*-{a1}+{i1}+({a1}+{a1})*{i0})*(-{a1}+{d1}))/((-{a1}+{d1}))}\\)

\n

Compare the coefficients of \\(s^2\\)   

\n

\\(\\var{i0}=A+B\\)

\n

\\(B=\\simplify{{i0}-(({c1})/((-{d1}+{a1})(-{d1}+{a1})))}\\)

\n

\\(B=\\simplify{({i0}*(-{d1}+{a1})*(-{d1}+{a1})-{c1})/((-{d1}+{a1})*(-{d1}+{a1}))}\\)

\n

We can find the inverse Laplace transform of the second fraction without breaking it down: 

\n

\\(\\frac{\\var{b}}{(s+\\var{a1})^2}e^{-\\var{f}s}\\) changes to \\(\\var{b}u(t-\\var{f})(t-\\var{f})e^{-\\var{a1}(t-\\var{f})}\\)

\n

\\(D=\\var{b}\\)

", "tags": [], "ungrouped_variables": ["a1", "c1", "d1", "i0", "i1", "b", "f", "B_1"], "metadata": {"licence": "Creative Commons Attribution-NonCommercial 4.0 International", "description": "

Solve a Differential equation with a repeated linear factor & a delta function

"}, "variables": {"b": {"name": "b", "group": "Ungrouped variables", "description": "", "templateType": "randrange", "definition": "random(2..12#1)"}, "B_1": {"name": "B_1", "group": "Ungrouped variables", "description": "", "templateType": "anything", "definition": "{i0}-{c1}/((-{d1}+{a1})(-{d1}+{a1}))"}, "f": {"name": "f", "group": "Ungrouped variables", "description": "", "templateType": "randrange", "definition": "random(1..9#1)"}, "a1": {"name": "a1", "group": "Ungrouped variables", "description": "", "templateType": "anything", "definition": "random(1..5)"}, "d1": {"name": "d1", "group": "Ungrouped variables", "description": "", "templateType": "anything", "definition": "random(12..16)"}, "i0": {"name": "i0", "group": "Ungrouped variables", "description": "", "templateType": "anything", "definition": "random(1..10)"}, "i1": {"name": "i1", "group": "Ungrouped variables", "description": "", "templateType": "anything", "definition": "random(1..10) "}, "c1": {"name": "c1", "group": "Ungrouped variables", "description": "", "templateType": "anything", "definition": "random(1..10)"}}, "variablesTest": {"maxRuns": "222", "condition": ""}, "type": "question"}]}], "percentPass": "0", "showQuestionGroupNames": false, "type": "exam", "contributors": [{"name": "Joshua Capel", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1479/"}], "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [["question-resources/MSD.jpg", "/srv/numbas/media/question-resources/MSD.jpg"]]}