Express 1/(a^2+x^2) in cvx

(Vannel) #1

I want to use the cvx to express 1/(a^2+x^2), where a is a constant and x is a variable. It is a convex function. But I find it hard to solve it in cvx.
My code is in the following

variable x
expression z
z=norm([a x]) ;

minimize ( prod_inv(z) )
subject to


Can you help to express 1/(a^2+x^2)? Thanks a lot.

(Vannel) #2

Sorry, there is an obvious mistake in the code I wirte. Please ignore it. But I still want to express 1/(a^2+x^2) in cvx.

(Michal Adamaszek) #3

This function is only convex on a sub-interval of its natural domain. Such things are notoriously hard to model using DCP rules.

(Mark L. Stone) #4

Indeed, it is only convex for x^2 \ge a^2/3 (which, although only mattering as a piece of trivia, is itself a non-convex region).

I guess this is another expression for @Erling’s challenge., which, as shown below, does not exclude expressions which are not convex over their entire natural domain. Maybe the challenge should be clarified to include that provision.

Conic modeling challenge by Do you have a nonlinear constraint that can be written in a modeling language, but can’t be represented with linear, socp, sdp, exponential cone and power cones?