## Steepest-descent Multidimensional optimisation
## Author: M. Turhan ÇOBAN
## Created: 2021-06-14
function retval = steepest_descent_MD_opt(f,x)
    ti=1.0;
    nmax=50;
    tolerance=1.0e-2;
    n=length(x);
    i=0;
    total=1.0;
    i=0;
    while i<nmax && total>tolerance
        x1=dfn(f,x);
        fx1=@(alpha)f1dim(f,alpha,x,x1);
        alpha=1.0;
        alpha=newton_opt(fx1,alpha)
        dx=alpha*x1;
        x = x+dx
        total=0;
        for j=1:n
            total=total+abs(dx(j));
        endfor
        i=i+1;
     endwhile
  retval=x;
endfunction
