Function “atan” supported in CVX?

Hi all,

There is a inverse tangent function in my constraint. Actually, I use the Matlab built-in function “atan”. The expression of this constraint is:
x - atan(y) <= 0,
where x and y are scalar variable, and y>=0.

However, an error appears: Undefined function ‘atan’ for input arguments of type ‘cvx’.
Does this mean function “atan” is not supported in CVX?


`atan is neither convex nor concave, so not supported by CVX.

Thank you Mark. In my case, y>=0, so -atan(y) is convex in this domain of definition. And the constraint x-atan(y) is a convex set.

Is there anything I can do to make this constraint accepted by CVX? (Maybe something like the CVX build-in function “square_pos”?)

See my answer at How to introduce the arctan function into cvx

Thank you! This is helpful. I decide to try successive approximation.

By the way, in the future, will CVX include features to deal with function like arctan and tan? Maybe:

  1. add built-in function, e.g., “atan_pos”?
  2. include built-in successive approximation for arctan like what have been done for log function?

I doubt any of that will ever be added to CVX, which is not in a very active state of development (I am not the developer).

OK, I see. Thanks for reply!

Hello, I also encountered the same problem, but I don’t know how to make continuous approximation of this atan function. How do you solve it? Looking forward to your reply

The way you “solve it” is to to use some tool other than CVX. For instance, YALMIP, which allows non-convexities and has support for atan (and also supports atan2 in its develop branch )

Thank you! This is helpful. I will try it.