Re: Nesting NMaximize
- To: mathgroup at smc.vnet.net
- Subject: [mg60389] Re: Nesting NMaximize
- From: "Valeri Astanoff" <astanoff at yahoo.fr>
- Date: Thu, 15 Sep 2005 05:16:11 -0400 (EDT)
- References: <dg8lln$rci$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Nesting NMaximize. Here is a toy example that might inspire you : In[1]:=f1[x_, p_] := a*x^2 + p*x + b; In[2]:=para1 = {a -> -1, b -> 2}; In[3]:=maxi1[p_?NumberQ]:= x /. NMaximize[f1[x,p] /. para1,x][[2]]; In[4]:=f2[x_, q_]:=c*x^4 + q*maxi1[x]*x + d; In[5]:=para2 = {c -> -3,d -> 4}; In[6]:=maxi2[q_?NumberQ]:= x /. NMaximize[f2[x,q] /. para2,x][[2]]; In[7]:=maxi2[1] Out[7]=0.288675 hth v.a.