Re: FindMinimum
- To: mathgroup at smc.vnet.net
- Subject: [mg8259] Re: FindMinimum
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Sat, 23 Aug 1997 01:58:56 -0400
- Organization: University of Western Australia
- Sender: owner-wri-mathgroup at wolfram.com
Fahad A Hoymany wrote:
> Here is the problem in case some kind soul wants to give it a try:
>
> Find the minimum of f in c and h
> f = (c d1+d2) r (2/((c+1) (h-c+1))) + d3 h/2 +
> (c d4+d5) r (2/((c+2)*(h-c+1)))
>
> Note that c <= h, and c,h >=0. If it helps, h < 10,000. The d's are
> real numbers in the range 0 to 1.0, and r is real in the range 0 to
> 100,000.
Here is your function rewritten to use subscript notation:
In[1]:= f[c_, h_] := (2*(c*Subscript[d, 1] + Subscript[d, 2])*r)/
((c + 1)*(-c + h + 1)) + (h*Subscript[d, 3])/2 +
(2*(c*Subscript[d, 4] + Subscript[d, 5])*r)/((c + 2)*(-c + h + 1))
To find the extrema you can compute the partial derivatives with respect
to x and h. You only need to set the Numerator:
In[2]:= {Numerator[Together[D[f[c, h], c]]] == 0,
Numerator[Together[D[f[c, h], h]]] == 0} /.
{r -> Random[Real, {0, 100000}],
Subscript[d, _] :> Random[Real, {0, 1}]}
Out[2]=
4 3 2 2
{2 (13011.9 c + 102386. c - 18052.9 h c + 272405. c +
50150.4 h c + 309163. c + 2736.01 h + 72338.6) == 0,
4 3 3
0.581759 c - 1.80445 h c + 0.653476 c +
2 2 2 2
0.986612 h c - 3.38305 h c - 31200.5 c +
2 2
2.591 h c + 1.9914 h c - 207997. c + 0.107197 h +
0.303971 h - 132371. == 0}
I have substituted in numerical values for r and the ds. You can also
solve the equations algebraically yielding some very large polynomial
expressions.
You can now use NSolve
In[3]:= NSolve[%, {h, c}]
Out[3]= {{h -> -257.165, c -> 2.44962},
{h -> -180.422 - 36.6747 I, c -> -3.51691 - 16.5083 I},
{h -> -180.422 + 36.6747 I, c -> -3.51691 + 16.5083 I},
{h -> -44.721 - 2056.97 I, c -> -0.0535149 - 0.000527709 I},
{h -> -44.721 + 2056.97 I, c -> -0.0535149 + 0.000527709 I},
{h -> -1.02774, c -> -0.712571},
{h -> 2.83194, c -> -5.96283},
{h -> 137.698, c -> -18.607},
{h -> 214.547, c -> 10.6122}, {h -> 243.964, c -> 3.53549}}
I tried several random values and found none that satisifed your
constraints. Also, you have to check whether these are maxima, minima,
or inflection points.
Cheers,
Paul
____________________________________________________________________
Paul Abbott Phone: +61-8-9380-2734
Department of Physics Fax: +61-8-9380-1014
The University of Western Australia
Nedlands WA 6907 mailto:paul at physics.uwa.edu.au
AUSTRALIA http://www.pd.uwa.edu.au/Paul
God IS a weakly left-handed dice player
____________________________________________________________________