# About convex function branch method

Hello,

if there have two function, which is non-increasing and the other is non-decreasing

but they have a intersectional point lets two function become a convex function

how do I implement kind of this problem in cvx?

another question:

can cvx decision which function to use base on what kinds of conditions?

Please provide a detailed description, or at least an example, of the mathematical problem (functions) you are trying to model. What is the optimization problem you want to model and solve in CVX? The more detailed and clear the information you provide, the better the chance you will get useful help

variable x(2)

variable y(2)

f(x1, x2, y1, y2)=

cd + a( r/d - 1) if r-d>= 0 it’s non-increasing

c*d + r/d - 1 if r-d<= 0 it’s non-decreasing

and they can intersect in while d= r

where d= dist of two point(x1, y1) (x2, y2)

“r” and “a” are constant

so they are convex function and can find

Is it my definition of function more closed to sequence convex programming ?

Even if a were 1, so that both “branches” were the same, this is non-convex. See Cvx expression divide problem . No matter how many times you ask or how badly you want it to be convex, it is not.

this wed is the function curve.
so if the curve if convex, i still can not use cvx to solve it?
http://imgur.com/v9GPTVE

No. The list of accepted functions in the documentation is complete. If your model cannot be built according to the DCP ruleset using those functions only, CVX cannot solve it.

The function itself is likely not the problem anyway; it is the nonlinear inputs you are feeding it that are.

completed function

http://imgur.com/VIldHL8

By the way, can my functions still be called a convex function?