// Numbas version: exam_results_page_options {"pickQuestions": 0, "type": "exam", "duration": 0.0, "percentpass": 0.0, "shufflequestions": false, "timing": {"allowpause": true, "timedwarning": {"action": "none", "message": ""}, "timeout": {"action": "none", "message": ""}}, "feedback": {"showtotalmark": true, "showanswerstate": true, "allowrevealanswer": true, "advicethreshold": 0.0, "showactualmark": true}, "question_groups": [{"pickQuestions": 0, "pickingStrategy": "all-ordered", "questions": [{"name": "JSXGraph test", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "tags": [], "parts": [{"type": "gapfill", "prompt": "

This part demonstrates a binding between the properties of an element in the graph and values entered in the answer boxes.

\n

Place the dot at $(\\var{a},\\var{b})$. You can either drag the dot or enter coordinates in the box.

\n

{dragpoint()}

\n

$X$: [[0]], $Y$: [[1]]

", "gaps": [{"notationStyles": ["plain", "en", "si-en"], "correctAnswerFraction": false, "type": "numberentry", "minValue": "a-0.1", "variableReplacements": [], "scripts": {}, "showCorrectAnswer": true, "mustBeReducedPC": 0, "correctAnswerStyle": "plain", "maxValue": "a+0.1", "mustBeReduced": false, "allowFractions": false, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "marks": 1}, {"notationStyles": ["plain", "en", "si-en"], "correctAnswerFraction": false, "type": "numberentry", "minValue": "b-0.1", "variableReplacements": [], "scripts": {}, "showCorrectAnswer": true, "mustBeReducedPC": 0, "correctAnswerStyle": "plain", "maxValue": "b+0.1", "mustBeReduced": false, "allowFractions": false, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "marks": 1}], "scripts": {}, "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "variableReplacements": [], "showCorrectAnswer": true, "marks": 0}, {"displayType": "radiogroup", "prompt": "

This part shows the use of a dynamic graph to illustrate a question.

\n

{singraph()}

\n

Is this function odd or even, or neither? You can drag the point labelled $f(x)$ and compare it with the point labelled $f(-x)$.

", "scripts": {}, "showCorrectAnswer": true, "variableReplacements": [], "matrix": [1, 0, 0], "maxMarks": 0, "displayColumns": 0, "distractors": ["", "", ""], "choices": ["

Odd

", "

Even

", "

Neither

"], "type": "1_n_2", "minMarks": 0, "showFeedbackIcon": true, "shuffleChoices": false, "variableReplacementStrategy": "originalfirst", "marks": 0}, {"type": "gapfill", "prompt": "

This part contains a dynamic plot of the function entered by the student.

\n

Define a function $f(t)$ on $[0,2\\pi)$ which plots in polar coordinates a Lemniscate of Bernoulli touching the points $(-5,0)$, $(0,0)$ and $(5,0)$.

\n

$f(t) = $ [[0]]

\n

{polarplot()}

", "gaps": [{"vsetrange": [0, 1], "showpreview": true, "expectedvariablenames": [], "answer": "5sqrt(cos(2t))", "scripts": {}, "variableReplacements": [], "showCorrectAnswer": true, "vsetrangepoints": 5, "type": "jme", "checkingtype": "absdiff", "checkvariablenames": false, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "marks": 1, "checkingaccuracy": 0.001}], "scripts": {}, "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "variableReplacements": [], "showCorrectAnswer": true, "marks": 0}], "ungrouped_variables": ["b", "a"], "variablesTest": {"maxRuns": 100, "condition": ""}, "advice": "", "functions": {"polarplot": {"parameters": [], "type": "html", "language": "javascript", "definition": "\n var div = Numbas.extensions.jsxgraph.makeBoard('600px','400px',{\nboundingBox:[-6,4,6,-4],\ngrid: false,\nshowNavigation: false\n });\n var board = div.board;\n \n var tree;\n var nscope = new Numbas.jme.Scope([scope,{variables:{t:new Numbas.jme.types.TNum(0)}}]);\n var curve = board.create('curve',[function(t){\nif(tree) {\n try {\nnscope.variables.t.value = t;\n var val = Numbas.jme.evaluate(tree,nscope).value;\n return val;\n }\n catch(e) {\nreturn 0;\n }\n}\nelse\n return 0;\n },[0,0]],0,2*Math.PI);\n \n question.signals.on('HTMLAttached',function(e) {\nko.computed(function(){\nvar expr = question.parts[2].gaps[0].display.studentAnswer();\ntry {\n tree = Numbas.jme.compile(expr,scope);\n}\ncatch(e) {\n tree = null;\n}\ncurve.updateCurve();\nboard.update();\n});\n });\n \n return div;\n "}, "singraph": {"parameters": [], "type": "html", "language": "javascript", "definition": "\nvar div = Numbas.extensions.jsxgraph.makeBoard('600px','200px',{boundingBox:[-2*Math.PI,1.2,2*Math.PI,-1.2],grid:false});\nvar board = div.board;\n\nvar graph = board.create('functiongraph',function(x){return Math.sin(x)});\n\nvar p1 = board.create('glider',[1,graph.Y(1),graph],{name:'$f(x)$'});\nvar p2 = board.create('point',[function(){return - p1.X()},function(){return graph.Y(-p1.X())}],{name:'$f(-x)$'})\n\nreturn div;\n"}, "dragpoint": {"parameters": [], "type": "html", "language": "javascript", "definition": "\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',{boundingBox:[-10,10,10,-10],grid:false});\nvar board = div.board;\n\nvar x = Numbas.jme.unwrapValue(scope.variables.a);\nvar y = Numbas.jme.unwrapValue(scope.variables.b);\n\nvar a = board.create('point',[x,y],'$A$');\na.on('drag',function(){\n var x = Numbas.math.niceNumber(a.X());\n var y = Numbas.math.niceNumber(a.Y());\n Numbas.exam.currentQuestion.parts[0].gaps[0].display.studentAnswer(a.X());\n Numbas.exam.currentQuestion.parts[0].gaps[1].display.studentAnswer(y);\n});\n\nboard.create('line',[[0,2],[1,4]]);\n\nquestion.signals.on('HTMLAttached',function(e) {\n ko.computed(function(){ \n var x = parseFloat(question.parts[0].gaps[0].display.studentAnswer());\n var y = parseFloat(question.parts[0].gaps[1].display.studentAnswer());\n if(!(isNaN(x) || isNaN(y)) && board.mode!=board.BOARD_MODE_DRAG) {\n a.moveTo([x,y],100);\n }\n });\n});\n\nreturn div;\n\n"}}, "metadata": {"description": "

Experimental question using JSXGraph to provide dynamic, interactive graphs.

", "licence": "Creative Commons Attribution 4.0 International"}, "preamble": {"js": "", "css": ""}, "rulesets": {}, "variables": {"b": {"name": "b", "definition": "2", "templateType": "anything", "description": "", "group": "Ungrouped variables"}, "a": {"name": "a", "definition": "1", "templateType": "anything", "description": "", "group": "Ungrouped variables"}}, "variable_groups": [], "statement": "", "type": "question"}, {"name": "JSXGraph line of best fit plot 2", "extensions": ["stats", "jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "ungrouped_variables": ["tsqovern", "a", "b", "obj", "r1", "r2", "ss", "res", "ssq", "n", "a1", "ch", "spxy", "ls", "tol", "sc", "sxy", "b1", "t"], "parts": [{"gaps": [{"scripts": {}, "type": "numberentry", "marks": 1, "showCorrectAnswer": true, "maxValue": "b+tol", "minValue": "b-tol", "allowFractions": false, "showPrecisionHint": false, "correctAnswerFraction": false}, {"scripts": {}, "type": "numberentry", "marks": 1, "showCorrectAnswer": true, "maxValue": "a+tol", "minValue": "a-tol", "allowFractions": false, "showPrecisionHint": false, "correctAnswerFraction": false}], "stepsPenalty": 0, "prompt": "

Calculate the equation of the best fitting regression line:

\n

\\[Y = aX+b.\\] Find $a$ and $b$ to 5 decimal places, then input them below to 3 decimal places. You will use these approximate values in the rest of the question. 

\n

$a=\\;$[[0]],      $b=\\;$[[1]] (both to 3 decimal places.)

\n

\n

{regressline(r1,r2,min(r1)-10,max(r1)+10,min(r2)-10,max(r2)+10)}

\n

\n

\n

\n

You are given the following information:

\n \n \n \n \n \n \n \n \n \n \n \n
First Test$(X)$$\\sum x=\\;\\var{t[0]}$$\\sum x^2=\\;\\var{ssq[0]}$
Later Score$(Y)$$\\sum y=\\;\\var{t[1]}$$\\sum y^2=\\;\\var{ssq[1]}$
\n

Also you are given $\\sum xy = \\var{sxy}$.

\n

Click on Show steps if you want more information on calculating $a$ and $b$. You will not lose any marks by doing so.

\n

 

", "type": "gapfill", "showCorrectAnswer": true, "scripts": {}, "marks": 0, "steps": [{"prompt": "\n

To find $a$ and $b$ you first find  $\\displaystyle b = \\frac{SPXY}{SSX}$ where:

\n

$\\displaystyle SPXY=\\sum xy - \\frac{(\\sum x)\\times (\\sum y)}{\\var{n}}$

\n

$\\displaystyle SSX=\\sum x^2 - \\frac{(\\sum x)^2}{\\var{n}}$

\n

Then $\\displaystyle a = \\frac{1}{\\var{n}}\\left[\\sum y-b \\sum x\\right]$

\n

Now go back and fill in the values for $a$ and $b$.

\n

 

\n \n \n ", "type": "information", "showCorrectAnswer": true, "scripts": {}, "marks": 0}]}, {"scripts": {}, "type": "numberentry", "prompt": "\n

What is the predicted Later score for employee $\\var{obj[ch]}$ in the First test?

\n

Use the values of $a$ and $b$ you input above.

\n

Enter the predicted Later score here: (to 2 decimal places)

\n \n \n ", "marks": 1, "showCorrectAnswer": true, "correctAnswerFraction": false, "minValue": "ls-0.01", "allowFractions": false, "showPrecisionHint": false, "maxValue": "ls+0.01"}, {"gaps": [{"scripts": {}, "type": "numberentry", "marks": 1, "showCorrectAnswer": true, "maxValue": "res[ch]+0.01", "minValue": "res[ch]-0.01", "allowFractions": false, "showPrecisionHint": false, "correctAnswerFraction": false}], "stepsPenalty": 0, "prompt": "\n

Use the result above to calculate the residual value for employee $\\var{obj[ch]}$.

\n

Click on Show steps to see what is meant by the residual value if you have forgotten. You will not lose any marks by doing so.

\n

Residual value =  (to 2 decimal places).[[0]]

\n \n \n ", "type": "gapfill", "showCorrectAnswer": true, "scripts": {}, "marks": 0, "steps": [{"prompt": "\n

The residual value is given by:

\n

RESIDUAL = OBSERVED - FITTED.

\n

In this case the observed value for $\\var{obj[ch]}$ is $\\var{r2[ch]}$ and you get the fitted value by feeding the First test value  $\\var{r1[ch]}$ into the regression equation.

\n

 

\n \n \n \n ", "type": "information", "showCorrectAnswer": true, "scripts": {}, "marks": 0}]}], "showQuestionGroupNames": false, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "notes": "

21/12/2012:

\n

Checked rounding, OK. Added tag cr1.

\n

Possible use of scenarios, so added tag sc.

\n

The array r2 generates the regression data which has an inbuilt noise via r1[x]+random(-9..9).

\n

26/01/2013:

\n

No advice as yet.

\n

 13/11/2013:

\n

Uses Jsxgraph to create the regression line and some interaction with users.

", "description": "

Find a regression equation.

\n

Now includes a graph of the regression line and another interactive graph gives users the opportunity to move the regression line around. Could be used for allowing users to experiment with what they think the line should be and see how this compares with the calculated line.

"}, "type": "question", "preamble": {"css": "", "js": ""}, "variablesTest": {"condition": "", "maxRuns": 100}, "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "statement": "\n

To monitor its staff appraisal methods, a personnel department compares the results of the tests carried out on employees at their first appraisal with an assessment score of the same individuals two years later. The resulting data are as follows:

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
Employee$\\var{obj[0]}$$\\var{obj[1]}$$\\var{obj[2]}$$\\var{obj[3]}$$\\var{obj[4]}$$\\var{obj[5]}$$\\var{obj[6]}$$\\var{obj[7]}$
First Test $(X)$$\\var{r1[0]}$$\\var{r1[1]}$$\\var{r1[2]}$$\\var{r1[3]}$$\\var{r1[4]}$$\\var{r1[5]}$$\\var{r1[6]}$$\\var{r1[7]}$
Later Score $(Y)$$\\var{r2[0]}$$\\var{r2[1]}$$\\var{r2[2]}$$\\var{r2[3]}$$\\var{r2[4]}$$\\var{r2[5]}$$\\var{r2[6]}$$\\var{r2[7]}$
\n

\n

\n

{regfun(r1,r2,max(r1)+10,max(r2)+10)}

\n

\n ", "question_groups": [{"questions": [], "name": "", "pickQuestions": 0, "pickingStrategy": "all-ordered"}], "variables": {"sc": {"definition": "r1[ch]", "templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "sc"}, "ss": {"definition": "[ssq[0]-t[0]^2/n,ssq[1]-t[1]^2/n]", "templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "ss"}, "ssq": {"definition": "[sum(map(x^2,x,r1)),sum(map(x^2,x,r2))]", "templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "ssq"}, "res": {"definition": "map(precround(r2[x]-(a+b*r1[x]),2),x,0..n-1)", "templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "res"}, "b": {"definition": "precround(spxy/ss[0],3)", "templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "b"}, "b1": {"definition": "random(0.25..0.45#0.05)", "templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "b1"}, "t": {"definition": "[sum(r1),sum(r2)]", "templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "t"}, "sxy": {"definition": "sum(map(r1[x]*r2[x],x,0..n-1))", "templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "sxy"}, "spxy": {"definition": "sxy-t[0]*t[1]/n", "templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "spxy"}, "obj": {"definition": "['A','B','C','D','E','F','G','H']", "templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "obj"}, "n": {"definition": "8", "templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "n"}, "r1": {"definition": "repeat(round(normalsample(67,8)),n)", "templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "r1"}, "r2": {"definition": "map(round(a1+b1*x+random(-9..9)),x,r1)", "templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "r2"}, "ch": {"definition": "random(0..7)", "templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "ch"}, "tol": {"definition": "0.001", "templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "tol"}, "ls": {"definition": "precround(a+b*sc,2)", "templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "ls"}, "tsqovern": {"definition": "[t[0]^2/n,t[1]^2/n]", "templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "tsqovern"}, "a": {"definition": "precround(1/n*(t[1]-spxy/ss[0]*t[0]),3)", "templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "a"}, "a1": {"definition": "random(10..20)", "templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "a1"}}, "variable_groups": [], "advice": "

{regressline(r1,r2,min(r1)-10,max(r1)+10,min(r2)-10,max(r2)+10)}

", "functions": {"regfun": {"definition": "\n var div = Numbas.extensions.jsxgraph.makeBoard('600px','600px',\n {boundingBox:[-5,maxy,maxx,-5],\n axis:true,\n showNavigation:false,\n grid:false});\n var board = div.board; \n var names = 'ABCDEFGHIJKLMNOP';\n for (j=0;j<8;j++){ board.create('point',[r1[j],r2[j]],{fixed:true, style:3, strokecolor:\"#0000a0\", name:'\\['+names[j]+'\\]'})};\n var regressionPolynomial = JXG.Math.Numerics.regressionPolynomial(1, r1, r2);\n var reg = board.create('functiongraph',[regressionPolynomial],{strokeColor:'black'}); \n for(var i=0;i<8;i++){board.create(\"segment\",[[r1[i],r2[i]],[r1[i],regressionPolynomial(r1[i])]])};\n var regExpression = regressionPolynomial.getTerm();\n var regTeX = Numbas.jme.display.exprToLaTeX(regExpression,[],scope);\n \n t = board.create('text',[10,10,\n function(){ return \"\\\\[r(Y) = \" + regExpression +'\\\\]';}\n ],\n {strokeColor:'black',fontSize:18}); \n return div;\n ", "type": "html", "parameters": [["r1", "list"], ["r2", "list"], ["maxx", "number"], ["maxy", "number"]], "language": "javascript"}, "pstdev": {"definition": "sqrt(abs(l)/(abs(l)-1))*stdev(l)", "type": "number", "parameters": [["l", "list"]], "language": "jme"}, "regressline": {"definition": "\n var div = Numbas.extensions.jsxgraph.makeBoard('600px','600px',\n {boundingBox:[-5,maxy,maxx,-5],\n axis:true,\n showNavigation:false,\n grid:false});\n var board = div.board; \n for (j=0;j<8;j++){ board.create('point',[r1[j],r2[j]],{fixed:true,face:'v'})};\n var a1 = board.create('point',[minx+5,miny+5]);\n var b1 = board.create('point',[minx+7,miny+5]);\n var li=board.create('line',[a1,b1], {straightFirst:false, straightLast:false});\n var a=0;\n var b=0;\n function dr(p){\n p.on('drag',function(){\n a = Numbas.math.niceNumber((b1.Y()-a1.Y())/(b1.X()-a1.X()));\n b = Numbas.math.niceNumber((a1.Y()*b1.X()-a1.X()*b1.Y())/(b1.X()-a1.X()));\n Numbas.exam.currentQuestion.parts[0].gaps[0].display.studentAnswer(a);\n Numbas.exam.currentQuestion.parts[0].gaps[1].display.studentAnswer(b);\n \n })};\n dr(a1);\n dr(b1);\n \n return div;\n \n ", "type": "html", "parameters": [["r1", "list"], ["r2", "list"], ["minx", "number"], ["maxx", "number"], ["miny", "number"], ["maxy", "number"]], "language": "javascript"}}, "tags": ["Jsxgraph", "cr1", "data analysis", "fitted value", "graphs", "interaction", "jsxgraph", "regression", "residual value", "sc", "statistics"]}, {"name": "Interactive Newton-Raphson method", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}], "tags": ["exponential functions", "iterative method", "Jsxgraph", "JSXgraph", "jsxgraph", "Newton-Raphson method", "newton-raphson method", "numerical methods", "numerical solution", "Solving equations", "solving equations", "Steps", "steps"], "metadata": {"description": "\n\t\t

Write down the Newton-Raphson formula for finding a numerical solution to the equation $e^{mx}+bx-a=0$. If $x_0=1$ find $x_1$.

\n\t\t

Included in the Advice of this question are:

\n\t\t

6 iterations of the method.

\n\t\t

Graph of the NR process using jsxgraph. Also user interaction allowing change of starting value and its effect on the process.

\n\t\t", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "\n\t

Consider the following equation.

\n\t

\\[\\simplify[std]{e^({m}x)+{b}x-{a}=0}\\]

\n\t

Find the approximate solution in the range $0 \\le x \\le 1$ by using the Newton-Raphson method.

\n\t

The following diagram demonstrates the method.

\n\t

$x_0$ is the starting value, you can slide it along the x-axis to see the effect of changing it.

\n\t

\n\t

{test(m,b,a,maxy)}

\n\t

\n\t

\n\t

\n\t", "advice": "\n\t

a)

