// Numbas version: exam_results_page_options {"name": "Newton-Raphson method #2", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"rulesets": {}, "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}\\)

", "ungrouped_variables": ["a", "b", "x0", "x1", "x2", "x3", "x4", "c"], "extensions": [], "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.

", "name": "Newton-Raphson method #2", "variablesTest": {"maxRuns": 100, "condition": ""}, "preamble": {"css": "", "js": ""}, "variable_groups": [], "variables": {"x4": {"templateType": "anything", "name": "x4", "group": "Ungrouped variables", "description": "", "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)"}, "x3": {"templateType": "anything", "name": "x3", "group": "Ungrouped variables", "description": "", "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)"}, "b": {"templateType": "randrange", "name": "b", "group": "Ungrouped variables", "description": "", "definition": "random(10..20#1)"}, "c": {"templateType": "randrange", "name": "c", "group": "Ungrouped variables", "description": "", "definition": "random(-3..-1#1)"}, "x2": {"templateType": "anything", "name": "x2", "group": "Ungrouped variables", "description": "", "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)"}, "x1": {"templateType": "anything", "name": "x1", "group": "Ungrouped variables", "description": "", "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)"}, "a": {"templateType": "randrange", "name": "a", "group": "Ungrouped variables", "description": "", "definition": "random(5..10#1)"}, "x0": {"templateType": "anything", "name": "x0", "group": "Ungrouped variables", "description": "", "definition": "(a+b)/2-1"}}, "metadata": {"description": "", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "parts": [{"scripts": {}, "variableReplacementStrategy": "originalfirst", "gaps": [{"scripts": {}, "notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "allowFractions": false, "type": "numberentry", "minValue": "{x1}", "correctAnswerStyle": "plain", "precision": "3", "mustBeReducedPC": 0, "strictPrecision": false, "showFeedbackIcon": true, "precisionMessage": "You have not given your answer to the correct precision.", "variableReplacementStrategy": "originalfirst", "precisionType": "dp", "maxValue": "{x1}", "correctAnswerFraction": false, "marks": 1, "precisionPartialCredit": 0, "variableReplacements": [], "showCorrectAnswer": true, "showPrecisionHint": false}], "type": "gapfill", "marks": 0, "variableReplacements": [], "showCorrectAnswer": true, "prompt": "

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

\n

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

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

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

\n

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

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

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

\n

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

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

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

\n

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

", "showFeedbackIcon": true}], "tags": [], "functions": {}, "type": "question", "contributors": [{"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}]}]}], "contributors": [{"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}]}