// Numbas version: exam_results_page_options {"name": "Nazim's copy of Newton-Raphson method #2", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"extensions": [], "preamble": {"js": "", "css": ""}, "variablesTest": {"condition": "", "maxRuns": 100}, "variables": {"x0": {"definition": "(a+b)/2-1", "group": "Ungrouped variables", "name": "x0", "description": "", "templateType": "anything"}, "b": {"definition": "random(10..20#1)", "group": "Ungrouped variables", "name": "b", "description": "", "templateType": "randrange"}, "x2": {"definition": "x1-(x1^3-(a+b+c)*x1^2+(a*b+a*c+b*c)*x1-a*b*c)/(3*x1^2-2*(a+b+c)*x1+a*b+a*c+b*c)", "group": "Ungrouped variables", "name": "x2", "description": "", "templateType": "anything"}, "x3": {"definition": "x2-(x2^3-(a+b+c)*x2^2+(a*b+a*c+b*c)*x2-a*b*c)/(3*x2^2-2*(a+b+c)*x2+a*b+a*c+b*c)", "group": "Ungrouped variables", "name": "x3", "description": "", "templateType": "anything"}, "a": {"definition": "random(5..10#1)", "group": "Ungrouped variables", "name": "a", "description": "", "templateType": "randrange"}, "x1": {"definition": "x0-(x0^3-(a+b+c)*x0^2+(a*b+a*c+b*c)*x0-a*b*c)/(3*x0^2-2*(a+b+c)*x0+a*b+a*c+b*c)", "group": "Ungrouped variables", "name": "x1", "description": "", "templateType": "anything"}, "c": {"definition": "random(-3..-1#1)", "group": "Ungrouped variables", "name": "c", "description": "", "templateType": "randrange"}, "x4": {"definition": "x3-(x3^3-(a+b+c)*x3^2+(a*b+a*c+b*c)*x3-a*b*c)/(3*x3^2-2*(a+b+c)*x3+a*b+a*c+b*c)", "group": "Ungrouped variables", "name": "x4", "description": "", "templateType": "anything"}}, "variable_groups": [], "tags": [], "functions": {}, "parts": [{"unitTests": [], "customMarkingAlgorithm": "", "marks": 0, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "prompt": "

The first iteration, correct to three decimal places, gives:

\n

\\(x_1=\\) [[0]]

