My function is: f(x) = (x + 5.371)^2*(x-100) My initial guess is x0 = 0 I have to use the Newton Raphson method and 1st modified Newton Raphson method to find the root at x = -5.371 for the function. I am also asked to report the number of iterations required to reach 6 sig. figs of accuracy.
I would like to know if my code is good for the Newton Raphson method and also for the modified Newton Raphson method, what is the (m = multipiclity of root) value that I must use? I have no code for it as I am confused as to what the value of m that I must use is. Is it the 2 (aka the power for the first parenthesis) in f(x) = (x + 5.371)^2*(x-100)?
This is the modified Newton-Raphson method that I must use
Here is the code for the Newton Raphson method:
clear all; close all; clc;
SF = 6;
z = 0;
i = 1;
f = @(x) ((x+5.371)^2)*(x-100);
df = @(x) (3*x^2)-(178.516*x)-1045.352359;
h = @(x) x - f(x)/df(x);
z(i+1) = h(z(i));
error = abs((z(i+1)-z(i))/z(i));
if error < 0.5*10^-SF;
i = i + 1;