Checking concavity of a highly non linear function

I have a highly non linear profit function which depends on four independent variables (decision variables) E,W,T and p. I want to check concavity of profit function with respect to these four decision variables. To prove concavity, I have to prove that profit function's Hessian ( 4 *4 matrix) is negative (semi) definite for each values of decision variables but it is very difficult to draw any conclusion from its Hessian Matrix due to its complexity with many terms. Please guide whether any tool/technique/tricks or software package available for it. The profit function is given below ( it is written in Maple 2016.)-

Profit_function = (p*(W+1.000000000*10^5*W^.7*(.16-(.4-T)^2-0.3333333334e-4*p^2*(W^.3-E^.3))/p^2-E)+10*E-20*W-2.000000000*10^6*W^.7*(.16-(.4-T)^2-0.3333333334e-4*p^2*(W^.3-E^.3))/p^2-10-1.333333333*10^5*W^.7*(.4-((.4-T)^2+0.3333333334e-4*p^2*(W^.3-E^.3))^.5)^3/p^2+160000*W^.7*(.4-((.4-T)^2+0.3333333334e-4*p^2*(W^.3-E^.3))^.5)^2/p^2-(4*(W+1.000000000*10^5*W^.7*(.16-(.4-T)^2-0.3333333334e-4*p^2*(W^.3-E^.3))/p^2))*(.4-((.4-T)^2+0.3333333334e-4*p^2*(W^.3-E^.3))^.5)-(2*(W+E))*(T-.4+((.4-T)^2+0.3333333334e-4*p^2*(W^.3-E^.3))^.5)-5*W*T)/T

${\rm\LaTeX}$ translation

$(p*(W+10^5W^{0.7}(0.16-(0.4-T)^2-\frac 13 10^{-4}p^2(W^{0.3}-E^{0.3}))/p^2 \\ -E)+10E-20W-2\cdot 10^6W^{0.7}(0.16-(0.4-T)^2-\frac 13 10^{-4}p^2(W^{0.3} \\ -E^{0.3}))/p^2-10-\frac 43 10^5W^{0.7}(0.4-((0.4-T)^2+\frac 13 10^{-4}p^2(W^{0.3} \\ -E^{0.3}))^{0.5})^3/p^2+160000W^{0.7}(0.4-((0.4-T)^2+\frac 13 10^{-4}p^2(W^{0.3} \\ -E^{0.3}))^{0.5})^2/p^2-(4(W+10^5W^{0.7}(0.16-(0.4-T)^2 \\ -\frac 13 10^{-4}p^2(W^{0.3}-E^{0.3}))/p^2))(0.4-((0.4-T)^2 \\ +\frac 13 10^{-4}p^2(W^{0.3}-E^{0.3}))^{.5})-(2(W+E))(T-0.4+((0.4-T)^2 \\ +\frac 13 10^{-4}p^2(W^{0.3}-E^{0.3}))^{0.5})-5WT)/T$

Thanks and Regards, Nilesh

edit by YemonChoi: I have tried to tidy up the formatting; the previous version had line breaks in confusing places, and the grouping of various expressions seemed to obscure various patterns. I am leaving the OP's version above, in case I made any accidental errors in editing.

Inspecting this version, it looks like some changes of variables, such as $t:= 1-5T/2$, might be helpful; but I think it's best to leave that for a later edit, just in case my reformatting has introduced any errosr.

\begin{aligned} T^{-1}\left[ p( W+10^5W^{0.7} p^{-2}(0.16-(0.4-T)^2-\frac 13 10^{-4}p^2(W^{0.3}-E^{0.3})) -E) \right. \\ +10E-20W \\ -2\cdot 10^6W^{0.7} p^{-2}\left(0.16-(0.4-T)^2-\frac 13 10^{-4}p^2(W^{0.3} -E^{0.3})\right) \\ -10 \\ -\frac{4}{3} 10^5W^{0.7} p^{-2}\left(0.4- \left[ (0.4-T)^2+\frac 13 10^{-4}p^2(W^{0.3} -E^{0.3}) \right]^{0.5}\right)^3 \\ +16\cdot 10^4 W^{0.7} p^{-2}\left(0.4-\left[ (0.4-T)^2 + \frac 13 10^{-4}p^2(W^{0.3}-E^{0.3})\right]^{0.5}\right)^2 \\ -4\left( W+10^5W^{0.7}p^{-2}\left[ 0.16-(0.4-T)^2 -\frac 13 10^{-4}p^2(W^{0.3}-E^{0.3}) \right] \right) \\ \times\left(0.4 - \left( (0.4-T)^2 +\frac 13 10^{-4}p^2(W^{0.3}-E^{0.3}) \right)^{0.5}\right) \\ -2(W+E) \left( T-0.4+\left( (0.4-T)^2 +\frac{1}{3} 10^{-4}p^2 (W^{0.3}-E^{0.3}) \right)^{0.5} \right) \\ \left. -5WT \right] \end{aligned}

