Sqrt of (x^2-a^2) in cvx


Sir, I want to write D-sqrt(x^2-A^2) in cvx. Could you please help me writing it in cvx.


How does that appear in the model? In the objective? In a constraint? And what is constants and what is variables?

Thanks for reply.
It appears in objective function x is optimization variable. In the domain of my interest its 2nd derivative is positive. My problem is just to make it compatible with cvx and ‘a’ is constant.

Something like:

\begin{array}[lc] \mbox{min} & D -t \\ st. &(x+a)(x-a) \geq t^2 \\ & x-a \geq 0 \\ \end{array}

should do it.
The two constraints can expressed using a rotated quadratic cone.

Note we are actually saying

|t| \leq (x+a)^{0.5} (x-a)^{0.5}

so t has to be less than the geometric average of (x+a) and (x-a).

1 Like

Thanks for your prompt reply. I am just curious if this function appear in constraint then how would we right it.

Look at the rotated_lorentz entry at http://cvxr.com/cvx/doc/funcref.html#sets .