Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: Nested optimization teaser

  • To: mathgroup at
  • Subject: [mg46072] Re: Nested optimization teaser
  • From: "Joshua A. Solomon" <J.A.Solomon at>
  • Date: Thu, 5 Feb 2004 04:02:52 -0500 (EST)
  • References: <bvpas6$sd1$>
  • Sender: owner-wri-mathgroup at

Thanks to Paul Abbot on another thread, I now know the answer is

In[1]:= egg[in_?NumericQ]:=NMinimize[{(x-in)^2},{{x,-1,1}}][[2,1,2]]


On 3/2/04 11:29 pm, in article bvpas6$sd1$1 at, "Joshua A.
Solomon" <J.A.Solomon at> wrote:

> Consider the toy identity function egg:
> In[1]:= egg[in_]:=NMinimize[{(x-in)^2},{{x,-1,1}}][[2,1,2]]
> In[2]:= egg[#]&/@{1,2,3}
> Out[2]:= {1.,2.,3.}
> Now then, clearly
> In[3]:= NMinimize[(2-a)^2,a]
> Out[3]:= {0.,{a->2.}}
> However,
> In[4]:= NMinimize[(2-egg[a])^2,a]
> Out[4]:= {9.,{a->0}}
> I know why this happens. What I don't know, is how to properly construct a
> nested optimization so this doesn't happen. Specifically, how can I find the
> minimum value (and the parameter values that produce it) of a function that
> depends on the minimum value of another function, which, in turn, depends on
> those same parameters?
> js

  • Prev by Date: Re: help for time series basic operations
  • Next by Date: InputAutoReplacements With "-marks
  • Previous by thread: Nested optimization teaser
  • Next by thread: Re: arnoldi method with Mathematica