• a) What is the domain in which you want to establish the concavity b) What makes you think that it is concave? (Have you checked a few random pairs of points, say?). If I were to bet, I would say that unless some miracle occurs, such thing should not be concave pretty much anywhere... – fedja Jul 17 '17 at 12:32
• I want to check concavity in following domain 0<=T<=0.4, E>=0, W>=0, p>=20, W>=E. I have a strong reason to believe that this function should be concave in some limited domain due to practical behavior of profit with respect to each of these variables. I have also confirmed concavity of profit function with respect to each variable individually. I also checked 4 by 4 Hessian of profit function at some random points and it shows negative definite which implies concavity. I want to check the concavity of profit function with respect to all four variables simultaneously. – ernilesh80 Jul 18 '17 at 18:15
• On hold already... When will people realize that the "research mathematics" doesn't need to be always beautiful or formulated in the language of sheaves and categories? My common sense rules are as simple as 1) If one cannot solve a problem after putting a serious effort into it, he is entitled to ask for help and 2) If the problem is clearly formulated and you cannot solve it, you'd better wait a bit before downvoting or voting to close. Voting to reopen. – fedja Jul 19 '17 at 2:34
• @fedja I could not agree with your points more, especially 2), voted for reopen. – Henry.L Jul 28 '17 at 19:10
• To the OP: does Suvrit's answer agree with yours? it would be good if you could engage with the contributions, now that the question has been re-opened – Yemon Choi Aug 8 '17 at 21:07

The following Matlab code suggests that the function fails to be concave in the regime of interest ($0\le T\le 0.4$, $E, W \ge 0$, $p \ge 20$, $W\ge E$.

f = @(E,W,T,p) (p*(W+1.000000000*10^5*W^.7*(.16-(.4-T)^2-0.3333333334e-4*p^2*(W^.3-E^.3))/p^2-E)+10*E-20*W-2.000000000*10^6*W^.7*(.16-(.4-T)^2-0.3333333334e-4*p^2*(W^.3-E^.3))/p^2-10-1.333333333*10^5*W^.7*(.4-((.4-T)^2+0.3333333334e-4*p^2*(W^.3-E^.3))^.5)^3/p^2+160000*W^.7*(.4-((.4-T)^2+0.3333333334e-4*p^2*(W^.3-E^.3))^.5)^2/p^2-(4*(W+1.000000000*10^5*W^.7*(.16-(.4-T)^2-0.3333333334e-4*p^2*(W^.3-E^.3))/p^2))*(.4-((.4-T)^2+0.3333333334e-4*p^2*(W^.3-E^.3))^.5)-(2*(W+E))*(T-.4+((.4-T)^2+0.3333333334e-4*p^2*(W^.3-E^.3))^.5)-5*W*T)/T;
flag = 1;
while flag
E1=rand;W1=E1+rand;T1=min(rand,0.4);p1=20+rand;
E2=rand;W2=E2+rand;T2=min(rand,0.4);p2=20+rand;
E=0.5*(E1+E2);W=0.5*(W1+W2);T=0.5*(T1+T2);p=0.5*(p1+p2);
lhs = f(E,W,T,p);
rhs = 0.5*(f(E1,W1,T1,p1)+f(E2,W2,T2,p2));
if (lhs + 1e-1 < rhs)  % to make a "stronger" countex
fprintf('countex %d < %d\n', lhs,rhs);
flag=0;
end
end

Using this code, very quickly we get a counterexample. Did I miss something? (I hope the copy-paste of $f$ to Matlab did not introduce any error).