function [ Sol, Res, It ] = newton( x0, fun_ex26, derf_ex26, kmax, Tol ) %%%% Executar com o comando [ Solucao, Erro_Absoluto, Iteracoes ] = newton( 1, @fun_ex26, @derf_ex26, 1000, 1e-10 ) x(1) = x0; % Chute Inicial a = 3; % Constante da funcao (pode ser 1, 2 ou 3) %========================== Construcao do metodo =========================% er = 1; % erro inicial k = 1; % numero de iteracoes while er > Tol && k < kmax k = k+1; x(k) = x(k-1) - ( fun_ex26(x(k-1),a) / derf_ex26(x(k-1)) ); er = abs( x(k) - x(k-1) ); end Sol = x(end); Res = fun_ex26(Sol,a); It = k; end