Repeat Problem 2 with Newtons method Write a program Newtonm

Repeat Problem #2 with Newton\'s method. Write a program Newton.m that has the following syntax for calling: Determine an approximation to the root that is accurate with the relative error less than 10^-4. Produce a table that looks like the following:

Solution

function sol = newton(f,df,tol,eps,max_iter,init) x0 = init; solved = 0; for iter=1:max_iter x0 assert(x0>0); denom = df(x0); assert(denom<0); if abs(denom) < eps error(\'derivative too small.\'); end assert(f(x0)>0); sol = x0 - f(x0)/denom; if abs(sol - x0) < tol solved = 1; break; end x0 = sol; end if ~solved error(\'max_iter exhausted\'); end end
 Repeat Problem #2 with Newton\'s method. Write a program Newton.m that has the following syntax for calling: Determine an approximation to the root that is acc

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site