$Ontext Minimal surface problem. Find a function f that minimizes the array of its graph subject to some constraints on the boundary of the domain of f. Boyd, S., Vandenberghe, L., Convex Optimization, Cambridge University Press, Cambridge, 2004. $Offtext SET X /I1*I21/; SET Y /J1*J21/; SET inside(X,Y); * Exclude i1 and i21 from inside inside(X,Y)$(not((ord(X)=1) and (ord(X)=card(X)))) = yes; display inside; SCALAR K /10/; VARIABLES obj, f(x,y); POSITIVE VARIABLE f(X,Y); * Bounds on variables, initial conditions, fixing conditions: f.up(x,y)=1; f.l(x,y) =1.0; f.fx(X,Y)$((ord(X)=1) or (ord(X)=card(X))) = 1; EQUATION objfun; objfun.. obj =E= (1/sqr(K)) * sum((X,Y) $(inside(X,Y)), sqrt( sqr((F(X+1,Y)-F(X,Y))/K) + sqr((F(X,Y+1)-F(X,Y))/K) + 1) ) ; MODEL surface /all/; SOLVE surface using nlp minimizing obj; $iftheni x%mode%==xbook file res1 /surf1.dat/ put res1; put "Array surface =" obj.l; put /; loop(Y, put Y.tl:6; loop(X, put F.l(X,Y):6:2 ); put /;) put /; $endif * End surface