%EXS 3.13 
%startgissning
x = zeros(5,1);
x(1)=0.2;
x(2)=1.2;
x(3)=0.3; 
x(4)=2;
x(5)=0.0001;
 xtot=sum(x);
iter=0;
xnorm = 1;
format long
while xnorm>0.5*1e-7 & iter<10
  
    f=[x(1)+x(3)+x(5)-0.5
       x(2)+x(3)-x(5)-1.5
       x(3)-3*x(5)-x(4)
       2*x(4)*x(3)-x(1)*x(2)
       x(5)*x(2)*xtot^2-0.09*x(1)*x(4)^3];
   d=2*x(2)*x(5)*xtot;
    df = [1 0 1 0 1
        0 1 1 0 -1
        0 0 1 -1 -3
        -x(2) -x(1) 2*x(4) 2*x(3) 0
        -0.09*x(4)^3+d x(5)*xtot^2+d d 0.27*x(4)^2*x(1)+d x(2)*xtot^2+d];
       
    dx=-df\f; 
    x=x+dx;
    xnorm=norm(dx,inf);%största felet
    xtot=sum(x);
    iter=iter+1;
    x
end
