Question: Finding the Maximizer Using Plot

I have a function that cannot be maximized by taking the FOCs, i.e. non-convex, and I want to maximize it with respect to two variables. Say, with respect to (x,y).

I have found an example where you can extract the maximizer from plot using this approach:

> P:=plot(subs(x=0.1,subs(tau=0.3,subs(theta=1,subs(omega=0.5,payoff)))),y=0..1):
> A:=remove(has,op([1,1],P),undefined):
> MAX:=max(op(map(t->t[2],A)));
MAX := 0.330385487730942451

> points:=op([1,1],P):
> MAXPT:=select(t->t[2]=MAX,points);
MAXPT := [[0.287405284999999956, 0.330385487730942451]]

The above example is for the case where you maximize a function with respect to a single variable, y. (The value of x is fixed above; tau, theta, and omega are parameters of payoff.)

I would like to use a similar approach with plot3d to find the maximizer of the payoff function with respect to (x,y).

I tried the following:

> P3:=plot3d(subs(m=0.5,subs(K=1,subs(pa=1,profit_1))),s=0..1,p=0..1);
P3 := INTERFACE_PLOT3D(GRID(0. .. 1., 0. .. 1., Array( 1..25,1..25,[ ... ], [ ... ], datatype = float[8], storage = rectangular, order = Fortran_order )), AXESLABELS(s, p, ""))
> A3:=remove(has,op([1,1,1],P3),undefined):
> MAX3:=max(op(map(t->t[2],A3)));
MAX3 := 2
> points3:=op([1,1],P3);
points3 := 0. .. 1.
> MAXPT3:=select(t->t[2]=MAX3,points3);
MAXPT3 := ..

but it returns an empty expression. I think that the problem lies with the way I am defining "points3" above. How do I extract the set of points from the plot3d function, using op, so that I can look for a maximizer in this set of points (which will actually be triples, right? (x,y,payoff_value)

Please Wait...