%K425
%startgissning
A=[5 1 2; 1 5.2 1.4; 1 2.2 5.4];
b=[2 3.25 2]';
x=A\b;
x
iter=0;
xnorm = 1;
format long
while xnorm>0.5*1e-7 & iter<10
  
    f=[5*x(1)+x(2)+2*x(3)-2-0.01*sin(x(2)^2)
       x(1)+5.2*x(2)+1.4*x(3)-3.25-0.02*(exp(x(1))-cos(x(3)))
       x(1)+2.2*x(2)+5.4*x(3)-2-0.01*(cos(x(1))-cos(x(2)))];
   
    df = [5 1-0.02*cos(x(2)^2)*x(2) 2
        1-0.02*exp(x(1)) 5.2 1.4-sin(x(3))
         1+sin(x(1))*0.01 2.2-0.01*sin(x(2)) 5.4];
       
    dx=-df\f; 
    x=x+dx;
    xnorm=norm(dx,inf);%största felet
    iter=iter+1;
    
end
 x
 f=[5*x(1)+x(2)+2*x(3)-2-0.01*sin(x(2)^2)
       x(1)+5.2*x(2)+1.4*x(3)-3.25-0.02*(exp(x(1))-cos(x(3)))
       x(1)+2.2*x(2)+5.4*x(3)-2-0.01*(cos(x(1))-cos(x(2)))]
       