| Author |
Comment/Response |
Peter Pein
|
10/31/09 06:31am
Hi,
the good old "NumericQ-trick" helps:
In[1]:= f[z_?NumericQ]:=Compile[{{x,_Real}},x x^2][z];
In[2]:= NMaximize[f[x],x]
Out[2]= {0.25,{x->0.5}}
this functiona can't be used to find exact values:
In[3]:= Maximize[f[x],x]
Out[3]= Maximize[f[x],x]
In[4]:= Maximize[x-x^2,x]
Out[4]= {1/4,{x->1/2}}
HTH,
Peter
URL: , |
|