figure( 1 )
plot( a, pent );
xlabel( ‘x’ );
ylabel( ‘PDF( x )’ );
but this breaks down and fails to give a solution when I add the third moment constraint (a3). I know that a solution exists and have calculated it with other methods, could anyone advise me as to what is going on? I get the status infeasible and that the optimal value is -Inf.
I believe that is because with the inclusion of the a3,b(3) constraint, there is no value of pent which is >= 0. So CVX is scoring the objective function as -Inf, and apparently declaring it to be infeasible. So in effect, CVX is adding the constraint pent >= 0, which results in an infeasible problem.
My technical description as to what CVX is doing internally might not be quite right, but I think I have described the essence of the situation.
Could you explain why it is doing this? clearly the exponential distribution of the form \frac{1}{Z}\exp(-\alpha x -beta x^{2} - \gamma x^{3}) fits the constraints. This is from solving the equation of maximum entropy and the lagrange multipliers explicitly.
Per the documentation, entr returns -Inf when its argument is negative. Given your full set of constraints, there is no feasible solution which does not have at least one negative component - you can verify that yourself. Therefore, the objective value equals -Inf for any feasible value of pent.
I’m super confused here. Why is there no feasible solution with a negative p(x)? the exponential of a negative is still positive? my solution is non negative on the whole domain. Explain how in the set of 0-1 having 3 decreasing moment constraints has no solution?
What I’m trying to say is that clearly something is going wrong here, maybe my code is a problem? why are we setting a moment constraint as A * pent, should it not be sum(a*pent), I have tried this but get no solution
O.k then, how can I solve a problem of finding the pent that maximises the entropy in the space of 0-1 with 3 moment constraints? so mean of x is some value, the mean of x^2 is another and the mean of x^3 is another value (all positive) is there anything wrong with my code so far to do this simple problem?
I just looked at the full example. It has A * pent <= b . You have A * pent == b . Changing it to A * pent <= b , the problem solves to reported optimality.
And I think perhaps you in general need 0<= pent <= 1, even though you may get away without having this in some circumstances. (Actually pent <= 1 is redundant given 0 <= pent and sum(pent) == 1.) That would make the feasibility situation more explicitly evident.
Using equality instead of inequality constraint, you are overconstraining.