Quad_over_lin squaring?

I am having a hard time formatting an equation ((x^2+y^2)/(x+y))^2 into quad_over_lin.

Here is what I have: minimize(square_pos(quad_over_lin(x(1),x(1)+x(2))+quad_over_lin(x(2),(x(1)+x(2)))))

This does not give solutions and am stuck. Any advice appreciated.

Whoops, I misread where parentheses are.

Hey mark, thanks for the timely reply. I understand that quad_over lin needs to be a correct format.

This: quad_over_lin(x(1),x(1)+x(2))+quad_over_lin(x(2),(x(1)+x(2)) actually functions and is accepted. I am wondering how I may go about squaring this entire thing. The form of the original equation is ((x^2+y^2)/(x+y))^2 and that is what I have been trying to account for.

Whoops, I misread where parentheses are.

Hey mark,

yes it is convex. I guess that leads me in the correct direction of having to prove it is.

Sorry. I misread where the last right parenthesis is. So it is convex.

This is accepted by CVX and implements your equation:

variables x(2)

ans =
cvx convex expression (scalar)

help quad_over_lin

quad_over_lin Sum of squares over linear.
Z=quad_over_lin(X,Y), where X is a vector and Y is a scalar, is equal to
SUM(ABS(X).^2)./Y if Y is positive, and +Inf otherwise. Y must be real.

If X is a matrix, quad_over_lin(X,Y) is a row vector containing the values
of quad_over_lin applied to each column. If X is an N-D array, the operation
is applied to the first non-singleton dimension of X.

quad_over_lin(X,Y,DIM) takes the sum along the dimension DIM of X.
A special value of DIM == 0 is accepted here, which is automatically
replaced with DIM == NDIMS(X) + 1. This has the effect of eliminating
the sum; thus quad_over_lin( X, Y, NDIMS(X) + 1 ) = ABS( X ).^2 ./ Y.

In all cases, Y must be compatible in the same sense as ./ with the squared
sum; that is, Y must be a scalar or the same size as SUM(ABS(X).^2,DIM).

Disciplined convex programming information:
    quad_over_lin is convex, nonmontonic in X, and nonincreasing in Y.
    Thus when used with CVX expressions, X must be convex (or affine)
    and Y must be concave (or affine).

Again, thanks for your reply.

I think my issue is that the solution is non-numberical. Should it not recite a numerical value back? I have parameters, but I believe this is the only part that is frustrating me.

If all the inputs are numerical (MATLAB double precision numbers), the output is a double precision number.

If any input is a CVX variable or expression, the output is a CVX expression, which you can the use however you want in your CVX program, consistent with CVX’s rules.