external f
parameter(nmax=2)
dimension x(nmax,nmax+1),ff(nmax+1),x0(nmax),xr(nmax),xe(nmax),xc(nmax)

n=2
x(1,1)=1; x(2,1)=1
x(1,2)=2; x(2,2)=2
x(1,3)=3; x(2,3)=3
epsf=0.01; epsx=0.01
call simplex(x,n,nmax,f,epsf,epsx,ff,x0,xr,xe,xc)
end

function f(p,n) ; dimension p(n)
x=10*p(1) ; y=p(2) ; f=x*x+y*y-2*x+5*y
return; end