", "showCorrectAnswer": true, "type": "gapfill", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "scripts": {}, "gaps": [{"correctAnswerFraction": false, "unitTests": [], "correctAnswerStyle": "plain", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "precisionPartialCredit": 0, "precision": "3", "maxValue": "{x1}", "type": "numberentry", "mustBeReduced": false, "variableReplacementStrategy": "originalfirst", "allowFractions": false, "customMarkingAlgorithm": "", "marks": 1, "variableReplacements": [], "strictPrecision": false, "minValue": "{x1}", "precisionType": "dp", "showPrecisionHint": false, "showFeedbackIcon": true, "precisionMessage": "You have not given your answer to the correct precision.", "scripts": {}, "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"]}, {"type": "numberentry", "unitTests": [], "correctAnswerStyle": "plain", "showCorrectAnswer": true, "marks": 1, "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "minValue": "", "allowFractions": false, "maxValue": "", "customMarkingAlgorithm": "", "showFeedbackIcon": true, "mustBeReduced": false, "correctAnswerFraction": false, "scripts": {}, "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"]}], "sortAnswers": false}, {"unitTests": [], "customMarkingAlgorithm": "", "marks": 0, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "prompt": "

The second iteration, correct to three decimal places, gives:

\n

\\(x_2=\\) [[0]]

", "showCorrectAnswer": true, "type": "gapfill", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "scripts": {}, "gaps": [{"correctAnswerFraction": false, "unitTests": [], "correctAnswerStyle": "plain", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "precisionPartialCredit": 0, "precision": "3", "maxValue": "{x2}", "type": "numberentry", "mustBeReduced": false, "variableReplacementStrategy": "originalfirst", "allowFractions": false, "customMarkingAlgorithm": "", "marks": 1, "variableReplacements": [], "strictPrecision": false, "minValue": "{x2}", "precisionType": "dp", "showPrecisionHint": false, "showFeedbackIcon": true, "precisionMessage": "You have not given your answer to the correct precision.", "scripts": {}, "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"]}], "sortAnswers": false}, {"unitTests": [], "customMarkingAlgorithm": "", "marks": 0, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "prompt": "

The third iteration, correct to three decimal places, gives:

\n

\\(x_3=\\) [[0]]

", "showCorrectAnswer": true, "type": "gapfill", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "scripts": {}, "gaps": [{"correctAnswerFraction": false, "unitTests": [], "correctAnswerStyle": "plain", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "precisionPartialCredit": 0, "precision": "3", "maxValue": "{x3}", "type": "numberentry", "mustBeReduced": false, "variableReplacementStrategy": "originalfirst", "allowFractions": false, "customMarkingAlgorithm": "", "marks": 1, "variableReplacements": [], "strictPrecision": false, "minValue": "{x3}", "precisionType": "dp", "showPrecisionHint": false, "showFeedbackIcon": true, "precisionMessage": "You have not given your answer to the correct precision.", "scripts": {}, "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"]}], "sortAnswers": false}, {"unitTests": [], "customMarkingAlgorithm": "", "marks": 0, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "prompt": "

The fourth iteration, correct to three decimal places, gives:

\n

\\(x_4=\\) [[0]]

", "showCorrectAnswer": true, "type": "gapfill", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "scripts": {}, "gaps": [{"correctAnswerFraction": false, "unitTests": [], "correctAnswerStyle": "plain", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "precisionPartialCredit": 0, "precision": "3", "maxValue": "{x4}", "type": "numberentry", "mustBeReduced": false, "variableReplacementStrategy": "originalfirst", "allowFractions": false, "customMarkingAlgorithm": "", "marks": 1, "variableReplacements": [], "strictPrecision": false, "minValue": "{x4}", "precisionType": "dp", "showPrecisionHint": false, "showFeedbackIcon": true, "precisionMessage": "You have not given your answer to the correct precision.", "scripts": {}, "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"]}], "sortAnswers": false}], "name": "Nazim's copy of Newton-Raphson method #2", "ungrouped_variables": ["a", "b", "x0", "x1", "x2", "x3", "x4", "c"], "statement": "

Perform four iterations of the Newton-Raphson method on the function:

\n

\\(f(x)= x^3-\\simplify{{a}+{b}+{c}}x^2+\\simplify{{a}*{b}+{a}*{c}+{b}*{c}}x+\\simplify{-{a}*{b}*{c}}\\)

\n

taking  \\(x_0=\\var{x0}\\)  as your approximation.

", "advice": "

\\(f(x)= x^3-\\simplify{{a}+{b}+{c}}x^2+\\simplify{{a}*{b}+{a}*{c}+{b}*{c}}x+\\simplify{-{a}*{b}*{c}}\\)

\n

The Newton-Raphson formula states:         \\(x_{n+1}=x_n-\\frac{f(x_n)}{f'(x_n)}\\)

\n

For this example tht gives:                        \\(x_{n+1}=x_n-\\frac{x_n^3-\\simplify{{a}+{b}+{c}}x_n^2+\\simplify{{a}*{b}+{a}*{c}+{b}*{c}}x_n+\\simplify{-{a}*{b}*{c}}}{3x_n^2-\\simplify{2*({a}+{b}+{c})}x_n+\\simplify{{a}*{b}+{a}*{c}+{b}*{c}}}\\)

\n

Take \\(x_0=\\var{x0}\\)

\n

\\(x_1=\\var{x0}-\\frac{(\\var{x0})^3-\\simplify{{a}+{b}+{c}}(\\var{x0})^2+\\simplify{{a}*{b}+{a}*{c}+{b}*{c}}(\\var{x0})+\\simplify{-{a}*{b}*{c}}}{3(\\var{x0})^2-\\simplify{2*({a}+{b}+{c})}(\\var{x0})+\\simplify{{a}*{b}+{a}*{c}+{b}*{c}}}\\)

\n

\\(x_1=\\var{x0}-\\frac{\\simplify{{x0}^3-({a}+{b}+{c})*{x0}^2+({a}*{b}+{a}*{c}+{b}*{c})*{x0}-{a}*{b}*{c}}}{\\simplify{(3)*{x0}^2-(2*({a}+{b}+{c}))*{x0}+({a}*{b}+{a}*{c}+{b}*{c})}}\\)

\n

\\(x_1=\\var{x1}\\)

\n

The second iteration:

\n

\\(x_2=\\var{x1}-\\frac{(\\var{x1})^3-\\simplify{{a}+{b}+{c}}(\\var{x1})^2+\\simplify{{a}*{b}+{a}*{c}+{b}*{c}}(\\var{x1})+\\simplify{-{a}*{b}*{c}}}{3(\\var{x1})^2-\\simplify{2*({a}+{b}+{c})}(\\var{x1})+\\simplify{{a}*{b}+{a}*{c}+{b}*{c}}}\\)

\n

\\(x_2=\\var{x1}-\\frac{\\simplify{{x1}^3-({a}+{b}+{c})*{x1}^2+({a}*{b}+{a}*{c}+{b}*{c})*{x1}-{a}*{b}*{c}}}{\\simplify{(3)*{x1}^2-(2*({a}+{b}+{c}))*{x1}+({a}*{b}+{a}*{c}+{b}*{c})}}\\)

\n

\\(x_2=\\var{x2}\\)

\n

The third iteration:

\n

\\(x_3=\\var{x2}-\\frac{(\\var{x2})^3-\\simplify{{a}+{b}+{c}}(\\var{x2})^2+\\simplify{{a}*{b}+{a}*{c}+{b}*{c}}(\\var{x2})+\\simplify{-{a}*{b}*{c}}}{3(\\var{x2})^2-\\simplify{2*({a}+{b}+{c})}(\\var{x2})+\\simplify{{a}*{b}+{a}*{c}+{b}*{c}}}\\)

\n

\\(x_3=\\var{x2}-\\frac{\\simplify{{x2}^3-({a}+{b}+{c})*{x2}^2+({a}*{b}+{a}*{c}+{b}*{c})*{x2}-{a}*{b}*{c}}}{\\simplify{(3)*{x2}^2-(2*({a}+{b}+{c}))*{x2}+({a}*{b}+{a}*{c}+{b}*{c})}}\\)

\n

\\(x_3=\\var{x3}\\)

\n

The fourth iteration:

\n

\\(x_4=\\var{x3}-\\frac{(\\var{x3})^3-\\simplify{{a}+{b}+{c}}(\\var{x3})^2+\\simplify{{a}*{b}+{a}*{c}+{b}*{c}}(\\var{x3})+\\simplify{-{a}*{b}*{c}}}{3(\\var{x3})^2-\\simplify{2*({a}+{b}+{c})}(\\var{x3})+\\simplify{{a}*{b}+{a}*{c}+{b}*{c}}}\\)

\n

\\(x_4=\\var{x3}-\\frac{\\simplify{{x3}^3-({a}+{b}+{c})*{x3}^2+({a}*{b}+{a}*{c}+{b}*{c})*{x3}-{a}*{b}*{c}}}{\\simplify{(3)*{x3}^2-(2*({a}+{b}+{c}))*{x3}+({a}*{b}+{a}*{c}+{b}*{c})}}\\)

\n

\\(x_4=\\var{x4}\\)

", "metadata": {"licence": "Creative Commons Attribution-NonCommercial 4.0 International", "description": ""}, "rulesets": {}, "type": "question", "contributors": [{"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}, {"name": "Nazim Khan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2973/"}]}]}], "contributors": [{"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}, {"name": "Nazim Khan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2973/"}]}