# {convex}^{2} or {convex}^{3}?

How do I express this formula in CVX? Thanks!
E(n) = 1+3v(n)^2+v(n)^3
v(n) = ||q(n+1)-q(n)||. The variable is q(2,N).The objective function has been simplified.

``````     minimize E(n)
``````

Because `v(n)` is a norm, and hence nonnegative, you can use `pow_pos`. For the ^2, you an alternatively use `square_pos` if you want,

I’m sorry, you’re saying that E(n) can be represented in terms of pow_pos?
That’s what I’m doing in my code right now:

``````      E(n) = 1+(3*pow_pos(v(n),2))+pow_pos(v(n),3);
``````

Is that what you mean? Thanks a lot!

Yes.

help pow_pos

pow_pos Power of positive part.
pow_pos(X,P) = POS(X).^P = MAX(X,0).^P.
Both P and X must be real, and P must be greater than or equal to 1.

``````Disciplined convex programming information:
pow_pos(X,P) is convex and nondecreasing in X; so when used in CVX
expressions, X must be convex. P must be constant, real, and
greater than or equal to 1.``````

I think I can resolve it. Thank for your help!