Representing convex part of "x over square of c - x"

Dear CVX community,

I would like to know how I can use the function x/(c-x)^2 which is convex over the interval 0 \leq x \leq c ?

I have successfully implemented x/(c-x) using “c*inv_pos(c-x)-1” but am unable to find such a way when the denominator is squared.

Thanks in advance for helping out,

Erick

I’m afraid I do not think this is possible. CVX really doesn’t allow for expressions that are convex over intervals but not their entire domain.

Your inv_pos trick works for x/(c-x) because inv_pos is differentiable over its entire domain. With x/(c-x)^2, there might be a way to represent it for x\lt c, but for x\gt c there is an inflection point where the second derivative transitions from positive to negative, and this is a sign that CVX simply will be unable to handle it.