function x1 = gSch(funct,a,b,epsilon)
% goldener Schnitt

tau=(sqrt(5)-1)/2;
Int=b-a;
x1=b-tau*Int;
x2=a+tau*Int;

fx1=funct(x1);
fx2=funct(x2);

while Int>epsilon
    if fx1>=fx2
        a=x1;
        x1=x2;
        Int=b-a;
        x2=a+tau*Int;
        fx1=fx2;
        fx2=funct(x2);
    else
        b=x2;
        x2=x1;
        Int=b-a;
        x1=b-tau*Int;
        fx2=fx1;
        fx1=funct(x1);
    end
end

