Error occurs although my problem is convex

My code is as follows. (In my real code, the indentation is observed well, but is not shown here.)

cvx_begin
variable x nonnegative
maximize( (44+41x-3x*x) * inv_pos(x+4))
subject to
x <= 10
cvx_end

Actually I want to use CVX to solve the following problem:

maximize w1 * log(1 + P1/n1) + w2 * log(1 + P2 / (beta*P1 + n2))
subject to P1+P2 <= Pmax ; P1, P2 >= 0.

where w1, w2, beta, n1, n2, Pmax are all given parameters and nonnegative.
I tried to solve the above problem, but I got some errors while using CVX.


Thus, I tried to solve a simplified problem of the above problem, by setting w1 = w2 = n1 = n2 = 1, beta = 0.25, and Pmax = 10, and by changing the first constraint form inequality to equality constraint.
The simplified problem is as follows.

maximize log(1 + x) + log(1 + (40-4x) / (x+4))
subject to 0 <= x <= 10

I tried to solve the above problem using the following code, but I got some errors again.


Using the fact that log is concave and increasing, I changed the problem as follows.

maximize (1+x) * (44-3x) / (x+4)
subject to 0 <= x <=10

The code is as follows.

cvx_begin
variable x
maximize( log(1 + x) * log(1+(10-x)/(0.25*x+1)) )
subject to
0 <= x <= 10
cvx_end

The error message is as follows.

image


Please note that when

f = (1+x) * (44-3x) / (x+4),

its second derivative is given as

f’’(x) = -336 / (x+4)^3.

Thus, for nonnegative x, f’’(x) is always negative, so f(x) is concave and max f(x) is a convex problem.

Divide and write your function as ax+b-\frac{c}{dx+f}.