- Input:
convex(3*exp(x)+5x^4-ln(x),x)
Output:
- Input:
convex(x^2+y^2+3z^2-x*y+2x*z+y*z,[x,y,z])
Output:
- Input:
convex(x1^3+2x1^2+2*x1*x2+x2^2/2-8x1-2x2-8,[x1,x2],simplify)
Output:
- In the example below, we find the values of a∈ℝ for which the function
is convex.
Input:
convex(x^2+x*z+a*y*z+z^2,[x,y,z])
Output:
Note that the function is convex for a=0. However, the convex
command does not support equalities as convexity constraints.
- For the next example, find all values a∈ℝ for which the
function
f(x,y,z)=x2+2 y2+a z2−2 x y+2 x z−6 y z
|
is convex on ℝ3.
Input:
convex(x^2+2y^2+a*z^2-2x*y+2x*z-6y*z,[x,y,z],simplify)
Output:
- Find the set S⊂ℝ2 on which the function
f:ℝ2→ℝ defined by
f(x1,x2)=exp(x1)+exp(x2)+x1 x2
|
is convex.
Input:
condition:=convex(exp(x1)+exp(x2)+x1*x2,[x1,x2],simplify)
Output:
Input:
lin(condition)
(See Section 5.24.4.)
Output:
From here you conclude that f is convex when x1+x2≥ 0. The
set S is therefore the half-space defined by this inequality.
The algorithm respects the assumptions that may be set upon variables.
Therefore, the convexity of a given function can be checked on a
particular domain.