"lovish " <lovishagarwal@gmail.com> wrote in message <grtdv1$ou$1@fred.mathworks.com>...
> I apologize for the same. Being new to the community I wasn't aware of this fact of continuing with the old post.
>
> Secondly for using simple calculus method in this problem, Please guide me as to how you used simple calculus to find maxf(x).
>
> Other than that,this is just a sample of a extremely complex problem which I;m working on and I wonder whether calculus can work for equations which involves 20 variables. If it can work , please let me know the methodology that you are using.
>
> I apologize once again for the inconvenience caused to you and other members. I have to apologize that without reading your this post,I posted another questions which has the same flavor as a new thread. I sincerely apologize for that too. I will take care of such things in future.
As to the use of simple calculus in your original problem, the reasoning goes this way. Presumably you wish to restrict x1, x2, and x3 to positive values to avoid complex results for the logarithm function. That, along with the further restrictions x1+x2<=1 and x1+x3<=1, limits you to a bounded tetrahedral region in the x1, x2, x3 space.
Also f(x1,x2,x3) = log(x1)+log(x2)+log(x3) = log(x1*x2*x3), and since the logarithm is monotonically increasing, we have
max(f(x1,x2,x3)) = log(max(x1*x2*x3))
If you take a cross section of this region orthogonal to the x1 axis with the value x1 = x, it would be a square with its four corners at:
(x,0,0), (x,1x,0), (x,0,1x), and (x,1x,1x)
The product x1*x2*x3 will be increasing as x2 and x3 increase in the square, so the maximum value within the square will occur at the corner (x,1x,1x). This shows that the maximum in the region will occur somewhere along the line segment connecting (0,1,1) and (1,0,0). This is a problem in calculus: find the maximum value of g(x) = x*(1x)*(1x) = x^32*x^2+x for 0<=x<=1. Taking the derivative gives
g'(x) = 3*x^24*x+1 = (1x)*(13*x)
which is zero at x = 1 and x = 1/3. Clearly the maximum of g(x) is at x=1/3 where g(1/3) = 1/3*(11/3)*(11/3) = 4/27. This gives the answer of
max(f(x1,x2,x3)) = log(4/27).
For the "extremely complex problem ... which involves 20 variables" I agree that it is doubtful that you could use such simple methods to solve it. So you will probably have to follow John D'Errico's advice and use 'fmincon' of the Optimization Toolbox. You should be forewarned that with as many as 20 variables this function can encounter great difficulties. For it to explore even such a simple thing as every possible combination of two discrete values of each of the twenty variables takes over a million evaluations! You may find it expedient to effectively eliminate many of your twenty variables in some clever manner.
Roger Stafford
