Finding Multiplicity of a function using Newtons method
Show older comments
Hi there, I am asked to find the roots of a function using modified newtons method but that requires the prior knowledge of the multiplicity of a function. I find this by using the rule in the png.
and the code i wrote for it:
function m=multiplicity(f,a)
syms x
m=0;
while round(f(a)) == 0
m=m+1;
f = matlabFunction(diff(sym(f)));
try
f(a);
catch
break
end
end
end
however I am told that I need to find it from "the sequence of values in the iterations" i assume this means buy using the vector of x values found in the newtons method
i used this for loop
for k=1:length(X)-1
m(k) = error(k+1)*df(X(i)/f(X(i));
end
where the error is the values of X minus the actual root and X is the values found with newtons method. This method seems to work for functions of multiplicity 1 but didn't work for (x-5)^2
can somebody please help?
Answers (0)
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!