MathGroup Archive 2005

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

Search the Archive

Re: Nesting NMaximize


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.


  • Prev by Date: Replacement rule for a quotient
  • Next by Date: basic issue with do and :=
  • Previous by thread: Re: Replacement rule for a quotient
  • Next by thread: Re: Nesting NMaximize