Cod sursa(job #2258567)

Utilizator Consti.001FMI Dranca Constantin Consti.001 Data 11 octombrie 2018 17:41:32
Problema A+B Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.35 kb
function [ xaprox ] = MetNR( f,df,val,eps )
%UNTITLED8 Summary of this function goes here
%   Detailed explanation goes here
    syms x
    k=2;
    a(1)=val;
    a(2)=a(1)-subs(f,x,a(1))/subs(df,x,a(1));
    while abs(a(k)-a(k-1))/abs(a(k-1))>eps
        k=k+1;
        a(k)=a(k-1)-subs(f,x,a(k-1))/subs(df,x,a(k-1));
    end
    xaprox=a(k)
end