Re: FindMinimum within a specific interval
- To: mathgroup at smc.vnet.net
- Subject: [mg32633] Re: [mg32600] FindMinimum within a specific interval
- From: Andrzej Kozlowski <andrzej at platon.c.u-tokyo.ac.jp>
- Date: Fri, 1 Feb 2002 02:02:38 -0500 (EST)
- Reply-to: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Sender: owner-wri-mathgroup at wolfram.com
First of all, you will need to include the boundary, otherwise the problem may not have a solution. The function to use belongs to the Experimental context and is called Minimize. However, it requires that your expression to be minimized be a polynomial with rational coefficients and not floating point ones. So the first step is to rationalize the coefficients in your expression; In[1]:= f = Rationalize[(x + y + z - 1)^2 + (-65.96*x - 55.87*y + 132.19*z)^2 + (174.23*x + 148.29*y - 380.11*z)^2] Out[1]= ((17423*x)/100 + (14829*y)/100 - (38011*z)/100)^2 + (-1 + x + y + z)^2 + (-((1649*x)/25) - (5587*y)/100 + (13219*z)/100)^2 Next we load in the Experimental context: In[2]:= << "Experimental`" Now comes the real work In[3]:= Minimize[f, {1 >= x >= 0, 1 >= y >= 0, 1 >= z >= 0}, {x, y, z}] Out[3]= {66772644131209/74636972221209, {z -> 2221583705000/74636972221209, y -> 1880914795000/24878990740403, x -> 0}} Converting to floating point values: In[4]:= N[%] Out[4]= {0.8946322733096446, {z -> 0.02976519061378417, y -> 0.07560253607657125, x -> 0.}} To get some confidence we look at some random values of f inside the tetrahedron: In[5]:= And@@(Table[%[[1]]<f/.{x->Random[],y->Random[], z->Random[]},{20}]) Out[5]= True Seems to work. Andrzej Kozlowski Toyama International University JAPAN http://platon.c.u-tokyo.ac.jp/andrzej/ On Thursday, January 31, 2002, at 03:45 PM, Wassim T. Jalbout wrote: > Dear all, > > I have the following 3 simultaneous equations > > eq1 x + y + z - 1=0 > eq2 -65.96x - 55.87y + 132.19z=0 > eq3 174.23x + 148.29y - 380.11z=0 > > and I want to find the triplet (x,y,z) that best satisfies them within > the > interval 0>x>1, > 0>y>1 and 0>z>1. > > I realize, by using Solve, that the exact solution to simultaneous eqs > 1 to > 3 above, namely > (x=-3.6,y=4.5,z=0.1), lies outside the [0,1] interval for x and y and is > thus uninteresting to my work. > > So I thought of minimizing the following expression: > eq1^2+eq2^2+eq3^2 > within the interval 0 to 1 for (x,y,z) > > to do so I used FindMinimum as follows: > > FindMinimum [ (x + y + z - 1)^2 + (-65.96x - 55.87y + 132.19z)^2 + > > (174.23x + 148.29y - 380.11z)^2, {x, 0.1}, {y, 0.6}, > > {z,0.3}] > > where I can only specify starting points rather than fixed intervals > for x, > y and z.(unfortunately). > > The result I get is: > {1.0107607*^-28, {x->-3.6, y->4.5, z->0.10}} > with x,y,z values still outside the 0,1 interval. > > > How to to find the x,y,z value between 0 and 1 that results in the > smallest > value to my second degree expression written above? Is my approach wrong > alltogether? > > > I would appreciate any help, > Wassim. > > -------- > Wassim Jalbout, MS, D.ABMP, D.ABR > Radiation Physicist > Radiation Oncology Department > American University of Beirut, > Medical Center > Bliss St/ P.O.Box 113-6044 > Beirut - Lebanon > Tel- 961 3 654255/ 961 1 344839/ 961 1 374444 ext.5090 > Fax- 961 1 370795/ 961 1 345325 > > > >