MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Select Output of FindMinimum


FindMinimum returns a list of the form {fmin, {x->xmin}}, where fmin is 
the minimum value of f found, and xmin is the value of x for which it is 
found (Help Browser). The only thing is that xmin is given in the form 
of a "rule". So, if you want to extract the value of xmin, proceed as in 
the following example:

In[1]:=
FindMinimum[Sin[x], {x, 1}]
Out[1]=
{-1., {x -> -1.5708}}
In[2]:=
x = x /. x -> -1.5708
Out[2]=
-1.5708

Now x has the value you want:

In[3]:=
x
Out[3]=
-1.5708

Alternatively:

In[4]:=
FindMinimum[Sin[x], {x, 1}][[2, 1, 2]]
Out[4]=
-1.5708

To see why, look at FullForm.

Tomas Garza
Mexico City

"Philipp Gunz" <gunz at treangeli.at> wrote:

> Im having troubles selecting the output of the FindMinimum-Function:
>
> minimize =
>   FindMinimum[(neupunkte[[1]] - splinespec[u]).(neupunkte[[1]] -
>           splinespec[u]), {u, 0.0001, splinespec[[2, 2]]}, Compiled -> 
True]
>
> OUT: {0.00138329, {u -> 1.88935}}
>
> What I need for further calculations is the value of u ... and I 
don't know
> how to extract that information.




  • Prev by Date: Re: Select Output of FindMinimum
  • Next by Date: Re: Mathematica -> "AI"
  • Previous by thread: Re: Select Output of FindMinimum
  • Next by thread: Bugs in Abs and Sign !?