tried to solve for the max of the following function $$ f(s,x,t,y)= \sqrt{\frac{s}{1+s}} + \sqrt{\frac{t}{1+t}} - sx-ty -\frac{50st}{1+x+y}$$ where $ (s,x,t,y) \in \mathbb{R}_{+}^{4}$. The function is continuous on the domain and for practical purposes, each of the arguments of the function is bounded above by $ 10^{6} $. Then Weirestrass' theorem guarantees a max but when i used mathematica to check for the second order condition using a hessian, the matrix turns out to be neither positive(semi) nor negative(semi) definite and it seems quite puzzling to me since none of the boundary points are the extrema. The following are some of the commands i used in mathematica :
hessian[s_, x_, t_, y_] = Function[{f}, D[f, {{s, x, t, y}, 2}]];
f[s_, x_, t_, y_] := "the expression as mentioned above"
D[f[s, x, t, y], {{s, x, t, y}}] // FullSimplify
Solve[{"equating the gradients to zero"},{a,x,b,y},Reals] // FullSimplify
N[%]
hessian[s, x, t, y][f[s, x, t, y]] // FullSimplify ("calculates the hessian at the obtained values")
% /. {{s → 0.05454014415881808, x → 0.3256826278814554,
t → 0.05454014415881808, y → 0.3256826278814554}} ("these were the values i obtained")
NegativeDefiniteMatrixQ["Plugging in the hessian here"]
this yielded a false result even for negative semi-definiteness, positive definiteness and the associated semi-definiteness. Surely, there must be a max and since it exists, it must satisfy the second order condition since it is an interior point. Could someone please point out the error?
This is a bit interesting. At (s,x,t,y)==0, the function value is zero. For large values of these variables, the function value is negative. At the stationary point you found, the value is positive at about 1/3, which might suggest the existence of a maximum. However, setting (x,t,y}=0 and increasing s, we can get as close to 1 as we wish, so it is clearly not a global maximum. The following plot suggests that you indeed found a saddle.