Newton raphson method deal with abs

broken image
broken image

% left hand one-sixth of the above $x$-axis between these two points. % only portion of the real line where the function is positive is on the R = find((=)=0) %look up for nearby machine number zeros

broken image

Rr = find(sign(y)=0) %look up for machine number zeros Z = round(1e9*zz)*1e-9 % Get rid of spurious differences Of course, the code above will miss roots that were too close together compared to the discretization interval of 0.1 that I chose.

broken image

Xroots(i) = fzero(fun,xs(scinter(i) + )) I carefully chose code such that the first interval would be found, so fzero will find the zero at 0. See that there were 85 intervals found where a sign change occurred. Then call fzero on each interval where a sign change was found. I am always pleased with the capabilities of chebfun (as found on the file exchange.) It seems to have had no problem in finding all 85 roots of that function over the interval of interest.Īs an alternative, one could simply sample the function at a fine interval, looking for any sign changes.

broken image