// Numbas version: finer_feedback_settings {"name": "Laure'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": {"a": {"definition": "random(5..10#1)", "group": "Ungrouped variables", "name": "a", "description": "", "templateType": "randrange"}, "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"}, "x0": {"definition": "(a+b)/2-1", "group": "Ungrouped variables", "name": "x0", "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"}, "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"}}, "variable_groups": [], "tags": [], "functions": {}, "parts": [{"type": "gapfill", "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "prompt": "

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

\n

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

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

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

\n

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

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

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

\n

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

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

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

\n

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

", "gaps": [{"type": "numberentry", "correctAnswerStyle": "plain", "showCorrectAnswer": true, "marks": 1, "variableReplacements": [], "strictPrecision": false, "precisionPartialCredit": 0, "minValue": "{x4}", "precisionType": "dp", "precision": "3", "maxValue": "{x4}", "showPrecisionHint": false, "scripts": {}, "mustBeReduced": false, "precisionMessage": "You have not given your answer to the correct precision.", "showFeedbackIcon": true, "allowFractions": false, "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false}], "marks": 0, "showCorrectAnswer": true}], "name": "Laure'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": "Laure Helme-Guizon", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2531/"}]}]}], "contributors": [{"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}, {"name": "Laure Helme-Guizon", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2531/"}]}