// Numbas version: finer_feedback_settings {"shufflequestions": false, "showQuestionGroupNames": false, "navigation": {"preventleave": false, "browse": true, "reverse": true, "onleave": {"message": "", "action": "none"}, "showfrontpage": false, "allowregen": true, "showresultspage": "never"}, "duration": 0.0, "timing": {"timeout": {"message": "", "action": "none"}, "timedwarning": {"message": "", "action": "none"}, "allowpause": true}, "feedback": {"showtotalmark": true, "showanswerstate": true, "allowrevealanswer": true, "advicethreshold": 0.0, "showactualmark": true, "enterreviewmodeimmediately": false, "showexpectedanswerswhen": "never", "showpartfeedbackmessageswhen": "always", "showactualmarkwhen": "always", "showtotalmarkwhen": "always", "showanswerstatewhen": "always", "showadvicewhen": "never"}, "question_groups": [{"name": "", "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.
\nPlace 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()}
\nIs 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.
\nDefine 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 \nYou are given the following information:
\nFirst Test$(X)$ | \n$\\sum x=\\;\\var{t[0]}$ | \n$\\sum x^2=\\;\\var{ssq[0]}$ | \n
---|---|---|
Later Score$(Y)$ | \n$\\sum y=\\;\\var{t[1]}$ | \n$\\sum y^2=\\;\\var{ssq[1]}$ | \n
Also you are given $\\sum xy = \\var{sxy}$.
\nClick 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}}$
\nThen $\\displaystyle a = \\frac{1}{\\var{n}}\\left[\\sum y-b \\sum x\\right]$
\nNow 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?
Use the values of $a$ and $b$ you input above.
\nEnter 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": "\nUse the result above to calculate the residual value for employee $\\var{obj[ch]}$.
\nClick 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.
\nResidual value = (to 2 decimal places).[[0]]
\n \n \n ", "type": "gapfill", "showCorrectAnswer": true, "scripts": {}, "marks": 0, "steps": [{"prompt": "\nThe residual value is given by:
\nRESIDUAL = OBSERVED - FITTED.
\nIn 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:
\nChecked rounding, OK. Added tag cr1.
\nPossible use of scenarios, so added tag sc.
\nThe array r2 generates the regression data which has an inbuilt noise via r1[x]+random(-9..9).
\n26/01/2013:
\nNo advice as yet.
\n13/11/2013:
\nUses Jsxgraph to create the regression line and some interaction with users.
", "description": "Find a regression equation.
\nNow 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": "\nTo 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:
\nEmployee | $\\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)$ | \n$\\var{r1[0]}$ | \n$\\var{r1[1]}$ | \n$\\var{r1[2]}$ | \n$\\var{r1[3]}$ | \n$\\var{r1[4]}$ | \n$\\var{r1[5]}$ | \n$\\var{r1[6]}$ | \n$\\var{r1[7]}$ | \n
Later Score $(Y)$ | \n$\\var{r2[0]}$ | \n$\\var{r2[1]}$ | \n$\\var{r2[2]}$ | \n$\\var{r2[3]}$ | \n$\\var{r2[4]}$ | \n$\\var{r2[5]}$ | \n$\\var{r2[6]}$ | \n$\\var{r2[7]}$ | \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\tWrite 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\tIncluded in the Advice of this question are:
\n\t\t6 iterations of the method.
\n\t\tGraph 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\tConsider the following equation.
\n\t\\[\\simplify[std]{e^({m}x)+{b}x-{a}=0}\\]
\n\tFind the approximate solution in the range $0 \\le x \\le 1$ by using the Newton-Raphson method.
\n\tThe 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\ta)
\n\tRecall 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$
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}))}\\]
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})}\\]
(In your answers you would input $x$ rather than $x_n$.)
\n\tIn the following let $\\displaystyle f(x)=\\simplify[std]{ (({m} * x -1) * Exp({m} * x ) + {a}) / ({m} * Exp({m} * x ) + {b})}$
\n\tb)
\n\tIf $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})}\\]
which to 4 decimal places is: $\\;\\;x_1= \\var{ans}$
\n\tWe 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\tSo the solution to the equation to four decimal places for $0 \\le x \\le 1$ is $x=\\var{precround(ans1,4)}$
\n\tHere 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\tNote 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('This equation has a root in the range $0 \\lt x \\lt 1$.
\n\t\t\tUsing 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.
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\tIf 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$
If $x_0=2\\;\\;\\;$what is $x_1$ correct to $4$ decimal places?
\n\t\t\t$x_1=\\;\\;$ [[0]]
\n\t\t\tEnter 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}], "type": "question"}], "pickQuestions": 0}], "percentpass": 0.0, "metadata": {"notes": "", "licence": "Creative Commons Attribution 4.0 International", "description": "Some questions which use JSXGraph to create interactive graphics.
"}, "allQuestions": true, "name": "Ethan's copy of Nigel's copy of JSXGraph demo", "pickQuestions": 0, "questions": [], "type": "exam", "contributors": [{"name": "Ethan Smith", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/739/"}], "extensions": ["jsxgraph", "stats"], "custom_part_types": [], "resources": []}