[Date Index] [Thread Index] [Author Index]
Re: NMinimize problem
On 2/17/14 at 11:05 PM, reiser.paul at gmail.com (PAR123) wrote: >I have a function f[x] which I want to minimize, but its rather >involved, it will return a number for a numerical x, but if x is >symbolic, it's not going to happen. >Trying to use NMinimize, I get errors that are consistent with >NMinimize calling f with a symbolic argument. Is there something >simple I am doing wrong? To prevent a function from evaluating with symbolic arguments define it this way: In:= f[x_?NumericQ] := 2 x In:= f[4.7] Out= 9.4 In:= f[y] Out= f(y) Without more detail of your specific issue there isn't anything I can suggest beyond defining the function to only evaluate with numeric arguments.