function dsi = demo_simpiter()

    xo = 0.0;
    yo = 0.0;

    % start iterating
    for n=1:20
        fprintf('Step %3d: (x,y)= (%8.4e , %8.4e); (f1,f2)= (%+8.4e , %+8.4e)\n', n, xo ,yo, f(xo,yo,1), f(xo,yo,2) );
    
        xn = phi(xo,yo, 1);
        yn = phi(xo,yo, 2);
    
        xo = xn;
        yo = yn;

        %pause;
    end;

    return;
 
    

%%%%%%%%%%%%

function fval = f(x,y, fid)
        
    if (fid==1)
        fval = x^2 + 4*x - y^2 - 2*y - 1;
   
    elseif (fid==2)
        fval = x^2 + 5*y - 4;
        
    end;
    return;

%%%%%%%%%%%%

function fun = phi(x,y, fid)

    if (fid==1)
        fun = (y^2 + 2*y + 1 - x^2) / 4.0;
   
    elseif (fid==2)
        fun = (4-x^2) / 5;
        
    end;
    return;
    
%%%%%%%%%%%%
