How do I plot function $f(x1,x2)=x^4_1+x^4_2$ such that $x^2_1+x^2_2=1$ and $x_1,x_2\in(0,1)$? Does it possible to plot in MATLAB so that I can visualize the function?
Also I am trying to check whether $f$ is convex or not, because I am trying to optimize it and accordingly formulate the problem like that
Maximize $x^{4}_1+x^{4}_2+\cdots+x^{4}_n$
Subject to
$x^{2}_1+x^{2}_2+\cdots+x^{2}_n=1$
$x_i\in(0,1)$, $i=\{1, 2, \ldots, n\}$
And I calculate its Hessian matrix: $$ H=\left[ \begin{array}{cc} 12x^{2}_1 & 0 \\ 0 & 12x^{2}_2 \end{array}\right] $$
After that I don't know how to proceed. Can anyone help me to prove whether f is convex or not?
Thank you very much.
The term "convex" is a bit overloaded. In this single problem alone it needs to be used to ask three different questions:
These questions are not the same, and one does not necessarily imply the others.
Your function $f$ is convex. That is easily verified, as you have done, by examining the Hessian.
Your constraint set $\left\{x\in(0,1)^n\,\middle|\,\sum_i x_i^2=1\right\}$ is not convex. Nonlinear equality constraints are almost never convex. This set describes the positive quadrant of the unit hypersphere, and this is not convex. Indeed, take any distinct pair of points in the set; their midpoint is not in the set (a necessary condition for convexity).
Finally, a convex optimization model requires that:
Your model fails both tests, because you are maximizing a convex function, and your nonlinear equality constraint is not convex.
EDIT: I should add that you could relax your constraint to $\left\{x\in(0,1)^n\,\middle|\,\sum_i x_i^2\leq 1\right\}$ without changing the optimal value of the problem. This would make your constraint set convex; but it would still be a nonconvex optimization problem, due to your attempt to maximize a convex function.
All that said, this problem is not that difficult to solve. In order to make the optimum achievable we need to relax the constraints to $\left\{x\in[0,1]^n\,\middle|\,\sum_i x_i^2\leq 1\right\}$ (i.e., non-strict inequalities on $x$). In that case, the optimal value is 1, and the optimal points are all of the unit vectors with a single non-zero value of $1$.