\n\t

Recall that the Newton-Raphson method is defined by:
\\[x_{n+1}=x_n-\\frac{g(x_n)}{g'(x_n)}\\]
where we would like to find the root of the equation $g(x)=0$

\n\t

In this question we have:
\\[\\simplify[std]{g(x) = Exp({m} * x) + {b} * x + { -a}} \\Rightarrow \\simplify[std]{g'(x) = {m}*Exp({m} * x) + {b}}\\]
Substituting these expressions into the formula we have:
\\[x_{n+1} =\\simplify[std]{ x_n -((Exp({m} * x_n) + {b} * x_n + { -a}) / ({m} * Exp({m} * x _n) + {b}))}\\]

\n\t

which can be rearranged to give:
\\[x _{n + 1} = \\simplify[std]{(({m} * x_n -1) * Exp({m} * x _n) + {a}) / ({m} * Exp({m} * x _n) + {b})}\\]

\n\t

(In your answers you would input $x$ rather than $x_n$.)

\n\t

In the following let $\\displaystyle f(x)=\\simplify[std]{ (({m} * x -1) * Exp({m} * x ) + {a}) / ({m} * Exp({m} * x ) + {b})}$

\n\t

b)

\n\t

If $x_0=2$ then $x_1$ is simply given by:
\\[\\simplify[std]{x_1 = (({2*m} -1) * Exp({2*m}) + {a}) / ({m} * Exp({2*m}) + {b})}\\]

\n\t

which to 4 decimal places is: $\\;\\;x_1= \\var{ans}$

\n\t

We find on running the iteration that the first six values are:

\n\t

\\[\\begin{align}x_1&=f(x_0)=f(2)&=\\var{results[1]}\\\\x_2&=f(x_1)=f(\\var{results[1]})&=\\var{results[2]}\\\\x_3&=f(x_2)=f(\\var{results[2]})&=\\var{results[3]}\\\\x_4&=f(x_3)=f(\\var{results[3]})&=\\var{results[4]}\\\\x_5&=f(x_4)=f(\\var{results[4]})&=\\var{results[5]}\\\\x_6&=f(x_5)=f(\\var{results[5]})&=\\var{results[6]}\\end{align}\\]

\n\t

So the solution to the equation to four decimal places for $0 \\le x \\le 1$ is $x=\\var{precround(ans1,4)}$

\n\t

Here we see the graph of $\\simplify{e^({m}*x)+{b}*x-{a}}$ and the first four successive approximations to the root:

\n\t

{test(m,b,a,maxy)}

\n\t

\n\t

Note that you can slide the first approximation $x_0$ along the x-axis to see the effect of changing the starting value.

\n\t", "rulesets": {"std": ["all", "!collectNumbers", "!noLeadingMinus"]}, "variables": {"tol": {"name": "tol", "group": "Ungrouped variables", "definition": "0", "description": "", "templateType": "anything"}, "ans": {"name": "ans", "group": "Ungrouped variables", "definition": "precround(tans,4)", "description": "", "templateType": "anything"}, "ans1": {"name": "ans1", "group": "Ungrouped variables", "definition": "precround(results[6],4)", "description": "", "templateType": "anything"}, "maxy": {"name": "maxy", "group": "Ungrouped variables", "definition": "ceil(e^(2*m)+2*b-a)+5", "description": "", "templateType": "anything"}, "m": {"name": "m", "group": "Ungrouped variables", "definition": "random(1.5..2#0.1)", "description": "", "templateType": "anything"}, "tans": {"name": "tans", "group": "Ungrouped variables", "definition": "((2*m-1)*exp(2*m)+a)/(m*exp(2*m)+b)", "description": "", "templateType": "anything"}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "random(8..15)", "description": "", "templateType": "anything"}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "random((a+1)..9)", "description": "", "templateType": "anything"}, "results": {"name": "results", "group": "Ungrouped variables", "definition": "nr(m,b,a,2,10,[])", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["a", "m", "ans1", "ans", "b", "tol", "tans", "maxy", "results"], "variable_groups": [], "functions": {"test": {"parameters": [["m", "number"], ["b", "number"], ["a", "number"], ["maxy", "number"]], "type": "html", "language": "javascript", "definition": "\n\t\t\tvar div = Numbas.extensions.jsxgraph.makeBoard('600px','400px', {boundingbox:[0,maxy,3,-30], axis:false});\n\t\t\t var brd=div.board;\n\t\t\t // Initial function term\n\t\t\t var term = function(x) { return Math.exp(m*x)+b*x-a; };\n\t\t\t var graph = function(x) { return term(x); };\n\t\t\t // Recursion depth\n\t\t\t var steps = 4;\n\t\t\t // Start value\n\t\t\t var s = 2;\n\t\t\t \n\t\t\t //for (i = 0; i < steps; i++) {\n\t\t\t //document.write('x' + i + ' = ');\n\t\t\t //}\n\t\t\t \n\t\t\t var i;\n\t\t\t var ax = brd.create('axis', [[0,0], [1,0]], {strokeColor: 'black'});\n\t\t\t var ay = brd.create('axis', [[0,0], [0,1]], {strokeColor: 'black'});\n\t\t\t \n\t\t\t var g = brd.create('functiongraph', [function(x){return graph(x);}],{strokeWidth: 2, dash:0});\n\t\t\t var x = brd.create('glider',[s,0,ax], {name: 'x_{0}', strokeColor: 'magenta', fillColor: 'yellow'});\n\t\t\t \n\t\t\t newton(x, steps, brd);\t\n\t\t\t \n\t\t\t //function xval() {\n\t\t\t //for (i = 0; i < steps; i++)\n\t\t\t //document.getElementById('xv' + i).innerHTML = (brd.select('x_{' + i + '}').X()).toFixed(14);\n\t\t\t //}\n\t\t\t \n\t\t\t //brd.addHook(xval);\n\t\t\t \n\t\t\t function newton(p, i, board) {\t\n\t\t\t board.suspendUpdate();\t\n\t\t\t if(i>0) {\n\t\t\t var f = board.create('glider',[function(){return p.X();}, function(){return graph(p.X())},g], {name: '', style: 3, strokeColor: 'green', fillColor: 'yellow'});\n\t\t\t var l = board.create('line', [p,f],{strokeWidth: 0.5, dash: 1, straightFirst: false, straightLast: false, strokeColor: 'black'});\n\t\t\t var t = board.create('tangent',[f],{strokeWidth: 0.5, strokeColor: '#0080c0', dash: 0});\n\t\t\t var x = board.create('intersection',[ax,t,0],{name: 'x_{'+(steps-i+1) + '}', style: 4, strokeColor: 'magenta', fillColor: 'yellow'});\n\t\t\t newton(x,--i, board);\n\t\t\t }\n\t\t\t board.unsuspendUpdate(); \n\t\t\t \n\t\t\t \n\t\t\t }\t\n\t\t\t return div;\n\t\t\t"}, "nr": {"parameters": [["m", "number"], ["b", "number"], ["a", "number"], ["c", "number"], ["n", "number"], ["l", "list"]], "type": "list", "language": "jme", "definition": "if(n=5,l+[fun(m,b,a,c)]+[fun(m,b,a,fun(m,b,a,c))],nr(m,b,a,fun(m,b,a,c),n-1,l+[c]))"}, "fun": {"parameters": [["m", "number"], ["b", "number"], ["a", "number"], ["c", "number"]], "type": "number", "language": "jme", "definition": "((m*c-1)*e^(m*c)+a)/(m*e^(m*c)+b)"}, "funfornr": {"parameters": [], "type": "html", "language": "javascript", "definition": "\n\t\t\tvar div = Numbas.extensions.jsxgraph.makeBoard('600px','200px',{boundingBox:[0,10,1,-8],grid:false});\n\t\t\t var board = div.board;\n\t\t\t var m = Numbas.jme.unwrapValue(scope.variables.m);\n\t\t\t var be = Numbas.jme.unwrapValue(scope.variables.b);\n\t\t\t var al = Numbas.jme.unwrapValue(scope.variables.a);\n\t\t\t var ans = Numbas.jme.unwrapValue(scope.variables.ans1)\n\t\t\t var a = board.create('point',[ans,0],'$A$');\n\t\t\t \n\t\t\t var graph = board.create('functiongraph',function(x){return Math.exp(m*x)+be*x-al});\n\t\t\t \n\t\t\t return div;\n\t\t\t \n\t\t\t"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "\n\t\t\t

This equation has a root in the range $0 \\lt x \\lt 1$.

\n\t\t\t

Using the Newton-Raphson formula, if $x_n$ is the $n$th estimate for this root, show that the next estimate can be written in the form \\[x_{n+1}= \\frac{p(x_n)}{g'(x_n)}\\]
Enter $p(x_n)$ and $g'(x_n)$ in the boxes below.

\n\t\t\t

Please note that if you enter a function of the form $xe^{ax}$, then you must input it as $x*e^{ax}$.

\n\t\t\t

$p(x_n)=\\;\\;$[[0]] In your answer use $x$ instead of $x_n$.

\n\t\t\t

$g'(x_n)=\\;\\;$[[1]] In your answer use $x$ instead of $x_n$.

\n\t\t\t

If you have forgotten the Newton-Raphson formula you can click on Steps to see it. You will not lose any marks in doing so.

\n\t\t\t \n\t\t\t", "stepsPenalty": 0, "steps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

Recall that the Newton-Raphson method is defined by:
\\[x_{n+1}=x_n-\\frac{g(x_n)}{g'(x_n)}\\]
where we would like to find the root of the equation $g(x)=0$

", "answer": "", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "valuegenerators": []}], "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "(((({m} * x) -1) * Exp(({m} * x))) + {a})", "answerSimplification": "std", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.0001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [1, 1.5], "checkVariableNames": false, "valuegenerators": [{"name": "x", "value": ""}]}, {"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "(({m} * Exp(({m} * x))) + {b})", "answerSimplification": "std", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "valuegenerators": [{"name": "x", "value": ""}]}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "\n\t\t\t

If $x_0=2\\;\\;\\;$what is $x_1$ correct to $4$ decimal places?

\n\t\t\t

$x_1=\\;\\;$ [[0]]

\n\t\t\t

Enter your answer to 4 decimal places.

\n\t\t\t", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "minValue": "ans-tol", "maxValue": "ans+tol", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}]}], "name": ""}], "questions": [], "name": "Jane's copy of JSXGraph demo", "showQuestionGroupNames": false, "navigation": {"preventleave": false, "showfrontpage": false, "allowregen": true, "onleave": {"action": "none", "message": ""}, "browse": true, "reverse": true, "showresultspage": "never"}, "allQuestions": true, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Some questions which use JSXGraph to create interactive graphics.

", "notes": ""}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Jane Stradins", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3215/"}], "extensions": ["jsxgraph", "stats"], "custom_part_types": [], "resources": []}