Convexification of Tan(x)

Sorry for the question which is not exactly related to CVX but I’m trying to use CVX to solve a problem that has a constraint that contains the function tan(theta2-theta1) where both angles are unknowns. Is there a way to convexify such function?

The one term Taylor expansion, which is the linear approximation, theta2 -theta1 can be used, but will only be “valid” (good) for small (whatever that is) values of |theta2 - theta1|. That might be a lousy approximation for use in an optimization problem. You could do successive convex approximation (in this case linearizartion) by using CVX to solve subproblems in which the linearization is performed around the optimal value from the preceding CVX subproblem (and using an initial value before the first subproblem) - there are no guarantees it will converge to anything, let alone a global or even local optimum of the original problem.

Unless abs(theta2 - theta1) is constrained to be small, you are probably better of using a non-convex nonlinear optimizer, which is designed to handle such problems.

What about convex hull for a portion of the function? Would that be possible?

If you construct a convex hull which is consistent with CVX’s rules, then you can implement it in CVX. Whether that convex hull proves useful toward adequately and accurately enough solving your original problem is another matter.

In principle you can construct a better approximation than linear approximation by using a piecewise linear approximation using binary variables. So something similar to http://homepages.rpi.edu/~mitchj/handouts/piecewise/ or http://winglpk.sourceforge.net/media/glpk-sos2_02.pdf , which can be implemented in CVX using binary variables (MIDCP).

I think you are better off following my original advice to use a non-convex nonlinear optimizer, which is designed to handle such problems.

Thanks a lot. One last question. If I have the function x.tan(theta2-theta1) where x is a continuous variable. Is there any way of convexifying such expression?

Only in the most tortured way using approximate binary expansions of the continuous variables and then linearizing the product terms. So practically speaking, no.